Authentication

Access the Sayari API using JWT bearer tokens

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:

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
1{
2 "access_token": "YOUR_ACCESS_TOKEN",
3 "expires_in": 86400,
4 "token_type": "Bearer"
5}

Using Your Token

Include the access token in the Authorization header for all API requests:

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