Plytix

Authentication

The Plytix API uses bearer token authentication. Rather than sending your API key and password with every call, you exchange them once for a short-lived access token, then include that token in the Authorization header of every subsequent request instead. Your account administrator issues the API key and password from the account's API tab, and the role assigned to that key determines what it can access.

This page documents that token exchange, and how to use the token you get back.

Get a bearer token

To get a token, send your API key and password as the request body. Both fields are required:

FieldTypeRequiredDescription
api_keystringYesThe API key generated from your account's API tab.
api_passwordstringYesThe API password generated alongside the key.

Here's the full request and the response you'll get back:

curl --request POST \
  --url https://auth.plytix.com/auth/api/get-token \
  --header 'Content-Type: application/json' \
  --data '{
    "api_key": "your.api.key",
    "api_password": "your.secret.api.password"
  }'

Use the returned token in the Authorization header of every subsequent request, with a space after Bearer:

Authorization: Bearer your_access_token

Tokens expire after 15 minutes. Once a token expires, requests using it return 401, and you need to request a new one.

Error responses

If the request fails, you'll get one of the following:

Status codeExample response
400 BAD REQUESTThe request body is malformed. Check the request and try again.
401 UNAUTHORIZED{"msg": "Bad api_key or api_password"}

On this page