# Create a customer

Creates a customer with a reference to a user in your own system.

`POST /v1/customers`

## Use cases

- Create a customer when a user signs up or pays in your own system, before you issue a license to the user.
- Import the users of your own system from a script, such as when you move from another licensing system.

## Authentication

Send an API key. This endpoint requires the scope `customers:write`. 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 create customers. See [Product](../../integrations-and-scopes/#product).

## Request

### Headers

| Header | Required | Description |
| --- | --- | --- |
| `Authorization` | Yes | The word `Bearer`, a space and the API key. |
| `Content-Type` | Yes | `application/json`. |

### Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `external_ref` | string | Yes | The ID of the customer in your own system. No other customer in your account can have the same reference. See [References](../../../concepts/customers/#references). |
| `email` | string | No | The email address of the customer. |
| `first_name` | string | No | The first name of the customer. |
| `last_name` | string | No | The last name of the customer. |

Spaces at the start and the end of a value are removed. A value that has only spaces is stored as `null`.

## Response

The answer has the status 201.

| 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 request body could not be read.` | The body is not valid JSON. |
| 400 | `The submitted details are not valid.` | A field 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 customers:write scope.` | The integration does not have `customers:write`. |
| 409 | `A customer with this reference already exists.` | Another customer in your account has the reference in `external_ref`. The `errors` field names `external_ref`. |
| 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 missing or too long. |
| `email` | The email address is not valid or too long. |
| `first_name` | The first name is too long. |
| `last_name` | The last name is too long. |

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

## Example

{{< tabs >}}
{{< tab name="curl" >}}
```bash
curl https://api.seatify.dev/v1/customers \
  -H "Authorization: Bearer $SEATIFY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "external_ref": "usr_104233",
    "email": "mira.okafor@example.com",
    "first_name": "Mira",
    "last_name": "Okafor"
  }'
```
{{< /tab >}}
{{< tab name="Swift" >}}
```swift
import Foundation

struct CreateCustomer: Encodable {
    let externalRef: String
    let email: String
    let firstName: String
    let lastName: String

    enum CodingKeys: String, CodingKey {
        case email
        case externalRef = "external_ref"
        case firstName = "first_name"
        case lastName = "last_name"
    }
}

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

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

let url = URL(string: "https://api.seatify.dev/v1/customers")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("Bearer \(apiKey)", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = try JSONEncoder().encode(
    CreateCustomer(externalRef: "usr_104233", email: "mira.okafor@example.com", firstName: "Mira", lastName: "Okafor")
)

let (data, _) = try await URLSession.shared.data(for: request)
let customer = try JSONDecoder().decode(Customer.self, from: data)
```
{{< /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 response = await client.PostAsJsonAsync("https://api.seatify.dev/v1/customers", new
{
    external_ref = "usr_104233",
    email = "mira.okafor@example.com",
    first_name = "Mira",
    last_name = "Okafor",
});
var customer = await response.Content.ReadFromJsonAsync<Customer>();

record Customer(string Id, [property: JsonPropertyName("external_ref")] string ExternalRef, string? Email);
```
{{< /tab >}}
{{< tab name="Go" >}}
```go
body, err := json.Marshal(map[string]string{
	"external_ref": "usr_104233",
	"email":        "mira.okafor@example.com",
	"first_name":   "Mira",
	"last_name":    "Okafor",
})
if err != nil {
	return err
}

req, err := http.NewRequest("POST", "https://api.seatify.dev/v1/customers", bytes.NewReader(body))
if err != nil {
	return err
}
req.Header.Set("Authorization", "Bearer "+apiKey)
req.Header.Set("Content-Type", "application/json")

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

var customer struct {
	ID          string  `json:"id"`
	ExternalRef string  `json:"external_ref"`
	Email       *string `json:"email"`
}
err = json.NewDecoder(res.Body).Decode(&customer)
```
{{< /tab >}}
{{< tab name="JavaScript" >}}
```javascript
const response = await fetch("https://api.seatify.dev/v1/customers", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    external_ref: "usr_104233",
    email: "mira.okafor@example.com",
    first_name: "Mira",
    last_name: "Okafor",
  }),
});
const customer = await response.json();
```
{{< /tab >}}
{{< /tabs >}}

The answer:

```json
{
  "id": "<customer id>",
  "external_ref": "usr_104233",
  "email": "mira.okafor@example.com",
  "first_name": "Mira",
  "last_name": "Okafor",
  "created_at": "2026-09-27T22:50:30Z",
  "updated_at": "2026-09-27T22:50:30Z"
}
```

