# Deleting Access Codes

## 1. Delete the access code using the API

To delete an access code, specify the desired `access_code_id` in the [Delete Access Code](https://docs.seam.co/latest/api/access_codes/delete) request.

{% tabs %}
{% tab title="JavaScript" %}
**Code:**

```javascript
await seam.accessCodes.delete({
  access_code_id: "11111111-1111-1111-1111-555555555555"
});
```

**Output:**

```
void
```

{% endtab %}

{% tab title="cURL" %}
**Request:**

```bash
curl -X 'POST' \
  'https://connect.getseam.com/access_codes/delete' \
  -H 'accept: application/json' \
  -H "Authorization: Bearer ${SEAM_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
  "access_code_id": "11111111-1111-1111-1111-555555555555"
}'
```

**Response:**

```json
{
  "ok": true
}
```

{% endtab %}

{% tab title="Python" %}
**Code:**

```python
seam.access_codes.delete(
  access_code_id="11111111-1111-1111-1111-555555555555"
)
```

**Output:**

```
None
```

{% endtab %}

{% tab title="Ruby" %}
**Code:**

```ruby
client.access_codes.delete(
  access_code_id: "11111111-1111-1111-1111-555555555555"
)
```

**Output:**

```
void
```

{% endtab %}

{% tab title="PHP" %}
**Code:**

```php
$seam->access_codes->delete(
  access_code_id: "11111111-1111-1111-1111-555555555555"
);
```

**Output:**

```
void
```

{% endtab %}

{% tab title="C#" %}
**Code:**

```csharp
seam.AccessCodes.Delete(
  accessCodeId: "11111111-1111-1111-1111-555555555555"
);
```

**Output:**

```
void
```

{% endtab %}
{% endtabs %}

***

## 2. Verify that the access code has been removed

Poll for or configure a [webhook](/latest/developer-tools/webhooks.md) to listen for an `access_code.deleted` or `access_code.removed_from_device` event containing the `access_code_id` of the access code that you've deleted. Note that if you delete an access code that was never programmed onto a device, Seam does not emit an `access_code.removed_from_device` event for this access code.

If you receive `access_code.failed_to_remove_from_device` or `access_code.delay_in_removing_from_device` events, see [Troubleshooting Access Code Issues](/latest/capability-guides/smart-locks/access-codes/troubleshooting-access-code-issues.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.seam.co/latest/capability-guides/smart-locks/access-codes/deleting-access-codes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
