# List customers

Returns the customers of your account, the newest first.

`GET /v1/customers`

## Use cases

- Find the customer that has the ID of a user in your own system, before you create the customer.
- Find a customer from the email address that the customer sends to your support team.
- Copy every customer into your own system, one page at a time.

## Authentication

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

Customers belong to your account, not to one product. An integration that is limited to one product can list every customer. See [Product](../../integrations-and-scopes/#product).

## Request

### Query parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `external_ref` | string | No | A whole external reference. The list holds the customer that has this reference. Upper case and lower case are different, so `ACME-1` and `acme-1` are two references. An unknown reference answers an empty list. |
| `email` | string | No | A whole email address. The list holds the customers that have this address. Upper case and lower case are the same. An unknown address answers an empty list. |
| `q` | string | No | A search term. It matches a part of the customer ID, of the external reference, of the first name, of the last name and of the email address. |
| `cursor` | string | No | The value of `next_cursor` from the previous page. See [Pagination](../../#pagination). |

A customer 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 |
| --- | --- | --- |
| `customers` | array of objects | The customers on this page. See [Customer](#customer). |

The answer also has the fields `total` and `next_cursor`. See [Pagination](../../#pagination).

### Customer

| Field | Type | Description |
| --- | --- | --- |
| `id` | string | The ID of the customer. |
| `external_ref` | string | The ID of the customer in your own system. See [References](../../../concepts/customers/#references). |
| `email` | string or null | The email address of the customer. |
| `first_name` | string or null | The first name of the customer. |
| `last_name` | string or null | The last name of the customer. |
| `created_at` | string | The time when the customer was created. |
| `updated_at` | string | The time when the customer was last changed. |

## 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. |
| 400 | `The customer cursor is not valid.` | No customer in your account has the ID in `cursor`. |
| 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 customers:read scope.` | The integration has neither `customers:read` nor `customers:write`. |
| 429 | `There are too many requests. Try again later.` | See [Rate limits](../../#rate-limits). |

These fields can be in `errors`:

| Field | Description |
| --- | --- |
| `external_ref` | The reference is empty or too long. |
| `email` | The email address is empty or too long. |
| `q` | The search term is too long. |
| `cursor` | The value is not an ID, or no customer in your account has this ID. |

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

## Example

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

struct CustomerPage: Decodable {
    let customers: [Customer]
    let total: Int
    let nextCursor: String?

    enum CodingKeys: String, CodingKey {
        case customers, total
        case nextCursor = "next_cursor"
    }
}

struct Customer: Decodable {
    let id: String
    let externalRef: String
    let email: String?

    enum CodingKeys: String, CodingKey {
        case id, email
        case externalRef = "external_ref"
    }
}

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

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

let (data, _) = try await URLSession.shared.data(for: request)
let page = try JSONDecoder().decode(CustomerPage.self, from: data)
let customer = page.customers.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 page = await client.GetFromJsonAsync<CustomerPage>(
    $"https://api.seatify.dev/v1/customers?external_ref={Uri.EscapeDataString(externalRef)}");
var customer = page?.Customers.FirstOrDefault();

record CustomerPage(Customer[] Customers, long Total, [property: JsonPropertyName("next_cursor")] string? NextCursor);
record Customer(string Id, [property: JsonPropertyName("external_ref")] string ExternalRef, string? Email);
```
{{< /tab >}}
{{< tab name="Go" >}}
```go
query := url.Values{"external_ref": {externalRef}}

req, err := http.NewRequest("GET", "https://api.seatify.dev/v1/customers?"+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 page struct {
	Customers []struct {
		ID          string  `json:"id"`
		ExternalRef string  `json:"external_ref"`
		Email       *string `json:"email"`
	} `json:"customers"`
	Total      int64   `json:"total"`
	NextCursor *string `json:"next_cursor"`
}
err = json.NewDecoder(res.Body).Decode(&page)
```
{{< /tab >}}
{{< tab name="JavaScript" >}}
```javascript
const params = new URLSearchParams({ external_ref: externalRef });
const response = await fetch(`https://api.seatify.dev/v1/customers?${params}`, {
  headers: { Authorization: `Bearer ${apiKey}` },
});
const { customers, total, next_cursor } = await response.json();
```
{{< /tab >}}
{{< /tabs >}}

The answer:

```json
{
  "customers": [
    {
      "id": "<customer id>",
      "external_ref": "usr_000200",
      "email": "katya.pereira199@meridian.example",
      "first_name": "Katya",
      "last_name": "Pereira",
      "created_at": "2025-08-22T23:00:00Z",
      "updated_at": "2025-08-22T23:00:00Z"
    }
  ],
  "total": 1,
  "next_cursor": null
}
```

