Authentication
The API supports several auth mechanisms depending on who is calling. Almost all product endpoints use a JWT bearer token bound to the user guard; integrations and webhooks use API keys or signed verification instead.
1 · JWT for the user guard
Authenticate against POST /api/user/login with an email and password. The response is a UserResource plus an access_token (a JWT), its token_expiry (unix timestamp) and a short-lived auth_code used by native apps to exchange for a session.
curl -X POST 'https://api.axis.im/api/user/login' \
-H 'Accept: application/json' -H 'Content-Type: application/json' \
-d '{"email":"[email protected]","password":"secret-password","remember":true}'{
"data": {
"id": 42,
"name": "Jane Doe",
"email": "[email protected]",
"workspaces_id": 7,
"roles": ["admin"]
},
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
"token_expiry": 1767225600,
"auth_code": "a1b2c3d4"
}Send the token on every authenticated request via the Authorization header:
curl 'https://api.axis.im/api/user/user' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access_token}'GET /api/user/userPOST /api/user/refreshPOST /api/user/logout2 · Auth-code exchange (native apps)
Social / native flows return a one-time auth_code. Native clients call POST /api/user/generate-code and POST /api/user/generate-token to exchange that code for a JWT without re-entering credentials. These routes run under the auth.optional:user middleware so they resolve an existing session when present.
3 · Other schemes
API key
Programmatic integration endpoints are guarded by ApiKeyMiddleware, which reads the key from the X-API-KEY request header. Issue and rotate keys from the API Keys endpoints.
Engage Admin key
Engage administrative endpoints accept the admin key via X-Axis-Admin-API-Key, falling back to X-API-KEY or a Bearer token. Validated against services.axis_admin.api_key.
Sanctum token
A small number of routes use Laravel Sanctum personal-access tokens (auth:sanctum) rather than the JWT guard.
Facebook signed webhook
Meta webhook callbacks are verified by VerifyFacebookToken using the signed payload — no user token is involved.
Testing endpoints live
Every endpoint in the reference has a Try it tab that sends a real request. Click Authorize in the top bar once, paste your token, and it applies to every endpoint for the rest of the browser session (it is held in sessionStorage and never persisted to disk).
- Call
POST /api/user/login— from its own Try-it tab — and copy theaccess_token. - Click Authorize, choose JWT Bearer, paste the token and save.
- Open any endpoint, switch to Try it, adjust the prefilled payload and send.
Optional authentication
Many endpoints run under auth.optional:user. They work anonymously (e.g. public widget or webhook traffic) but will resolve and act on the authenticated user when a valid Bearer token is present. These are labelled Optional JWT throughout the reference.