# List policies

Returns the policies of your products, the newest first.

`GET /v1/policies`

## Use cases

- Find the policy that has a code, such as `PRO`, before you create a license from it.
- List the policies of one product, to show the plans that a customer can buy.
- Copy every policy into your own system.

## Authentication

Send an API key. This endpoint requires the scope `policies:read`. See [Authentication](../../authentication/) and [Scopes](../../integrations-and-scopes/#scopes).

An integration that is limited to one product can list only the policies of that product. See [Product](../../integrations-and-scopes/#product).

## Request

### Query parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | No | A whole policy code. The list holds the policies that have this code. Upper case and lower case are the same. Two products can use the same code, so the list can hold more than one policy. An unknown code answers an empty list. |
| `q` | string | No | A search term. It matches a part of the policy ID, of the name and of the code. |
| `product_id` | string | No | The ID of a product. The list holds the policies of this product. For an integration that is limited to one product, the ID of another product answers an empty list. |
| `entitlement_id` | string | No | The ID of an entitlement. The list holds the policies that grant this entitlement. |
| `binding` | string | No | `device`, `customer` or `none`. The list holds the policies that bind devices, the policies that bind customers, or the policies that bind neither. |

A policy must match every parameter that the request sends.

### Headers

| Header | Required | Description |
| --- | --- | --- |
| `Authorization` | Yes | The word `Bearer`, a space and the API key. |

## Response

The answer has the status 200.

| Field | Type | Description |
| --- | --- | --- |
| `policies` | array of objects | The policies. See [Policy](#policy). |
| `total` | integer | The number of policies in the list. |
| `next_cursor` | null | The list has no pages, so this field is always `null`. See [Pagination](../../#pagination). |

### Policy

| Field | Type | Description |
| --- | --- | --- |
| `id` | string | The ID of the policy. |
| `product_id` | string | The ID of the product that the policy belongs to. |
| `name` | string | The name of the policy. |
| `code` | string or null | The short identifier of the policy, such as `PRO`. It is `null` when the policy has no code. |
| `key_prefix` | string or null | The first group of every license key that the policy issues. It is `null` when the policy has no key prefix. |
| `duration_seconds` | integer or null | The duration of a license in seconds. It is `null` when the policy is a lifetime policy. |
| `grace_period_seconds` | integer or null | The grace period in seconds. It is `null` when the policy has no grace period. |
| `expiration_basis` | string | `issue` or `first_activation`. The duration starts when the license is created or at the first claim. |
| `expiration_strategy` | string | `expire`, `keep_access` or `perpetual_fallback`. See [After expiry](../../../concepts/policies/#after-expiry). |
| `binds_device` | boolean | A claim must send a device fingerprint. |
| `binds_customer` | boolean | A claim must name the customer who takes the seat. |
| `max_devices` | integer or null | The device limit. It is `null` when there is no limit. |
| `max_seats` | integer or null | The seat limit. It is `null` when there is no limit. |
| `max_processes` | integer or null | The process limit per device. It is `null` when there is no limit. |
| `requires_heartbeat` | boolean | Each device keeps its binding with heartbeats. |
| `heartbeat_interval_seconds` | integer or null | The time between two heartbeats in seconds. |
| `heartbeat_grace_seconds` | integer or null | The extra time for a late heartbeat in seconds. |
| `process_interval_seconds` | integer or null | The time between two process heartbeats in seconds. It is `null` when process tracking is off. |
| `process_grace_seconds` | integer or null | The extra time for a late process heartbeat in seconds. |
| `offline_validation` | boolean | The application can check out a signed license file. |
| `license_file_ttl_seconds` | integer or null | The lifetime of a license file in seconds. It is `null` when the default of 30 days applies. |
| `license_file_encrypted` | boolean | License files are encrypted. |
| `created_at` | string | The time when the policy was created. |
| `updated_at` | string | The time when the policy was last changed. |

A license can override `expiration_strategy`, `max_devices`, `max_seats` and `max_processes`. See [License overrides](../../../concepts/policies/#license-overrides). See [Policies](../../../concepts/policies/) for the meaning of each setting.

## Errors

| Status | Reason | Description |
| --- | --- | --- |
| 400 | `The submitted details are not valid.` | A query parameter is not valid. The `errors` field names it. See the table below. |
| 401 | `An API key is required.` | The request has no `Authorization` header, the header is empty, or the header does not use the `Bearer` scheme. |
| 401 | `The API key is not valid.` | No integration has this key. |
| 401 | `The API key has expired.` | The expiry date of the key has passed. |
| 403 | `This integration does not have the policies:read scope.` | The integration has neither `policies:read` nor `policies:write`. |
| 429 | `There are too many requests. Try again later.` | See [Rate limits](../../#rate-limits). |

These fields can be in `errors`:

| Field | Description |
| --- | --- |
| `code` | The code is empty or too long. |
| `q` | The search term is too long. |
| `product_id` | The value is not an ID. |
| `entitlement_id` | The value is not an ID. |
| `binding` | The value is not `device`, `customer` or `none`. |

See [Errors](../../#errors).

## Example

{{< tabs >}}
{{< tab name="curl" >}}
```bash
curl "https://api.seatify.dev/v1/policies?code=$POLICY_CODE" \
  -H "Authorization: Bearer $SEATIFY_API_KEY"
```
{{< /tab >}}
{{< tab name="Swift" >}}
```swift
import Foundation

struct PolicyList: Decodable {
    let policies: [Policy]
    let total: Int
}

struct Policy: Decodable {
    let id: String
    let name: String
    let code: String?
    let durationSeconds: Int?

    enum CodingKeys: String, CodingKey {
        case id, name, code
        case durationSeconds = "duration_seconds"
    }
}

var components = URLComponents(string: "https://api.seatify.dev/v1/policies")!
components.queryItems = [URLQueryItem(name: "code", value: policyCode)]

var request = URLRequest(url: components.url!)
request.setValue("Bearer \(apiKey)", forHTTPHeaderField: "Authorization")

let (data, _) = try await URLSession.shared.data(for: request)
let list = try JSONDecoder().decode(PolicyList.self, from: data)
let policy = list.policies.first
```
{{< /tab >}}
{{< tab name="C#" >}}
```csharp
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json.Serialization;

using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);

var list = await client.GetFromJsonAsync<PolicyList>(
    $"https://api.seatify.dev/v1/policies?code={Uri.EscapeDataString(policyCode)}");
var policy = list?.Policies.FirstOrDefault();

record PolicyList(Policy[] Policies, long Total);
record Policy(
    string Id,
    string Name,
    string? Code,
    [property: JsonPropertyName("duration_seconds")] long? DurationSeconds);
```
{{< /tab >}}
{{< tab name="Go" >}}
```go
query := url.Values{"code": {policyCode}}

req, err := http.NewRequest("GET", "https://api.seatify.dev/v1/policies?"+query.Encode(), nil)
if err != nil {
	return err
}
req.Header.Set("Authorization", "Bearer "+apiKey)

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

var list struct {
	Policies []struct {
		ID              string  `json:"id"`
		Name            string  `json:"name"`
		Code            *string `json:"code"`
		DurationSeconds *uint64 `json:"duration_seconds"`
	} `json:"policies"`
	Total int64 `json:"total"`
}
err = json.NewDecoder(res.Body).Decode(&list)
```
{{< /tab >}}
{{< tab name="JavaScript" >}}
```javascript
const params = new URLSearchParams({ code: policyCode });
const response = await fetch(`https://api.seatify.dev/v1/policies?${params}`, {
  headers: { Authorization: `Bearer ${apiKey}` },
});
const { policies, total } = await response.json();
```
{{< /tab >}}
{{< /tabs >}}

The answer:

```json
{
  "policies": [
    {
      "id": "<policy id>",
      "product_id": "<product id>",
      "name": "Perpetual Desktop",
      "code": "PERP-DESKTOP",
      "key_prefix": "PERP",
      "duration_seconds": null,
      "grace_period_seconds": null,
      "expiration_basis": "issue",
      "expiration_strategy": "expire",
      "binds_device": true,
      "binds_customer": false,
      "max_devices": 3,
      "max_seats": null,
      "max_processes": null,
      "requires_heartbeat": false,
      "heartbeat_interval_seconds": null,
      "heartbeat_grace_seconds": null,
      "process_interval_seconds": null,
      "process_grace_seconds": null,
      "offline_validation": true,
      "license_file_ttl_seconds": 2592000,
      "license_file_encrypted": false,
      "created_at": "2025-08-01T23:00:00Z",
      "updated_at": "2025-08-01T23:00:00Z"
    }
  ],
  "total": 1,
  "next_cursor": null
}
```

