Stash API¶
The Stash GraphQL API facilitates automated operations through a type-based schema that is both introspective and self-documenting.
Stash includes an integrated playground where users can execute queries and retrieve schema structures and documentation via a special introspection query.
- You can access the playground by navigating to
<server>:<port>/playground
(default: http://localhost:9999/playground). - Click on the left to access the Documentation Explorer.
All HTTP requests should be directed to <server>:<port>/graphql
(default: http://localhost:9999/graphql
).
Tip
For further information, visit the official GraphQL site.
Authentication¶
Include the API key generated in Stash in the header of every request. For details on obtaining the API Key, refer to Stash's in-app manual.
Replace <your_api_key>
with your API Key found under Settings > Security > Authentication.
Replace <graphql_query>
with the raw query, which can be formatted using the playground.
curl -X POST -H "ApiKey: <your_api_key>" -H "Content-Type: application/json" --data '{ "query": "<graphql_query>" }' localhost:9999/graphql
Legacy cookie authentication¶
For configurations using a username/password, cookies must be used for authentication.
curl --verbose --cookie-jar cookie.txt --data 'username=stash&password=**' localhost:9999/login
curl --cookie cookie.txt -H "Content-Type: application/json" --data '{ "query": "<graphql_query>" }' localhost:9999/graphql
It is recommended to use the API Key
method over the legacy cookie method.