Skip to main content

Quickstart

Make your first Partner API call in a few minutes, against sandbox data.

1. Get sandbox credentials

Sign up for the sandbox with your organisation's name, partner type and email. There is no review. You get a client_id and client_secret straight away.

The secret is shown once on the page, and we email you a copy.

2. Get an access token

Exchange your credentials for a bearer token. It lasts 60 minutes.

cURL
curl -X POST https://api.dawatrack.com/partner-api/v1/oauth/token/ \
  -H "Content-Type: application/json" \
  -d '{"client_id": "dtpk_...", "client_secret": "..."}'
Response
{
  "access_token": "AbC123...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "scope": "products:read batches:read ...",
  "environment": "SANDBOX"
}

3. Make your first call

List the deliveries you can see. A manufacturer sandbox comes with a demo delivery: batch SANDBOX-BATCH-001 of the demo product (GTIN 00000000000017) to DawaTrack Sandbox Pharmacy.

cURL
curl https://api.dawatrack.com/partner-api/v1/batches/ \
  -H "Authorization: Bearer $DAWATRACK_TOKEN"
Python
import requests

API = "https://api.dawatrack.com/partner-api/v1"

token = requests.post(
    f"{API}/oauth/token/",
    json={"client_id": "dtpk_...", "client_secret": "..."},
).json()["access_token"]

response = requests.get(f"{API}/batches/", headers={"Authorization": f"Bearer {token}"})
response.raise_for_status()
print(response.json())
Node.js
const API = "https://api.dawatrack.com/partner-api/v1";

const { access_token } = await (await fetch(`${API}/oauth/token/`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ client_id: "dtpk_...", client_secret: "..." }),
})).json();

const response = await fetch(`${API}/batches/`, {
  headers: { Authorization: `Bearer ${access_token}` },
});
console.log(await response.json());

The response is a page of results, as described in Pagination.

4. Write something

Every write needs an Idempotency-Key header, so a retried request never runs twice. In the sandbox you can record events for the demo product, run a recall drill and register webhooks.

cURL
curl -X POST https://api.dawatrack.com/partner-api/v1/events/ \
  -H "Authorization: Bearer $DAWATRACK_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"event_type": "SHIP", "gtin": "00000000000017", "batch_number": "SANDBOX-BATCH-001", "quantity": 100}'

Next steps

Partner API v1. The API reference is generated from the API's own code.