Quickstart
With this guide you make your first Oscar API v2 call to the test environment (sandbox) in about 10 minutes. The examples fetch sales orders from the Sales API.
What you need
Client IDandClient Secretx-api-key- the token endpoint address
How to get credentials: Getting access. The test environment address is https://testapi.oscar.fi.
The examples use curl and jq. First set your credentials as environment variables:
export OAUTH_TOKEN_ENDPOINT="<token-endpoint>"
export CLIENT_ID="<client-id>"
export CLIENT_SECRET="<client-secret>"
export API_KEY="<x-api-key>"
1. Get an access token
ACCESS_TOKEN=$(curl -s -X POST "$OAUTH_TOKEN_ENDPOINT" \
-u "$CLIENT_ID:$CLIENT_SECRET" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" | jq -r .access_token)
The token is valid for one hour. Use the same token for all calls in this guide. More: Authentication.
2. Get changed sales orders
The change query returns the sales orders created, changed or deleted in a time window. changedFrom is required; set it to a date a week ago.
curl -s -X POST "https://testapi.oscar.fi/sales/sales-orders/changes/query" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "x-api-key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"changedFrom": "2026-11-01T00:00:00Z",
"pageSize": 5
}'
The response looks like this:
{
"data": [
{
"id": 48211,
"code": "10045",
"changeType": "CREATED",
"changedAt": "2026-11-02T08:14:03Z"
}
],
"nextContinueAfterId": 48211
}
The rows are in the data array, one row per changed order. When the response has nextContinueAfterId, more rows follow: repeat the call with the same window and add "continueAfterId" with that value to the body.
3. Get one sales order
Pick one code from the previous response and fetch the whole order with its rows:
curl -s "https://testapi.oscar.fi/sales/sales-orders/code/10045" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "x-api-key: $API_KEY"
The response looks like this (shortened):
{
"data": {
"id": 48211,
"code": "10045",
"status": "CONFIRMED",
"customerCode": "C1001",
"orderingCustomerName": "Example Ltd",
"totalAmountVatExcluded": 1840.0,
"rows": [
{ "rowNumber": 1, "orderedQuantity": 4.0, "status": "CONFIRMED" }
]
}
}
You can also fetch the same order by id: GET /sales/sales-orders/48211. A deleted order no longer exists, so fetching it returns 404.
Try it with Postman
The same calls are ready in a Postman collection: Download the Oscar API v2 collection
- Import the file into Postman (Import).
- Set the collection variables
oauthTokenEndpoint,clientId,clientSecretandapiKey. - Open the collection's Authorization tab and select Get New Access Token.
- Run the calls in order. The change query fetches the last week's changes and saves the code and id of the first order in the variables
salesOrderCodeandsalesOrderId, which the next calls use.
Next steps
- Responses and paging: fetching large result sets page by page
- Errors and Limits
- API Catalog: all v2 resources and their fields
