Authentication
Trivi API uses a bearer token based authentication. In order to use API resources, you must generate a authentication token.
Before you begin
- Go to my.trivi.com, click Settings, Trivi settings and expand the API section
- Click Add new application and enter a name of your application
- Copy App Id and App Secret codes (click on it)
Steps
1. Send a request to the authentication endpoint
POST https://api.trivi.com/auth/token
{
"appId": "your_app_id",
"appSecret": "your_app_secret"
}
2. You should get a following response
{
"access_token": "your_access_token",
"expires_in": 3600,
"token_type": "Bearer",
"refresh_token": "your_refresh_token"
}
3. All subsequent requests have to send Authorization header. See the minimum example request:
GET /v2/accountingdocuments HTTP/1.1
Host: my.trivi.com
Authorization: Bearer your_access_token