Get an access token
Plytix PIM API relies on Bearer authentication to check a user's credentials, so a token must be provided in the header of requests in order to use this API.
Credentials can be issued by any of your Plytix account administrators, under the "API" tab of the account's admin section.
Then a POST request must be made to https://auth.plytix.com/auth/api/get-token using the following format:
| Field | Description | Mandatory | Type |
|---|---|---|---|
| api_key | API key | YES | string |
| api_password | API password | YES | string |
Upon a successful result, you can find your token in the data array. Then you must include it in the header section of every request
| CODE | |
|---|---|
| 200 OK | The request has succeeded. A valid token can be found in response body |
| 400 BAD REQUEST | There was an error in the request, please check body request and try again |
| 401 UNAUTHORIZED | Bad user name or password. If the problem persists contact help@plytix.com |
Authorization: Bearer {{your_token_value}}Please note that capitalization of Bearer must be respected and there is a space between your token and the literal Bearer
Request and response example
Send a POST request to /auth/api/get-token with a Content-Type: application/json header and this body:
{ "api_key": "my_api_key", "api_password": "my secret password"}A successful request returns 200 OK with the token in the data array:
{ "data": [ { "access_token": "token data" } ]}Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
curl -X POST 'https://example.com/auth/api/get-token' \ -H 'Content-Type: application/json' \ --data-raw '{ "api_key": "your.api.key", "api_password": "your.secret.api.password"}'{ "data": [ { "access_token": "your access token. It expires after 15 minutes and a fresh one must be obtained. Note that 'Bearer 'literal (mind the space character after the word Bearer) IS NOT in your token and must be added by your application" } ]}