Authentication

url = '[base]/token/'

Obtain token

Request

POST [base]/token/

Name Type Required Description
client_id string Yes Your API key.
client_secret string Yes Your API secret.

Request example

curl --location '{base_url}/token/' \
--header 'Content-Type: application/vnd.api+json' \
--data '{
  "data": {
    "type": "auth-token",
    "attributes": {
      "client_id": "<Your API key>",
      "client_secret": "<Your API secret>"
    }
  }
}'
import requests

url = '[base]/token/'

headers = {
  'content-type': 'application/vnd.api+json',
}

data = {
  'data': {
    'type': 'auth-token',
    'attributes': {
      'client_id': '<Your API key>',
      'client_secret': '<Your API secret>',
    }
  }
}

requests.post(url, headers=headers, json=data)
<?php

use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;

$client = new GuzzleHttp\Client();
try {
  $res = $client->post('[base]/token/', [
    'json' => [
      'data' => [
        'type' => 'auth-token',
        'attributes' => [
          'client_id' => '<Your API key>',
          'client_secret' => '<Your API secret>',
        ],
      ],
    ],
    'headers' => [
      'Content-Type' => 'application/vnd.api+json',
    ],
  ]);
echo $res->getBody();
} catch (RequestException $e) {}

Response

Name Type Description
access string Your access token. It has an expiry time and after expiration should be refreshed by resending the request.
expires_in number The lifetime of the token, in seconds.
token_type string Always `"Bearer"`.

Response example

{
  "data": {
    "type": "auth-token",
    "id": "0",
    "attributes": {
      "access": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjMy...",
      "expires_in": 3599,
      "token_type": "Bearer"
    }
  }
}

Response codes

HTTP code Description Suggested action
200 OK
400 No active account found with the given credentials Resend the request with the correct credentials.
429 Too many requests Try again later.
4xx Incorrect request Resend the request with the correct parameters.
5хх Server error Try again later.

Zuletzt aktualisiert am

Auf dieser Seite