Getting started with the Hybrid API
Authorization
The Bearer token authorization protocol is used for authentication and authorization in the API.
A client is created for the user with the client_id and client_secret parameters, using which he receives an access token for authentication in the API.
You can get clientid and clientSecret by leaving us a request by mail support@hybrid.ai.
When grant_type=client_credentials, the method creates a new access token based on the client_id, client_secret pair.
Request
POST /token HTTP/2
Host: https://capi.hybrid.ai
Content-Type: application/x-www-form-urlencoded
- grant_type=client_credentials&client_id={client_id}&client_secret={client_secret}
If grant_type=refresh_token the method creates a new access token instead of the old one, which is identified by the passed refresh_token parameter.
Response example
HTTP/2 200 OK
Content-Type: application/json; charset=UTF-8
{
"access_token": "{access_token}",
"token_type": "bearer",
"scope": "{scope}",
"expires_in": "86400",
"refresh_token": "{refresh_token}"
}
Access token expiration
Each received access token is valid for 24 hours. This is indicated by the expires_in property in the response to an access token request. Refresh_token is also indicated there - a special token for obtaining a new access token.
Request
POST /token HTTP/2
Host: https://capi.hybrid.ai
Content-Type: application/x-www-form-urlencoded
grant_type=refresh_token&refresh_token={refresh_token}&client_id={client_id}&client_secret={client_secret}
Response example
{
"access_token": "{new_access_token}",
"token_type": "bearer",
"expires_in": "86400",
"refresh_token": "{refresh_token}"
}