About
user_api_hash. Older Sawa documents mention auser_api_hashtoken. It is how the Sawa web portals and mobile app sign in. It is equivalent to your account password, it cannot be scoped or rotated on its own, and it is not for integrations. Integrations use an API key in theAuthorization: Bearerheader, described below. If an integrator asks you for youruser_api_hash, give them an API key instead.
Status: specified, not yet live. Nothing in this section can be called today. It is published here so an integration being designed now is designed against the credential it will actually hold. Everything in sections 1 to 14 is live and verified; this section is the only forward looking one, and it is marked on every heading that is not yet callable.
15.1 Why a second credential
The Sawa portals and the mobile app sign in with a portal token. It is minted from the account password, there is exactly one per account, it grants everything the account can do including writes, it cannot be rotated without signing out the whole team, and it cannot be told apart from portal traffic.
None of that is a defect for its job. All of it makes it unusable as an integration credential, so integrations get their own.
| Credential | Sent as | Who uses it | Metered | Billed |
|---|---|---|---|---|
| Portal token | the Sawa sign-in | Sawa portals, Sawa mobile app | no | no |
| API key | Authorization: Bearer sk_live_… |
your integration | yes | yes |
An account may hold several keys at once. They are independent: separate scopes, separate rate limits, separate revocation. Revoking one does not touch the others and does not affect anyone's portal session.
15.2 Getting a key
Keys are not self service, because each one carries a billing relationship.
- Request access from Fleet Command, under Account, or from the public request form. State what you are building, the endpoints you need, and your expected monthly call volume. The volume is not a commitment, it is how the right allowance gets set.
- Sawa approves the request and sets the scopes, the rate limit and the monthly free allowance.
- You create the key yourself, in Fleet Command. Only the account holder can do this, and only after approval.
Only the account named as the client's manager may hold a key. A sub user cannot, by design: a key acts as the whole company, so it belongs to the account that is accountable for the company.
15.3 The secret, and the one time you see it
sk_live_a7f3_9Kd2mX4pQ8vR1nZ6wT0yB3cL7sH2jF5q
└──┬──┘ └┬─┘ └──────────────┬───────────────┘
│ │ └ secret, 32 chars, shown once
│ └ prefix, public, identifies the key in logs and support calls
└ environment literal. There is no sandbox, so there is no sk_test
The secret is returned exactly once, at creation. Sawa stores only a SHA-256 hash of it. There is no endpoint that can show it again, not for you and not for Sawa support, so store it in your secret store at the moment it is shown.
If you lose it, revoke the key and create another. That is a 30 second operation and it is the supported recovery path.
Quote the prefix in any support conversation. It identifies the key without disclosing it, and it is what appears in your usage reports.
15.4 Sending it
curl -H 'Authorization: Bearer sk_live_a7f3_9Kd2mX…' \
'https://myfleet.sawatelematics.com/api/get_devices_latest'
The key never goes in a query string. Unlike the portal token, there is no parameter form, deliberately: query strings end up in access logs, browser history and proxy caches.
A key acts as its account. Every permission, company scope and vehicle visibility rule that applies to that account in the portal applies identically to the key. A key can never see another client's data. There is no separate API permission model to configure, and nothing to keep in step.
15.5 Scopes
A key is limited to classes of endpoint rather than individual routes:
read:vehicles read:positions read:events read:history
read:reports read:analytics read:drivers read:geofences
write:commands write:tasks write:geofences write:destructive
A key created without scopes gets every read:* class and no write:*.
That is the default, and it is the right one for most integrations: it cannot
change anything on the fleet.
Requesting a scope you do not need is the single most common review delay. Ask for what you will call.
Out of scope returns 403 with forbidden_scope. It is not a 401: your
credential is valid, it is just not permitted here.
A write scope is granted only with a named approver at Sawa. write:destructive
(deletes, and changes to vehicle assignment and status) is never implied by
another write scope: it must be asked for by name.
15.6 Rate limits
60 requests a minute per key by default, raisable on request.
429 Too Many Requests
Retry-After: 23
X-Sawa-RateLimit-Limit: 60
X-Sawa-RateLimit-Remaining: 0
X-Sawa-RateLimit-Reset: 1795431660
{"error": "rate_limited", "message": "Too many requests for this key."}
It is a courtesy limit protecting shared infrastructure, not a billing control.
A 429 is not metered and not billed. Back off on Retry-After rather than
retrying immediately, and prefer the incremental endpoints
(§5 v2/events/since) over re-polling whole
collections.
15.7 What a call costs
Billing is per call, in cost units, invoiced once a month to your Sawa account.
Units rather than a flat per-call price because the calls are not comparable. Measured on this platform, from §11:
| Call | Response size |
|---|---|
get_events (2 events) |
1.5 KB |
v2/events/since?minutes=60 |
7.2 KB |
get_devices_latest (917 vehicles) |
1.3 MB |
get_devices (same fleet, grouped) |
10.3 MB |
A single price either makes the cheap call uneconomic or gives the expensive one away. So each endpoint sits in a unit class, heavier queries cost more units, and every endpoint's class is listed in the route index.
| Class | Units | What is in it |
|---|---|---|
| A, lookup | 1 | One object or a small fixed list |
| B, list | 3 | A list: vehicles, events, live positions |
| C, heavy | 10 | History, reports, analytics, geofence occupancy, the full device tree |
| D, write | 3 | Anything that changes data, a command included |
| Outcome | Units billed |
|---|---|
2xx |
The route's class |
400, 404, 405, 409, 422 |
1, whatever the route |
401, 402, 403, 429 |
0. A refused call never costs |
5xx |
0. Our fault |
Every response carries what it cost:
X-Sawa-Units: 3
X-Sawa-Units-Remaining: 19380
Trust those headers over your own estimate. They are what the invoice is built from.
Your monthly free allowance is consumed first, before anything is billed. An integration inside its allowance is billed nothing, which is why there is no sandbox: a read only key with an allowance costs nothing and can change nothing, which is what a sandbox is for.
15.8 When calls stop
Two conditions return 402 Payment Required, with different codes so your logs tell you which:
| Code | Meaning | What clears it |
|---|---|---|
account_locked |
The account is locked for an unpaid subscription | Paying the overdue subscription invoice |
account_recovery |
The account is in recovery after a lock | Completing the recovery agreed with Sawa |
insufficient_wallet_balance |
The account balance has passed its agreed credit limit | A payment that brings the balance back within the limit |
API usage is billed once a month, on an API usage invoice beside your subscription, and paid from your Sawa account balance. A balance may go below zero; keys stop only when it passes the credit limit agreed with your account manager.
A suspended key returns 403 key_suspended; a revoked one returns 401
key_revoked.
15.9 Revocation
Revoke from Fleet Command. Revocation is immediate at the data layer and takes effect within 60 seconds at the edge, because key lookups are cached for that long. That is deliberately five times tighter than the 300 second portal token cache: a leaked key has to die faster than a password.
Revocation is final. A revoked key cannot be restored, and its prefix is never reissued, so your audit trail stays unambiguous.
15.10 What does not change
Worth stating plainly, because it is the reason this is additive and not a migration:
- Every endpoint in sections 4 to 9 works exactly as documented. The key changes who is calling and what it costs, not what comes back.
- The portal token keeps working, unchanged, unmetered and unbilled. If you are a Sawa portal or the Sawa mobile app, nothing here applies to you.
- The envelope, the
statusconvention in §10 and the date format traps in §3 are all unchanged. Read section 3 regardless of which credential you hold. It is still the section that saves the most time.
15.11 Error codes and response headers
These names are frozen: they will not be renamed. Message texts may change, so
branch on error, never on message. Every error answers
{"error": "<code>", "message": "<text>"}.
| HTTP | error |
Meaning | Units billed |
|---|---|---|---|
| 401 | missing_credential |
No key was sent | 0 |
| 401 | invalid_credential |
The key is not recognised | 0 |
| 401 | key_revoked |
The key was revoked, or the account's API access withdrawn | 0 |
| 402 | insufficient_wallet_balance |
The account balance has passed its credit limit | 0 |
| 402 | account_locked |
The subscription is unpaid. The body also carries billing, what to pay |
0 |
| 402 | account_recovery |
The account is in recovery. Same body as account_locked |
0 |
| 403 | key_suspended |
The key, or the account's API access, is suspended | 0 |
| 403 | forbidden_scope |
The key lacks the scope this route needs | 0 |
| 429 | rate_limited |
Over the key's calls per minute. Retry-After says when to retry |
0 |
Headers on every response to a key:
| Header | Value |
|---|---|
X-Sawa-Units |
Whole number: the units this call cost |
X-Sawa-Units-Remaining |
Whole number: free units your account has left this month, after this call, shared by all your keys |
X-Sawa-RateLimit-Limit |
The key's calls per minute |
X-Sawa-RateLimit-Remaining |
Calls left in this minute |
X-Sawa-RateLimit-Reset |
Unix time, in seconds, when the minute resets |
X-Sawa-Request-Id |
One id per call. Quote it to support |
Retry-After |
On 429 only: seconds to wait |