If you are programming in another language, you can use Literal AI’s GraphQL API endpoint.

The API url is: https://cloud.getliteral.ai/api/graphql. If you follow that link, and you have previously logged into the Literal AI platform, you can see the GraphQL query documentation and you can make queries. The button on the top left corner leads you to the documentation (1).

There are two types of GraphQL functions: Query and Mutation. Use a Query if you want to fetch data or information from Literal AI, and Mutation if you want add, update or delete data.

You can build queries using the GraphiQL Explorer (2).

Yoga GraphiQL IDE

You can make GraphQL requests via cURL. To make a query, do a HTTP POST request, since all GraphQL API requests use the POST method. Make sure you pass your Literal AI API key.

A query to fetch the id and name of all Datasets in Literal AI:

curl -X POST https://cloud.getliteral.ai/api/graphql \
-H "x-api-key: $LITERAL_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "query": "query MyQuery { datasets(projectId: \"PROJECT_NAME\") { edges { node { id name } } } }" }'

A Mutation query to create a new prompt:

curl -X POST https://cloud.getliteral.ai/api/graphql \
-H "x-api-key: $LITERAL_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "query": "mutation MyMutation { createPromptLineage(name: \"NewPrompt\", projectId: \"PROJECT_NAME\") { id } }" }'

Was this page helpful?