---
url: https://docs.sunlicense.com/api/overview.md
---
# API overview

| | |
|---|---|
| Base URL | `https://api.sunlicense.com` |
| Format | JSON over HTTPS |
| Versioning | In the path (`/api/v1/…`); `/api/v2/license/validate` is the SDK endpoint |

## Authentication

There are three kinds of credentials, for different jobs:

| Credential | Where you get it | Works on |
|---|---|---|
| **API key** (`slk_…`) | Dashboard → API keys | [Validation API](/api/validation) only. Safe to ship inside your app: it cannot read or change licenses |
| **Session token** (JWT) | `POST /api/v1/auth/login` | [Management API](/api/management), with the permissions of your [role](/guide/team-and-roles). Lasts 12 hours |
| **Personal access token** (`slp_…`) | Dashboard → Settings → Personal access tokens | [Management API](/api/management), acting as you but only with the scopes you gave it. Lasts until it expires (7 days to a year, or never) or you revoke it. For scripts, CI and AI assistants |
| **Guest token** (`slp_…`) | `POST /api/v1/auth/guest`, no account needed ([guest accounts](/guide/guest-accounts)) | A personal access token of a new organization's Owner with every permission, for coding agents. Keeps working after the organization is claimed |

Send any of them as `Authorization: Bearer <token>`.

### Personal access tokens

A personal access token acts as the member who created it, limited to its **scopes** (the same
[permissions](/guide/team-and-roles) roles are made of). A route works only if both your current
role and the token allow it, so demoting or disabling a member limits or stops their tokens too.

* A token missing a route's scope gets `403` with `code: "missing_scope"`.
* Tokens can't manage tokens, change your password, link Discord or reach the admin console; those
  answer `403` with `code: "access_token_not_allowed"`. Sign in for them.
* A revoked token stops working within 30 seconds. Unknown, expired and revoked tokens get `401`.
* We store only a hash: the token is shown once, when you create it. Keep it out of code and screenshots.
* A [guest account](/guide/guest-accounts)'s token may also ask for its claim link and dashboard sign-in link;
  until the account is claimed, anything outbound or hosted answers `403` with `code: "guest_unclaimed"`.

## Errors

Errors use [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457) problem details:

```json
{ "type": "about:blank", "title": "Forbidden", "status": 403, "detail": "Your Free plan allows 1 products. Upgrade to add more." }
```

| Status | Meaning |
|---|---|
| 400 | Invalid request (on `/api/v2/license/validate`: license rejected) |
| 401 | Missing, invalid or expired credentials |
| 403 | Your role lacks the permission, or your plan does not include it |
| 404 | Not found (also for resources that belong to another organization) |
| 409 | Conflict, for example reinstating a revoked license |
| 429 | Rate limited: 20 requests/second, bursts of 40, per API key on the license routes and per IP address everywhere else (and for API keys that don't exist) |
| 503 | Temporarily unavailable; use the offline license |

## Health

`GET /api/v1/system/health` (no authentication) returns each component's status. The public status page is [status.sunlicense.com](https://status.sunlicense.com).

`GET /api/v1/system/status` (no authentication) returns what the status page reports: an overall `state` (`operational`, `degraded`, `outage` or `unknown`) and, per group, each service's `status` (`up`, `down`, `pending`, `maintenance`), 24-hour uptime (`uptime24h`, a fraction) and last check. It is read from the status page and cached for a minute; `stale: true` means the status page couldn't be reached and this is its last answer.
