# Check for an update

Tells your application which release it should install instead of the version it runs.

`GET /v1/products/{product}/update`

## Use cases

- Check for a new version when your application starts, or on a schedule.
- Get the file for the device, with its SHA-256 and its signature, in one request.
- Let a user join the beta, or keep your application on one major version.

For the steps from the check to the installation, see [Updates and download links](../../guides/releases/updates-and-download-links/). An application that uses Tauri, Sparkle, WinSparkle or electron-updater reads its own update feed instead. See [Updater feeds](../#updater-feeds).

## Update selection

Send the version that your application runs. The answer offers the newest release with a higher version. When no release has a higher version, `update` is `null`. This is a normal answer and not an error.

- Seatify compares versions by semantic version rules. `1.3.0` is higher than `1.3.0-beta.2`. See [Newest release](../../concepts/releases-and-artifacts/#newest-release).
- The version that your application sends does not need to be a release in Seatify. A version that is higher than every release gets `update` set to `null`.
- The update check never offers a lower version.
- Build metadata does not count. The version `1.2.0+43` is not an update for `1.2.0+42`.
- A draft release, a yanked release and a file whose upload has not finished are never offered.

## Channels and constraints

Without `channel`, the check uses the [channel](../../concepts/releases-and-artifacts/#channels) of the version that your application runs. It sees that channel and every more stable channel.

| Version in the check | Releases that the check sees |
| --- | --- |
| `2.1.0` | stable |
| `2.1.0-rc.1` | rc and stable |
| `2.1.0-beta.1` | beta, rc and stable |
| `2.1.0-alpha.1` | alpha, beta, rc and stable |
| `2.1.0-nightly.5` | dev only |

- `channel` replaces the channel of the version. Send `channel=beta` to let a stable build join the beta.
- To leave the beta, send `channel=stable`. Your application keeps its beta build until a stable release with a higher version is published.
- A `dev` build is never offered a stable release. Send `channel=stable` to move it to stable releases.
- `constraint` keeps the check on one version line. The constraint `2` offers only `2.x.y` versions. The constraint `2.1` offers only `2.1.y` versions.

## File selection

`platform`, `arch` and `filetype` choose the file in `update.artifact`. Send `platform` and `arch` together, or leave out both. See [Platforms and architectures](../../concepts/releases-and-artifacts/#platforms-and-architectures).

- A release without a matching file is skipped. The check offers the newest release that has one. A fix for Windows only is not offered to macOS.
- A `universal` build matches any architecture. A build for the exact architecture wins over a `universal` build.
- A file without a platform or an architecture never matches a check that names one.
- If several files of the release match, `update.artifact` is `null`. The release is still offered. Add `filetype`, such as `filetype=dmg`, or choose a file from `update.artifacts`.
- A check without `platform`, `arch` and `filetype` gets `update.artifact` only when the release has one file.

Download the file from `update.artifact.url`. See [Download an artifact](../download-an-artifact/). Verify the file before your application installs it. See [Verifying files](../../concepts/releases-and-artifacts/#verifying-files).

## License checks

Check for an update checks the license key when the request sends one. A refused license answers with the status 200. `valid` is `false`, `reason` names the refusal, and `update` is `null`:

```json
{
  "valid": false,
  "reason": "suspended",
  "current": "1.1.0",
  "update": null
}
```

The reason is `product_mismatch`, `suspended` or `expired`. See [License checks](../authentication/#license-checks).

A license that expired under the Perpetual fallback rule is not refused. The check offers only the releases that were published on or before the expiry date of the license. A [backdated release](../../concepts/releases-and-artifacts/#backdated-releases) counts as published on its backdated date.

## Activity

- Each check with a license key records an update check on the license. A check that offers no update is recorded too. See [Activity](../../concepts/activity/).
- A refused check is recorded with its reason.
- A check without a license key, on an `open` product, records no activity.
- A request that answers with a status other than 200 records no activity.

## Authentication

Send the license key of the customer. A product with the `open` distribution setting does not require a key. See [Authentication](../authentication/).

## Request

`{product}` is the ID of the product. The request has no body.

| Header | Required | Description |
| --- | --- | --- |
| `Seatify-License-Key` | For a `licensed` product | The license key of the customer. For an `open` product, a key that the request sends must be valid. |
| `Seatify-Nonce` | No | A new random value that the signature includes. See [Signed responses](../#signed-responses). |
| `Seatify-Signing-Key` | No | The key ID of the signing key in your application. See [Signed responses](../#signed-responses). |

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `version` | string | Yes | The version that your application runs, such as `1.1.0` or `1.2.0-beta.1`. Send it without a `v` prefix. In the query string, encode the plus sign of build metadata as `%2B`, such as `version=2.1.0%2B42`. |
| `platform` | string | No | The [platform](../../concepts/releases-and-artifacts/#platforms-and-architectures) of the device: `darwin`, `windows`, `linux`, `ios`, `android` or `freebsd`. Send it together with `arch`. |
| `arch` | string | No | The [architecture](../../concepts/releases-and-artifacts/#platforms-and-architectures) of the device: `amd64`, `arm64`, `x86`, `arm` or `universal`. Send it together with `platform`. |
| `filetype` | string | No | The file type, such as `dmg` or `zip`. Use it when a release has several files for one platform and architecture. |
| `channel` | string | No | The [channel](../../concepts/releases-and-artifacts/#channels) that the check uses. The check sees this channel and every more stable channel. The `dev` channel sees only `dev` releases. The default is the channel of `version`. |
| `constraint` | string | No | A major version, such as `2`, or a major and minor version, such as `2.1`. The constraint `2` allows only `2.x.y` versions. The constraint `2.1` allows only `2.1.y` versions. |

## Response

| Field | Type | Description |
| --- | --- | --- |
| `valid` | boolean | `false` when the license is refused. It is `true` when there is no update. |
| `reason` | string or null | The reason of the refusal. It is `null` when `valid` is `true`. See [License checks](#license-checks). |
| `current` | string | The version from the request. |
| `update` | object or null | The release to install. See [Update](#update). It is `null` when no release has a higher version, or when `valid` is `false`. |

### Update

| Field | Type | Description |
| --- | --- | --- |
| `id` | string | The ID of the release. |
| `version` | string | The version to install. |
| `channel` | string | The [channel](../../concepts/releases-and-artifacts/#channels) of the release. |
| `name` | string or null | The name of the release. |
| `notes` | string or null | The release notes. Your application can show them to the user. |
| `published_at` | string | The time when the release was first published. |
| `artifacts` | array | Every file of the release. Each file has the fields in [Artifact](../get-a-release/#artifact). Only files whose upload has finished are listed. |
| `artifact` | object or null | The file for the platform, the architecture and the file type of the check. It has the same fields. It is `null` when no single file matches. See [File selection](#file-selection). |

## Errors

| Status | Reason | Description |
| --- | --- | --- |
| 400 | `A version is required. It must be a semantic version such as 1.2.0 or 1.2.0-beta.1, without a v prefix.` | `version` is missing or is not a semantic version. |
| 400 | `The platform and the arch are given together, or neither is.` | The request sends only one of `platform` and `arch`. The `errors` field names both. |
| 400 | `The platform must be darwin, windows, linux, ios, android or freebsd.` | `platform` has another value. |
| 400 | `The arch must be amd64, arm64, x86, arm or universal.` | `arch` has another value. |
| 400 | `The channel must be stable, rc, beta, alpha or dev.` | `channel` has another value. |
| 400 | `The constraint must be a major version, or a major and minor version, such as 2 or 2.1.` | `constraint` is not a major version or a major and minor version. |
| 400 | `The signing key is not known.` | Your organization has no signing key with the ID in `Seatify-Signing-Key`. |
| 400 | `The nonce must be at most 255 characters.` | The value of `Seatify-Nonce` is too long. |
| 401 | `A license key is required.` | The product is `licensed`, and the request has no `Seatify-License-Key` header, or the header is empty. |
| 401 | `The license key is not valid.` | No license in your account has this key. This applies to an `open` product too. |
| 404 | `The product was not found.` | No product has this ID. |
| 429 | `There are too many requests. Try again later.` | See [Rate limits](../#rate-limits). |

No update is not an error. See [Update selection](#update-selection).

The error of a query parameter is in the `errors` field, under the name of the parameter. See [Errors](../#errors).

## Example

Check for an update of a macOS build that runs version `1.1.0`.

{{< tabs >}}
{{< tab name="curl" >}}
```bash
curl "https://dist.seatify.dev/v1/products/$PRODUCT_ID/update?version=1.1.0&platform=darwin&arch=arm64" \
  -H "Seatify-License-Key: $LICENSE_KEY"
```
{{< /tab >}}
{{< tab name="Swift" >}}
```swift
import Foundation

struct UpdateCheck: Decodable {
    let valid: Bool
    let reason: String?
    let current: String
    let update: Update?
}

struct Update: Decodable {
    let id: String
    let version: String
    let channel: String
    let name: String?
    let notes: String?
    let artifact: Artifact?
}

struct Artifact: Decodable {
    let filename: String
    let platform: String?
    let arch: String?
    let size: Int
    let sha256: String
    let signature: String
    let signingKeyId: String
    let url: String
}

var components = URLComponents(string: "https://dist.seatify.dev/v1/products/\(productID)/update")!
components.queryItems = [
    URLQueryItem(name: "version", value: "1.1.0"),
    URLQueryItem(name: "platform", value: "darwin"),
    URLQueryItem(name: "arch", value: "arm64"),
]

var request = URLRequest(url: components.url!)
request.setValue(licenseKey, forHTTPHeaderField: "Seatify-License-Key")

let (data, _) = try await URLSession.shared.data(for: request)
let decoder = JSONDecoder()
decoder.keyDecodingStrategy = .convertFromSnakeCase
let check = try decoder.decode(UpdateCheck.self, from: data)
```
{{< /tab >}}
{{< tab name="C#" >}}
```csharp
using System.Net.Http.Json;
using System.Text.Json;

using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Seatify-License-Key", licenseKey);

var options = new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower };

var check = await client.GetFromJsonAsync<UpdateCheck>(
    $"https://dist.seatify.dev/v1/products/{productId}/update?version=1.1.0&platform=darwin&arch=arm64",
    options);

record UpdateCheck(bool Valid, string? Reason, string Current, Update? Update);

record Update(string Id, string Version, string Channel, string? Name, string? Notes, Artifact? Artifact);

record Artifact(string Filename, string? Platform, string? Arch, long Size, string Sha256, string Signature, string SigningKeyId, string Url);
```
{{< /tab >}}
{{< tab name="Go" >}}
```go
type Artifact struct {
	Filename     string  `json:"filename"`
	Platform     *string `json:"platform"`
	Arch         *string `json:"arch"`
	Size         int64   `json:"size"`
	SHA256       string  `json:"sha256"`
	Signature    string  `json:"signature"`
	SigningKeyID string  `json:"signing_key_id"`
	URL          string  `json:"url"`
}

type Update struct {
	ID       string    `json:"id"`
	Version  string    `json:"version"`
	Channel  string    `json:"channel"`
	Name     *string   `json:"name"`
	Notes    *string   `json:"notes"`
	Artifact *Artifact `json:"artifact"`
}

type UpdateCheck struct {
	Valid   bool    `json:"valid"`
	Reason  *string `json:"reason"`
	Current string  `json:"current"`
	Update  *Update `json:"update"`
}

query := url.Values{
	"version":  {"1.1.0"},
	"platform": {"darwin"},
	"arch":     {"arm64"},
}

req, err := http.NewRequest("GET", "https://dist.seatify.dev/v1/products/"+productID+"/update?"+query.Encode(), nil)
if err != nil {
	return err
}
req.Header.Set("Seatify-License-Key", licenseKey)

res, err := http.DefaultClient.Do(req)
if err != nil {
	return err
}
defer res.Body.Close()

var check UpdateCheck
err = json.NewDecoder(res.Body).Decode(&check)
```
{{< /tab >}}
{{< tab name="JavaScript" >}}
```javascript
const query = new URLSearchParams({ version: "1.1.0", platform: "darwin", arch: "arm64" });

const response = await fetch(
  `https://dist.seatify.dev/v1/products/${productId}/update?${query}`,
  { headers: { "Seatify-License-Key": licenseKey } },
);
const check = await response.json();
```
{{< /tab >}}
{{< /tabs >}}

The answer offers `1.4.0`. The release has one macOS file, a `universal` build, so `update.artifact` names it:

```json
{
  "valid": true,
  "reason": null,
  "current": "1.1.0",
  "update": {
    "id": "<release id>",
    "version": "1.4.0",
    "channel": "stable",
    "name": null,
    "notes": "Updates through Sparkle.",
    "published_at": "2026-09-21T23:00:00Z",
    "artifacts": [
      {
        "id": "<artifact id>",
        "filename": "BEACON-1.4.0.zip",
        "filetype": "zip",
        "platform": "darwin",
        "arch": "universal",
        "content_type": "application/zip",
        "size": 53,
        "sha256": "<sha256>",
        "signature": "<signature>",
        "signing_key_id": "<signing key id>",
        "vendor_signature": "<vendor signature>",
        "url": "https://dist.seatify.dev/v1/products/<product id>/releases/1.4.0/artifacts/BEACON-1.4.0.zip"
      },
      {
        "id": "<artifact id>",
        "filename": "BEACON-1.4.0-arm64-setup.exe",
        "filetype": "exe",
        "platform": "windows",
        "arch": "arm64",
        "content_type": "application/vnd.microsoft.portable-executable",
        "size": 50,
        "sha256": "<sha256>",
        "signature": "<signature>",
        "signing_key_id": "<signing key id>",
        "vendor_signature": "<vendor signature>",
        "url": "https://dist.seatify.dev/v1/products/<product id>/releases/1.4.0/artifacts/BEACON-1.4.0-arm64-setup.exe"
      }
    ],
    "artifact": {
      "id": "<artifact id>",
      "filename": "BEACON-1.4.0.zip",
      "filetype": "zip",
      "platform": "darwin",
      "arch": "universal",
      "content_type": "application/zip",
      "size": 53,
      "sha256": "<sha256>",
      "signature": "<signature>",
      "signing_key_id": "<signing key id>",
      "vendor_signature": "<vendor signature>",
      "url": "https://dist.seatify.dev/v1/products/<product id>/releases/1.4.0/artifacts/BEACON-1.4.0.zip"
    }
  }
}
```

When your application runs the newest version, `update` is `null`:

```json
{
  "valid": true,
  "reason": null,
  "current": "1.4.0",
  "update": null
}
```

