Authentication
Every request needs an API key in the Authorization header:
Authorization: Bearer ux_live_…
Live keys start ux_live_ and test keys start ux_test_, followed by 32 letters and digits. Send the whole key. Problems with the key return 401:
| Code | Why |
|---|---|
missing_api_key | No Authorization header was sent. |
invalid_api_key | The key isn't in the right format, or we don't recognise it. |
revoked_api_key | The key was revoked in the portal. |
expired_api_key | The key was rolled more than 24 hours ago. Use the new one. |
Anyone who has your key can spend your quota. Call Uxie from your own server and keep the key out of browsers, mobile apps and source control.
Access levels
Each key has an access level, set when you create it. Calling an endpoint outside it returns 403 with the code endpoint_not_allowed.
| Access | Endpoints |
|---|---|
| All endpoints | /v1/sets/v1/sets/{code}/products/v1/products/{id}/v1/products/{id}/sales/v1/products/{id}/history/v1/search |
| Read only | /v1/sets/v1/sets/{code}/products/v1/products/{id}/v1/products/{id}/sales/v1/products/{id}/history/v1/search |
| Products and sales | /v1/sets/{code}/products/v1/products/{id}/v1/products/{id}/sales/v1/products/{id}/history |
IP restrictions
A key can also be limited to a list of IP addresses or CIDR ranges, such as 185.42.10.0/24. Requests from anywhere else get 403 with the code ip_not_allowed. Leave the list empty to allow any IP.
Rolling and revoking
Rolling a key gives you a new secret with the same settings. The old one keeps working for 24 hours so you can swap it in without downtime. Revoking a key stops it straight away.