# Distribution API

Your application and your download pages call the Distribution API. The API lists the releases of a product, serves downloads and answers update checks. The API is read-only. Publish your releases in the dashboard.

## Base URL

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

## Versioning

Every path starts with `/v1`, such as `https://dist.seatify.dev/v1/products/{product}/releases`.

## Authentication

Every path names the product. A `licensed` product requires a license key in the `Seatify-License-Key` header. An `open` product does not require a key. See [Authentication](authentication/).

## Requests

Every endpoint answers a `GET` request. A request has no body. The parameters are in the query string.

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

## Licensing results

[List releases](list-releases/), [Get a release](get-a-release/) and [Check for an update](check-for-an-update/) answer with the status 200, also when the license is refused. The body has a `valid` field and a `reason` field. Each endpoint page lists the reasons.

For these three endpoints, a status other than 200 means that the request itself is wrong.

## Downloads

[Download an artifact](download-an-artifact/) and the [stable download link](stable-download-link/) answer with the status 303. The `Location` header is a signed download link. The link expires. Request the endpoint again for a new link.

A download that the license may not have answers with the status 403 and this body:

```json
{
  "valid": false,
  "reason": "suspended"
}
```

A download can also be refused because your account used the download allowance of the Free plan for the month. The answer has the status 403 and the reason `download_limit_reached`. See [Downloads](../concepts/plans-and-limits/#downloads).

A download of an artifact that is not found answers with the status 404.

## Updater feeds

The Distribution API also serves the update feeds of these frameworks. Each guide shows the feed and its setup.

| Framework | Guide |
| --- | --- |
| Tauri | [Tauri updates](../guides/updaters/tauri-updates/) |
| Sparkle | [Sparkle updates](../guides/updaters/sparkle-updates/) |
| WinSparkle | [WinSparkle updates](../guides/updaters/winsparkle-updates/) |
| electron-updater | [Electron updates](../guides/updaters/electron-updates/) |

A feed refuses a license with the status 403, in the same way as a download.

## Errors

An error answer has this body:

```json
{
  "message": "The submitted details are not valid.",
  "errors": {
    "channel": "The channel must be stable, rc, beta, alpha or dev."
  }
}
```

| Field | Type | Description |
| --- | --- | --- |
| `message` | string | A sentence that describes the error. |
| `errors` | object | The query parameters that are not valid. Each key is the name of a parameter, and each value is a message. The body has no `errors` field when no parameter is wrong. |

Every endpoint can answer with these statuses:

| Status | Description |
| --- | --- |
| 400 | The request is wrong. A query parameter is not valid, the nonce is too long, or the signing key is not known. |
| 401 | The license key is missing or not valid. See [Authentication](authentication/). |
| 404 | The product was not found. |
| 429 | Your application sent too many requests. See [Rate limits](#rate-limits). |
| 500 | An error happened in Seatify. Try again later. |

A download and an updater feed can also answer with the status 403. See [Downloads](#downloads).

## Rate limits

The Distribution API limits the requests from one client address. It also limits the requests with one license 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 JSON answer with the status 200 is signed. That includes a licensing refusal. These answers are not signed:

- the download redirects,
- the updater feeds,
- every answer with a status other than 200.

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. The License API signs in the same way and with the same keys. See [Verify signed responses](../guides/signatures/verify-signed-responses/).

