# Delete a customer

Deletes a customer.

`DELETE /v1/customers/{customer}`

## Use cases

- Remove a customer that was created by mistake.
- Remove the customers that a test run created.
- Remove a customer when the user asks you to delete their data.

## 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 delete every customer. See [Product](../../integrations-and-scopes/#product).

## Request

### Path parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `customer` | string | The ID of the customer. |

### Headers

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

## Response

The answer has the status 204 and no body.

Deletion is permanent. A customer who owns a license, holds a seat or owns a device binding cannot be deleted. Delete or reassign the licenses first, and release the seats and the devices. See [Deletion](../../../concepts/customers/#deletion).

## Errors

| Status | Reason | Description |
| --- | --- | --- |
| 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`. |
| 404 | `The customer was not found.` | No customer in your account has this ID. A customer that was already deleted gets the same answer. |
| 409 | `This customer still owns licenses, so it cannot be deleted.` | The customer owns at least one license. |
| 409 | `This customer still holds seats on licenses, so it cannot be deleted.` | The customer holds a seat on at least one license. |
| 409 | `This customer still owns bound devices, so it cannot be deleted.` | The customer owns at least one device binding. |
| 429 | `There are too many requests. Try again later.` | See [Rate limits](../../#rate-limits). |

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

## Example

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

let url = URL(string: "https://api.seatify.dev/v1/customers/\(customerID)")!
var request = URLRequest(url: url)
request.httpMethod = "DELETE"
request.setValue("Bearer \(apiKey)", forHTTPHeaderField: "Authorization")

let (_, response) = try await URLSession.shared.data(for: request)
let deleted = (response as? HTTPURLResponse)?.statusCode == 204
```
{{< /tab >}}
{{< tab name="C#" >}}
```csharp
using System.Net;
using System.Net.Http.Headers;

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

var response = await client.DeleteAsync($"https://api.seatify.dev/v1/customers/{customerId}");
var deleted = response.StatusCode == HttpStatusCode.NoContent;
```
{{< /tab >}}
{{< tab name="Go" >}}
```go
req, err := http.NewRequest("DELETE", "https://api.seatify.dev/v1/customers/"+customerID, 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()

deleted := res.StatusCode == http.StatusNoContent
```
{{< /tab >}}
{{< tab name="JavaScript" >}}
```javascript
const response = await fetch(`https://api.seatify.dev/v1/customers/${customerId}`, {
  method: "DELETE",
  headers: { Authorization: `Bearer ${apiKey}` },
});
const deleted = response.status === 204;
```
{{< /tab >}}
{{< /tabs >}}

The answer has the status 204 and no body.

