# License API

Your application calls the License API from the device of your customer. The API claims, validates, releases and checks out licenses. It also counts the concurrent runs of your application.

## Base URL

```text
https://license.seatify.dev
```

## Versioning

Every path starts with `/v1`, such as `https://license.seatify.dev/v1/licenses/claim`.

## Authentication

Every request sends a publishable key in the `Seatify-Publishable-Key` header. See [Authentication](authentication/).

## Requests

A request body is JSON. Send the header `Content-Type: application/json` with every body. Without this header, the License API ignores the body, and the answer is a 400 error.

The license key is always in the body. It is never in the URL.

## Licensing results

A licensing result has the status 200, also when the license is not valid. For example, an expired license and an unknown license key both answer with the status 200. The body says what happened. Each endpoint page lists the fields and the reasons.

A status other than 200 means that the request itself is wrong.

## Errors

An error answer has this body:

```json
{
  "message": "The submitted details are not valid.",
  "errors": {
    "key": "A license key is required."
  }
}
```

| Field | Type | Description |
| --- | --- | --- |
| `message` | string | A sentence that describes the error. |
| `errors` | object | The fields of the request that are not valid. Each key is the name of a field, and each value is a message. A field of a nested object has a path, such as `device.fingerprint`. The body has no `errors` field when no field is wrong. |

Every endpoint can answer with these statuses:

| Status | Description |
| --- | --- |
| 400 | The request is wrong. The body cannot be read, a field is not valid, the nonce is too long, or the signing key is not known. |
| 401 | The publishable key is missing or not valid. See [Authentication](authentication/). |
| 429 | Your application sent too many requests. See [Rate limits](#rate-limits). |
| 500 | An error happened in Seatify. Try again later. |

## Rate limits

The License API limits the requests from one client address. It also limits the requests with one publishable key. Requests with a key that is not valid count too.

When your application sends too many requests, the answer has the status 429 and this body:

```json
{
  "message": "There are too many requests. Try again later."
}
```

The `Retry-After` header gives the number of seconds to wait.

## Signed responses

Every answer with the status 200 is signed. An answer with any other status is not signed. That includes a 400, a 401 and a 429. Your application can send two headers with a request:

| Header | Required | Description |
| --- | --- | --- |
| `Seatify-Nonce` | No | A new random value. The signature includes it, so a recorded answer does not match a new request. |
| `Seatify-Signing-Key` | No | The key ID of the signing key in your application. Without it, Seatify signs with the active key. |

The answer carries the signature in the `Date`, `Digest` and `Seatify-Signature` headers. See [Verify signed responses](../guides/signatures/verify-signed-responses/).

