> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://documentation.sayari.com/api/key-concepts/authentication/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://documentation.sayari.com/_mcp/server. # Authentication ## Overview The Sayari API uses OAuth 2.0 client credentials flow with JWT access tokens for authentication. ## Getting an Access Token Use your client credentials to obtain a bearer token via the [authentication endpoint](/api/api-reference/auth/get-token): **`Token Request`** ```bash title="Token Request" curl --request POST \ --url https://api.sayari.com/oauth/token \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --data '{ "client_id": "$CLIENT_ID", "client_secret": "$CLIENT_SECRET", "audience": "sayari.com", "grant_type": "client_credentials" }' ``` **`Token Response`** ```json title="Token Response" {1-3} { "access_token": "YOUR_ACCESS_TOKEN", "expires_in": 86400, "token_type": "Bearer" } ``` ## Using Your Token Include the access token in the `Authorization` header for all API requests: **`Authenticated Request`** ```bash title="Authenticated Request" curl 'https://api.sayari.com/search/entity?q=china' \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ## Token Management * **Lifetime**: Tokens expire after 24 hours * **Storage**: Store tokens securely; never expose in client-side code > Access the Sayari API using JWT bearer tokens