Authentication
Every request to Unwired Labs' APIs must be authenticated with a scoped access token. Keep tokens server-side and rotate them regularly.
Every request to Unwired Labs' APIs is authenticated with an access token: a key that identifies your account, so we can apply your plan's limits and count its usage. For the Geolocation API, send it as token in the JSON body:
curl --request POST --url https://us1.unwiredlabs.com/v2/process \
--header 'Content-Type: application/json' \
--data '{"token": "YOUR_ACCESS_TOKEN", "radio": "gsm", "mcc": 310, "mnc": 410,
"cells": [{"lac": 7033, "cid": 17811}]}'A missing or wrong token returns the Invalid token error; see Errors.
Get an Access Token
Your account starts with one token. Find it, and create more, under Access Tokens on the User Dashboard. Create a separate token for each application or server, labelled so you can tell them apart (e.g. "my server"). That way you can restrict or replace one without touching the others.
Call the APIs from your server rather than from a browser or mobile app: a token sent from public-facing code is visible to anyone inspecting the request and can be copied and reused. If a client needs the API, proxy the request through your own backend so the token is never exposed.
Access Token Scopes
Each access token has a type and a set of scopes (permissions), written as group:action - for example geolocation:locate. Choose them when you create or update a token on the User Dashboard. A token can only call operations that match its type and its selected scopes.
- API token (prefix
pk.) - calls product APIs. API tokens created before scopes were introduced are unscoped and keep access to all data APIs. - Account token (prefix
sk.) - manages account resources and cannot call data APIs. The full secret is shown only once, when the token is created.
API token scopes
Unwired Labs API tokens can be scoped for the following groups:
| Group | Scopes |
|---|---|
| Geolocation | geolocation:locate |
| Geocoding | geocoding:forward, geocoding:reverse, geocoding:autocomplete, geocoding:nearby, geocoding:lookup, geocoding:timezone |
| Maps | maps:tiles:vector, maps:tiles:raster, maps:static |
For example, a token for a branch finder page only needs Forward and Reverse Geocoding and Vector Map Tiles:
Account token scopes
Account tokens can be scoped for account resources:
| Group | Scopes |
|---|---|
| Overrides | overrides:read, overrides:write |
| Balance | balance:read |
| Token management | tokens:create, tokens:update, tokens:revoke (coming soon) |
| Reports | reports:read (coming soon) |
A scope can only reduce access. Your plan, product enablement and balance still apply. A token that does not carry the scope required by an endpoint is rejected with HTTP 403.
An unscoped API token keeps access to every data API available to the account, including APIs launched later. An explicitly scoped token must be updated before it can use a newly launched API.
IP Address Restrictions
You can limit an account token to the IPv4 addresses or subnets your servers call from. Leave the list empty to allow any IP. Add one address, or a subnet in CIDR notation such as 198.51.100.0/24, per line, up to 10 per token. Changes may take up to 10 minutes to take effect.
Security Best Practices
Secure your access tokens to avoid abuse of your account. We recommend:
- Use scopes for least privilege. Grant each token only the permissions it needs. See Access Token Scopes.
- Use a separate token for each application, and rotate tokens regularly. Rotate immediately if you notice usage you don't recognize, or when a token has been used in a public app.
- Store tokens safely. Treat account tokens like passwords: they manage account resources and their secret is shown only once. Keep tokens in a password manager or secrets vault, and never commit them to source control.
- Restrict account tokens to your servers' IPs. See IP Address Restrictions.
- Keep tokens server-side. Call the APIs from your backend, and proxy requests from browsers or mobile apps through it so the token is never exposed to end users.

