Skip to content

Authentication

Davide Santangelo edited this page Jan 15, 2024 · 10 revisions

Many operations require authentication or return additional information if you are authenticated. Additionally, you can make more requests per hour when you are authenticated.

SearQ API uses OAuth 2.0 token for user authorization and API authentication. Applications must be authorized and authenticated before they can fetch data.

Create

curl -X POST https://<URL>/api/tokens
{
  "data": {
    "id": "88253d48-f3d4-4af9-9c02-712e8bcdd185",
    "type": "token",
    "attributes": {
      "key": "fs7CBy2gf2Qjb33Jw8cPKxWMh9ikRV6itta6",
      "expires_at": 1678294059
    }
  }
}

Refresh

curl -X POST -H "Authorization: Token fs7CBy2gf2Qjb33Jw8cPKxWMh9ikRV6itta6" https://<URL>/api/tokens/refresh
{
  "data": {
    "id": "8ec9e342-44e6-4295-bdd4-49800bf8ce59",
    "type": "token",
    "attributes": {
      "key": "x6qRxmHn7GQ8UNQNYrzjGL42AetttcGrfLo5",
      "expires_at": 1678309829
    }
  }
}
Clone this wiki locally