REST API
Documentation
- Nederlands
- English
Authentication
Print API is secured with OAuth 2.0. This means your app must identify itself before it can communicate with the API. This is called authentication. On this page, we'll walk through the authentication process.
TIP: Keep your API keys at hand. These are found on your dashboard.
Example
Print API utilizes the client credentials OAuth 2.0 flow. This authentication process consists of the following two steps:
- Use your API keys to request a temporary access token
- Include the access token in all subsequent API calls
The HTTP request needed for step 1 is shown below. Replace the CLIENT_ID and SECRET in the request body with your API keys.
POST /v2/oauth HTTP/1.1
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials&client_id=CLIENT_ID&client_secret=SECRET
If your request is valid, the API response will include an access token. The response also specifies the number of seconds until this access token expires. By default, access tokens remain valid for 4 hours, which should be sufficient for uploading large files to the API.
Response:HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
"scope": "orders:place orders:track shipping:quote",
"access_token": "TOKEN",
"token_type": "bearer",
"expires_in": 14399
}
The value of the field access_token
must be included in the Authorization HTTP header
of all API-calls, specifically as follows. Replace TOKEN with the access token.
GET /v1/orders?limit=5 HTTP/1.1
Authorization: Bearer TOKEN
Accept: application/json