Generate an API Token

Before configuring any settings, an access token is required to access the configuration endpoints. To obtain the token, you need to call the authentication endpoint using the API key and signature.

curl --location '{{BASE-URL}}/api/login' \
--header 'x-authentication-api-key: {{APIKEY}}' \
--header 'x-multitenant-external-id: {{EXTERNAL-ID}}' \
--header 'x-authentication-signature: {{SIGNATURE}}' \
--header 'Content-Type: application/json' \
--data '{
    "timestamp": {{ZONEDATETIME}} // Example: "2024-09-06T05:36:25.966Z"
}'

Params:

BASE-URL:


APIKEY:

Should be Back office provided by the Truvideo team.


EXTERNAL-ID:

Should be the external id for the subaccount. Configured by the Partner. Required for multitenant purpose.


SIGNATURE:

Signature generated using the secret key. Below is an example how they can generate it.


ZONEDATETIME:

The timestamp must be in format ISO 8601 and not be older than 30 minutes.

The response contains a token in the accessToken field that we will use then in the configuration requests.

{
    "accessToken": "eyJhbfIWOJnewIUzI1NiJ9.eWIiOiJhZG1pbiIsImV4cCI6MTcyMTEzNjc0MCwiYXV0aCI6IkFETUlOIEJBQ0tPRkZJQ0UiLCJpYXQiOjE3MjEwNTAzNDAsImRldmljZUlkIjoiLTEifQ.bosYs82RrGsqx6we_MFrcebIhh6d5hUMWaecbCiySDU",
    "refreshToken": "eyJhbfIWOJnewIUzI1NiJ9.eiOiJhZG1pbiIsImV4cCI6MTcyMTY1NTE0MCwiYXV0aCI6IkFETUlOIEJBQ0tPRkZJQ0UiLCJpYXQiOjE3MjEwNTAzNDAsImRldmljZUlkIjoiLTEifQ.77odDiZJ7CWjGHM7yNSRU4b8ycqzkPzPwUKXi0aEAOU"
}

How to generate the signature?

  1. Generate the body with this structure:

{
    "timestamp": "2024-09-06T05:36:25.966Z"
}
  1. Build the body to convert to a signature. We need to remove all the spaces (whitespaces, tabs, etc). Also respect the structure in which the data is sent like this:

{"timestamp":"2024-09-06T05:36:25.966Z"}
  1. Build the signature with the body and the secret key. This needs to be on Sha256 - Hex:

For generating signature you can refer - https://www.devglan.com/online-tools/hmac-sha256-online

Last updated