# Delete a license

Deletes a license.

`DELETE /v1/licenses/{license}`

## Use cases

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

## Authentication

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

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

## Request

### Path parameters

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

### 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. The license key stops working immediately. The seats, the device bindings and the events of the license are deleted too. The customer who owned the license is not deleted. See [Deletion](../../../concepts/licenses/#deletion) and [Retention and deletion](../../../concepts/activity/#retention-and-deletion).

To stop a license for a time, suspend it instead. See [Update a license](../update-a-license/).

## 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 licenses:write scope.` | The integration does not have `licenses:write`. |
| 404 | `The license was not found.` | No license in your account has this ID. A license that was already deleted gets the same answer. An integration that is limited to one product gets the same answer for a license of another product. |
| 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/licenses/$LICENSE_ID \
  -H "Authorization: Bearer $SEATIFY_API_KEY"
```
{{< /tab >}}
{{< tab name="Swift" >}}
```swift
import Foundation

let url = URL(string: "https://api.seatify.dev/v1/licenses/\(licenseID)")!
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/licenses/{licenseId}");
var deleted = response.StatusCode == HttpStatusCode.NoContent;
```
{{< /tab >}}
{{< tab name="Go" >}}
```go
req, err := http.NewRequest("DELETE", "https://api.seatify.dev/v1/licenses/"+licenseID, 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/licenses/${licenseId}`, {
  method: "DELETE",
  headers: { Authorization: `Bearer ${apiKey}` },
});
const deleted = response.status === 204;
```
{{< /tab >}}
{{< /tabs >}}

The answer has the status 204 and no body.

