Skip to main content
Skip table of contents

CreateApiToken. Authorizаtion

Creating an OAuth token for accessing the Web API. Each API method, except for this method, must contain an authorization token for the request, either in the token parameter or in the Authorization request header.

This method can only be called from the server where the media server is installed. The hostname in the request URL should always be localhost or the IP address of the local network interface.

POST /api/auth/token/api/
Body
json
JSON
{
    "client": "client-unique-id",
    "duration": 3600
}
clientrequired
string
The application identifier for which the token will be created.
durationrequired
int
The duration of the token in seconds. 0 - the token's lifespan is not limited.
Response
200
Returns a JSON string with the API access token.
JSON
"5pNZXnaNf3w_x6I6AkeeXYXPejw8u47erHTwSNVOejgEjJp4~"
403
Authorization error. Invalid or missing API access token. See Mediaserver/Web API/Authorization/CreateApiToken.
Example
JSON
curl -k --location --request POST 'https://localhost:8080/api/auth/token/api/' \
--header 'Content-Type: application/json \
--data-raw '{
    "client": "client-unique-id",
    "duration": 3600
}'
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.