We have provided examples of how to query the Athina AI GraphQL API using cURL and Python. You can use these examples to fetch data from the API and integrate it into your applications.
You can find here an entire postman collection with different types of queries for reference. You can download the collection and import it into your postman application.
To use the Athina AI GraphQL API in Node.js, make sure that you have the request library installed. You can install these packages with the following commands:
Note: The python example uses the gql and aiohttp libraries to communicate with the API. You can alternatively use just requests library to communicate with the API directly as well.
To use the Athina AI GraphQL API, make sure that you have the gql and aiohttp libraries installed in your Python environment. You can install these packages with the following commands:
Here’s how to setup a GraphQL client to communicate with the Athina GraphQL API:
from gql.transport.aiohttp import AIOHTTPTransportfrom gql import gql, Clienturl = "https://api.athina.ai/graphql"# Replace <ATHINA_API_KEY> with your athina api key obtained from the dashboardtransport = AIOHTTPTransport(url=url, headers={ "athina-api-key": "<ATHINA_API_KEY>"})client = Client(transport=transport, fetch_schema_from_transport=True)
In this code:
url is the endpoint of the Athina AI GraphQL API.
AIOHTTPTransport establishes the connection to the API endpoint.
Client is a GraphQL client that communicates with the API using the provided transport.
SIZE is the number of records fetched per request.
gql parses the GraphQL query.
client.execute runs the query and returns the result. The variable_values parameter is used to set the limit and page in the GraphQL query.
The response contains a list of PromptRun objects. Each PromptRun object contains the following fields: id, org_id, prompt_slug, language_model_id, prompt_response, and prompt_tokens.
{"docsConfig":{"$schema":"https://mintlify.com/docs.json","theme":"mint","name":"Athina","colors":{"primary":"#1976D2","light":"#419BF4","dark":"#1976D2"},"favicon":"/logo/light.svg","logo":{"light":"https://mintlify.s3.us-west-1.amazonaws.com/athinaai/logo/light.svg","dark":"https://mintlify.s3.us-west-1.amazonaws.com/athinaai/logo/dark.svg"},"api":{"mdx":{"server":null,"auth":{"method":"key","name":"athina-api-key"}}},"navbar":{"links":[{"label":"AI Hub","href":"https://hub.athina.ai"},{"label":"Website","href":"https://athina.ai"}],"primary":{"type":"button","label":"Sign-up","href":"https://app.athina.ai/"}},"footer":{"socials":{"twitter":"https://twitter.com/AthinaAI","linkedin":"https://linkedin.com/company/athina-ai"}},"integrations":{"ga4":{"measurementId":"G-KZVC5R2GB1"}},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"athinaai","hasAudioNarration":false,"actualSubdomain":"athinaai","customDomains":["docs.athina.ai"],"gitSource":{"type":"github","owner":"athina-ai","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6a21e615bd0a90f91cb442e4","collectionId":"b894bf83-39f4-42e1-9517-d1cffb901672","schemaVersion":"v2"},"feedback":{"thumbs":false},"entitlements":{},"buildId":"6a21e615bd0a90f91cb442e4:success","clientVersion":"0.0.4045","searchFilterCounts":[{"language":"default","tag":"Documentation","count":166},{"language":"default","tag":"Docs","count":79},{"language":"default","tag":"API / SDK Reference","count":54},{"language":"default","tag":"Evals","count":52},{"language":"default","tag":"Datasets","count":37},{"language":"default","tag":"Guides","count":23},{"language":"default","tag":"Logging","count":21},{"language":"default","tag":"Preset Evals","count":15},{"language":"default","tag":"Prompts","count":14},{"language":"default","tag":"Logging LLM Inferences","count":13}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"api-reference/graphql-api/curl-python-examples","slug":"/api-reference/graphql-api/curl-python-examples","pageMetadata":{"title":"Query the Graph API using cURL or Python","sidebarTitle":"Curl and Python Examples","description":"We have provided examples of how to query the Athina AI GraphQL API using cURL and Python. You can use these examples to fetch data from the API and integrate it into your applications.","href":"/api-reference/graphql-api/curl-python-examples"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"We have provided examples of how to query the Athina AI GraphQL API using cURL and Python. You can use these examples to fetch data from the API and integrate it into your applications.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsxs(Heading,{level:`2`,id:`postman-collection`,children:[`Postman Collection`,_jsx(_components.a,{href:`#postman-collection`})]}),`\n`,_jsxs(_components.p,{children:[`You can find \\xA0 `,_jsx(_components.a,{href:`https://docs.athina.ai/GraphQL.postman_collection.json`,children:`here`}),` \\xA0 an entire postman collection with different types of queries for reference. You can download the collection and import it into your postman application.`]}),`\n`,_jsxs(Heading,{level:`2`,id:`curl`,children:[`cURL`,_jsx(_components.a,{href:`#curl`})]}),`\n`,_jsx(_components.p,{children:`To start, let’s make a request via cURL to query data from Athina AI GraphQL API.`}),`\n`,_jsxs(Heading,{level:`3`,id:`fetching-data-from-the-api`,children:[`Fetching Data from the API`,_jsx(_components.a,{href:`#fetching-data-from-the-api`})]}),`\n`,_jsx(CodeBlock,{numberOfLines:`12`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`12`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`# Replace \u003cATHINA_API_KEY> with your athina api key obtained from the dashboard`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`curl --location 'https://api.athina.ai/graphql' \\\\`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`--header 'Content-Type: application/json' \\\\`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`--header 'athina-api-key: \u003cATHINA_API_KEY>' \\\\`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`--data '{`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"query\": \"query GetPromptRuns($limit: Int!) { getPromptRunsByFilters(limit: $limit) { id org_id prompt_slug language_model_id prompt_response prompt_tokens}}\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"variables\": {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"limit\": 2,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"page\": 0`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`}'`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(Heading,{level:`2`,id:`node-js`,children:[`Node.js`,_jsx(_components.a,{href:`#nodejs`})]}),`\n`,_jsxs(Heading,{level:`3`,id:`prerequisites`,children:[`Prerequisites`,_jsx(_components.a,{href:`#prerequisites`})]}),`\n`,_jsxs(_components.p,{children:[`To use the Athina AI GraphQL API in Node.js, make sure that you have the `,_jsx(_components.code,{children:`request`}),` library installed. You can install these packages with the following commands:`]}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`npm install request`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(Heading,{level:`3`,id:`fetching-data-from-the-api-2`,children:[`Fetching Data from the API`,_jsx(_components.a,{href:`#fetching-data-from-the-api-1`})]}),`\n`,_jsx(_components.p,{children:`Here’s an example of how to query the Athina AI GraphQL API using Node.js:`}),`\n`,_jsx(CodeBlock,{numberOfLines:`22`,language:`c`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`c`,children:_jsxs(_components.code,{language:`c`,numberOfLines:`22`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`var request `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` require`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'request'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Replace \u003cATHINA_API_KEY> with your athina api key obtained from the dashboard`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`var options `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'method'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'POST'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'url'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'https://api.athina.ai/graphql'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'headers'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Content-Type'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'application/json'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'athina-api-key'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'\u003cATHINA_API_KEY>'`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` body: `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"query\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"query GetPromptRuns($limit: Int!) { getPromptRunsByFilters(limit: $limit) { id org_id prompt_slug language_model_id prompt_response prompt_tokens}}\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"variables\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"limit\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"page\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` })`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`};`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(options, `}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (error, response) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (error) throw new `}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`Error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(error);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`body`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsxs(Heading,{level:`2`,id:`python`,children:[`Python`,_jsx(_components.a,{href:`#python`})]}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Note`}),`: The python example uses the `,_jsx(_components.code,{children:`gql`}),` and `,_jsx(_components.code,{children:`aiohttp`}),` libraries to communicate with the API. You can alternatively use just `,_jsx(_components.code,{children:`requests`}),` library to communicate with the API directly as well.`]})}),`\n`,_jsxs(Heading,{level:`3`,id:`prerequisites-2`,children:[`Prerequisites`,_jsx(_components.a,{href:`#prerequisites-1`})]}),`\n`,_jsxs(_components.p,{children:[`To use the Athina AI GraphQL API, make sure that you have the `,_jsx(_components.code,{children:`gql`}),` and `,_jsx(_components.code,{children:`aiohttp`}),` libraries installed in your Python environment. You can install these packages with the following commands:`]}),`\n`,_jsx(CodeBlock,{numberOfLines:`3`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`pip install gql`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`pip install aiohttp`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(Heading,{level:`3`,id:`setting-up-a-graphql-client`,children:[`Setting up a GraphQL Client`,_jsx(_components.a,{href:`#setting-up-a-graphql-client`})]}),`\n`,_jsx(_components.p,{children:`Here’s how to setup a GraphQL client to communicate with the Athina GraphQL API:`}),`\n`,_jsx(CodeBlock,{numberOfLines:`11`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`11`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` gql.transport.aiohttp `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` AIOHTTPTransport`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` gql `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` gql, Client`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`url `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://api.athina.ai/graphql\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Replace \u003cATHINA_API_KEY> with your athina api key obtained from the dashboard`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`transport `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` AIOHTTPTransport(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`url`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`url, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`headers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"athina-api-key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"\u003cATHINA_API_KEY>\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`client `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Client(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`transport`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`transport, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`fetch_schema_from_transport`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`In this code:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`url`}),` is the endpoint of the Athina AI GraphQL API.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`AIOHTTPTransport`}),` establishes the connection to the API endpoint.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`Client`}),` is a GraphQL client that communicates with the API using the provided transport.`]}),`\n`]}),`\n`,_jsxs(Heading,{level:`3`,id:`fetching-data-from-the-api-3`,children:[`Fetching Data from the API`,_jsx(_components.a,{href:`#fetching-data-from-the-api-2`})]}),`\n`,_jsx(_components.p,{children:`Here’s how to fetch data from the Athina AI API using GraphQL:`}),`\n`,_jsx(CodeBlock,{numberOfLines:`24`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`24`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`SIZE = 5`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`query = gql(`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"\"\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` query GetPromptRuns($limit: Int!, $page: Int!) {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` getPromptRunsByFilters(limit: $limit, page: $page) {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` id`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` org_id`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` prompt_slug`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` language_model_id`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` prompt_response`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` prompt_tokens`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"\"\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`result = client.execute(query,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` variable_values={`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"limit\": SIZE,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"page\": 0`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`print(len(result[\"getPromptRunsByFilters\"]))`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`print(result)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`In this code:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`SIZE`}),` is the number of records fetched per request.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`gql`}),` parses the GraphQL query.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`client.execute`}),` runs the query and returns the result. The `,_jsx(_components.code,{children:`variable_values`}),` parameter is used to set the `,_jsx(_components.code,{children:`limit`}),` and `,_jsx(_components.code,{children:`page`}),` in the GraphQL query.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`The response contains a list of `,_jsx(_components.code,{children:`PromptRun`}),` objects. Each `,_jsx(_components.code,{children:`PromptRun`}),` object contains the following fields: `,_jsx(_components.code,{children:`id`}),`, `,_jsx(_components.code,{children:`org_id`}),`, `,_jsx(_components.code,{children:`prompt_slug`}),`, `,_jsx(_components.code,{children:`language_model_id`}),`, `,_jsx(_components.code,{children:`prompt_response`}),`, and `,_jsx(_components.code,{children:`prompt_tokens`}),`.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Query the Graph API using cURL or Python","sidebarTitle":"Curl and Python Examples","description":"We have provided examples of how to query the Athina AI GraphQL API using cURL and Python. You can use these examples to fetch data from the API and integrate it into your applications.","href":"/api-reference/graphql-api/curl-python-examples"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Postman Collection","slug":"postman-collection","depth":2,"children":[]},{"title":"cURL","slug":"curl","depth":2,"children":[{"title":"Fetching Data from the API","slug":"fetching-data-from-the-api","depth":3,"children":[]}]},{"title":"Node.js","slug":"node-js","depth":2,"children":[{"title":"Prerequisites","slug":"prerequisites","depth":3,"children":[]},{"title":"Fetching Data from the API","slug":"fetching-data-from-the-api-2","depth":3,"children":[]}]},{"title":"Python","slug":"python","depth":2,"children":[{"title":"Prerequisites","slug":"prerequisites-2","depth":3,"children":[]},{"title":"Setting up a GraphQL Client","slug":"setting-up-a-graphql-client","depth":3,"children":[]},{"title":"Fetching Data from the API","slug":"fetching-data-from-the-api-3","depth":3,"children":[]}]}],"codeExamples":{}},"jsLinks":[],"subdomain":"athinaai","siteName":"Athina","title":"Query the Graph API using cURL or Python - Athina","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"originalFileLocation":"api-reference/graphql-api/curl-python-examples.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"We have provided examples of how to query the Athina AI GraphQL API using cURL and Python. You can use these examples to fetch data from the API and integrate it into your applications.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Athina\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"https://mintlify.s3.us-west-1.amazonaws.com/athinaai/_generated/favicon/apple-touch-icon.png?v=3\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"https://mintlify.s3.us-west-1.amazonaws.com/athinaai/_generated/favicon/favicon-32x32.png?v=3\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"https://mintlify.s3.us-west-1.amazonaws.com/athinaai/_generated/favicon/favicon-16x16.png?v=3\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"https://mintlify.s3.us-west-1.amazonaws.com/athinaai/_generated/favicon/favicon.ico?v=3\">\u003cmeta data-mint-head property=\"og:title\" content=\"Query the Graph API using cURL or Python - Athina\">\u003cmeta data-mint-head property=\"og:description\" content=\"We have provided examples of how to query the Athina AI GraphQL API using cURL and Python. You can use these examples to fetch data from the API and integrate it into your applications.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Athina\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.athina.ai/api-reference/graphql-api/curl-python-examples\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://athinaai.mintlify.app/_mintlify/api/og/v2?division=GraphQL+API\u0026amp;title=Query+the+Graph+API+using+cURL+or+Python\u0026amp;description=We+have+provided+examples+of+how+to+query+the+Athina+AI+GraphQL+API+using+cURL+and+Python.+You+can+use+these+examples+to+fetch+data+from+the+API+and+integrate+i\u0026amp;theme=999050368802f5d9cfbe8395\u0026amp;signature=9fdfa584e3c828dd64fc96811c298b41a83e37537555094f44638b463ea62fcb\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Query the Graph API using cURL or Python - Athina\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"We have provided examples of how to query the Athina AI GraphQL API using cURL and Python. You can use these examples to fetch data from the API and integrate it into your applications.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://athinaai.mintlify.app/_mintlify/api/og/v2?division=GraphQL+API\u0026amp;title=Query+the+Graph+API+using+cURL+or+Python\u0026amp;description=We+have+provided+examples+of+how+to+query+the+Athina+AI+GraphQL+API+using+cURL+and+Python.+You+can+use+these+examples+to+fetch+data+from+the+API+and+integrate+i\u0026amp;theme=999050368802f5d9cfbe8395\u0026amp;signature=9fdfa584e3c828dd64fc96811c298b41a83e37537555094f44638b463ea62fcb\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"https://mintlify.s3.us-west-1.amazonaws.com/athinaai/_generated/favicon/browserconfig.xml?v=3\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Athina\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#1976D2\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.athina.ai/api-reference/graphql-api/curl-python-examples\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/graphql-api/curl-python-examples.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.athina.ai/#organization\",\"name\":\"Athina\",\"url\":\"https://docs.athina.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintlify.s3.us-west-1.amazonaws.com/athinaai/logo/light.svg\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.athina.ai#website\",\"name\":\"Athina\",\"url\":\"https://docs.athina.ai\",\"publisher\":{\"@id\":\"https://docs.athina.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.athina.ai/api-reference/graphql-api/curl-python-examples#webpage\",\"url\":\"https://docs.athina.ai/api-reference/graphql-api/curl-python-examples\",\"name\":\"Query the Graph API using cURL or Python\",\"description\":\"We have provided examples of how to query the Athina AI GraphQL API using cURL and Python. You can use these examples to fetch data from the API and integrate it into your applications.\",\"isPartOf\":{\"@id\":\"https://docs.athina.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.athina.ai/api-reference/graphql-api/curl-python-examples#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.athina.ai/api-reference/graphql-api/curl-python-examples#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"GraphQL API\",\"item\":\"https://docs.athina.ai/api-reference/graphql-api/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Query the Graph API using cURL or Python\",\"item\":\"https://docs.athina.ai/api-reference/graphql-api/curl-python-examples\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.athina.ai/api-reference/graphql-api/curl-python-examples#article\",\"headline\":\"Query the Graph API using cURL or Python\",\"name\":\"Query the Graph API using cURL or Python\",\"description\":\"We have provided examples of how to query the Athina AI GraphQL API using cURL and Python. You can use these examples to fetch data from the API and integrate it into your applications.\",\"url\":\"https://docs.athina.ai/api-reference/graphql-api/curl-python-examples\",\"mainEntityOfPage\":{\"@id\":\"https://docs.athina.ai/api-reference/graphql-api/curl-python-examples#webpage\"},\"publisher\":{\"@id\":\"https://docs.athina.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.athina.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Athina\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Athina","nav":{"global":null,"anchors":[{"anchor":"Documentation","icon":"book-open","tabs":[{"tab":"Docs","pages":[{"title":"Docs","href":"/overview"}]},{"tab":"API / SDK Reference","groups":[{"group":"Logging","pages":[{"title":"Logging","sidebarTitle":"Overview","icon":"hand-wave","href":"/api-reference/logging/overview"},{"title":"Logging Attributes","sidebarTitle":"Logging Attributes","api":"POST https://log.athina.ai/api/v2/log/inference","href":"/api-reference/logging/logging-attributes"},{"group":"Logging LLM Inferences","icon":"code","pages":[{"title":"Log via API Request","api":"POST https://log.athina.ai/api/v2/log/inference","href":"/api-reference/logging/log-via-api-request"},{"title":"Log via Python SDK","icon":"code","href":"/api-reference/logging/log-via-python-sdk"},{"title":"Log via TypeScript SDK","icon":"code","href":"/api-reference/logging/log-via-typescript-sdk"},{"title":"Langchain","icon":"code","href":"/api-reference/logging/langchain"},{"title":"🚅 LiteLLM","sidebarTitle":"LiteLLM","icon":"code","href":"/api-reference/logging/lite-llm"},{"title":"OpenAI Chat Completion","sidebarTitle":"OpenAI Chat (1.x)","icon":"code","href":"/api-reference/logging/openai-chat-1x"},{"title":"OpenAI Chat Completion","sidebarTitle":"OpenAI Chat (0.x)","icon":"code","href":"/api-reference/logging/openai-chat-0x"},{"title":"OpenAI Assistant","icon":"code","href":"/api-reference/logging/openai-assistant"},{"title":"Tracing","icon":"code","href":"/api-reference/logging/tracing"},{"title":"Tracing via API","icon":"code","href":"/api-reference/logging/tracing-via-api"},{"title":"Tracing using Python decorators","icon":"code","href":"/api-reference/logging/tracing-using-python-decorators"},{"title":"Tracing for Langchain (Python)","sidebarTitle":"Tracing for Langchain","icon":"code","href":"/api-reference/logging/tracing-for-langchain"},{"title":"Supported Models","icon":"cube","href":"/api-reference/logging/supported-models"}]},{"group":"Updating Logs","icon":"pencil","pages":[{"title":"Update Logs By ID","icon":"code","href":"/api-reference/logging/updates/update-logs-by-id"},{"title":"Update Logs By External Reference ID","icon":"code","href":"/api-reference/logging/updates/update-logs-by-external-reference-id"}]}]},{"group":"Datasets","pages":[{"title":"List All Datasets","icon":"code","href":"/api-reference/datasets/list"},{"title":"Create a Dataset","icon":"code","href":"/api-reference/datasets/create-dataset"},{"title":"Add Rows to Dataset","icon":"code","href":"/api-reference/datasets/add-rows-to-dataset"},{"title":"Get Dataset","icon":"code","href":"/api-reference/datasets/get-dataset"},{"title":"Delete Dataset","icon":"code","href":"/api-reference/datasets/delete-dataset"},{"title":"Update Cells in a Dataset","icon":"code","href":"/api-reference/datasets/update-cell-via-api"}]},{"group":"Evals","pages":[{"group":"Running Evals via SDK","icon":"bolt-lightning","pages":[{"title":"Running Evals","sidebarTitle":"Python: Run a single eval","icon":"code","href":"/api-reference/evals/running-evals/run-single-eval"},{"title":"Running a suite of evals","sidebarTitle":"Python: Run evals on a dataset","icon":"code","href":"/api-reference/evals/running-evals/run-eval-suite"}]},{"group":"Loading Data for Evals","icon":"file-import","pages":[{"title":"Loading data for Evals","icon":"code","href":"/api-reference/evals/loading-data/loading-data-for-eval"},{"title":"Loading data via Llama-Index","icon":"code","href":"/api-reference/evals/loading-data/loading-data-via-llama-index"}]},{"group":"Preset Evals","icon":"grid","pages":[{"title":"Preset Evals","sidebarTitle":"Overview","icon":"grid","href":"/api-reference/evals/preset-evals/overview"},{"group":"RAG Evals","icon":"files","pages":[{"title":"Context Sufficiency","icon":"code","href":"/api-reference/evals/preset-evals/rag/context-sufficiency"},{"title":"Response Faithfulness","icon":"code","href":"/api-reference/evals/preset-evals/rag/response-faithfulness"},{"title":"Answer Completeness","icon":"code","href":"/api-reference/evals/preset-evals/rag/answer-completeness"},{"title":"Groundedness","icon":"code","href":"/api-reference/evals/preset-evals/rag/groundedness"},{"title":"RAGAS","icon":"ruler-triangle","href":"/api-reference/evals/preset-evals/rag/ragas"}]},{"group":"Safety","icon":"shield","pages":[{"title":"PII Detection","icon":"shield","href":"/api-reference/evals/preset-evals/safety/pii-detection"},{"title":"Prompt Injection","icon":"shield","href":"/api-reference/evals/preset-evals/safety/prompt-injection"},{"title":"OpenAI Content Moderation","icon":"shield","href":"/api-reference/evals/preset-evals/safety/open-ai-content-moderation"},{"title":"Guardrails","icon":"shield","href":"/api-reference/evals/preset-evals/guardrails"}]},{"title":"JSON Evals","icon":"brackets-curly","href":"/api-reference/evals/preset-evals/json-evals"},{"title":"Summarization QA","icon":"code","href":"/api-reference/evals/preset-evals/summarization-qa"},{"sidebarTitle":"Function Evals","title":"Function Based Evaluators","icon":"code","href":"/api-reference/evals/preset-evals/function-evals"},{"title":"Grounded Evals","href":"/api-reference/evals/preset-evals/grounded-evals"},{"title":"Conversation Evals","sidebarTitle":"Conversation Evaluators","href":"/api-reference/evals/preset-evals/conversation-evals"}]},{"group":"Custom Evals","pages":[{"title":"API Call","href":"/api-reference/evals/custom-evals/api-call"},{"sidebarTitle":"LLM-as-a-Judge (Custom Prompt Eval)","title":"LLM-as-a-Judge (Custom Prompt Eval)","href":"/api-reference/evals/custom-evals/custom-prompt"},{"title":"Pairwise Evaluation","href":"/api-reference/evals/custom-evals/pairwise-evaluation"},{"sidebarTitle":"Custom Code Eval","title":"Evaluation with Custom Python Code","href":"/api-reference/evals/custom-evals/custom-code-eval"},{"title":"Custom Grading Criteria","href":"/api-reference/evals/custom-evals/grading-criteria"},{"title":"Write your own LLM Eval class","sidebarTitle":"Create Your Own Eval","href":"/api-reference/evals/custom-evals/create-your-own-eval"}]}]},{"group":"GraphQL API","pages":[{"title":"Overview","icon":"hand-wave","href":"/api-reference/graphql-api/overview"},{"title":"Getting Started","icon":"rocket","href":"/api-reference/graphql-api/getting-started"},{"title":"Sample GraphQL Queries","icon":"code","description":null,"href":"/api-reference/graphql-api/sample-queries"},{"title":"Query the Graph API using cURL or Python","sidebarTitle":"Curl and Python Examples","href":"/api-reference/graphql-api/curl-python-examples"}]},{"group":"Deprecated","pages":[{"title":"OpenAI Completions","sidebarTitle":"OpenAI Completion 0.x","description":"_If you're using OpenAI completions in Python, you can get set up in just **2 minutes**_","href":"/api-reference/logging/misc/openai-completion-0x"},{"title":"OpenAI Completions","sidebarTitle":"OpenAI Completion 1.x","href":"/api-reference/logging/misc/openai-completion-1x"}]}]},{"tab":"Guides","pages":[{"title":"Guides","href":"/guides/overview"}]},{"tab":"FAQs","pages":[{"title":"FAQs","href":"/faqs/data-policy"}]}]},{"anchor":"Open-Source Evals","href":"https://github.com/athina-ai/athina-evals","icon":"github"},{"anchor":"Blog","href":"https://blog.athina.ai/","icon":"book"},{"anchor":"Email us","href":"mailto:hello@athina.ai","icon":"envelope"},{"anchor":"Book a call","href":"https://cal.com/shiv-athina/30min","icon":"calendar"}]},"basePath":"","title":"Query the Graph API using cURL or Python - Athina","buildId":"dpl_36EDyZCDfRuoUD9af5CH4M1bqY2h","deploymentId":"dpl_36EDyZCDfRuoUD9af5CH4M1bqY2h","dynamics":[],"chunks":[]}