# Delete a Configuration

> **DELETE** `https://api.us.nylas.com/v3/grants/{grant_id}/scheduling/configurations/{configuration_id}`

Source: https://developer.nylas.com/docs/reference/api/configurations/delete-configurations-id/

Deletes the specified Configuration object. You can't delete a Configuration that has active
sessions.

**Authentication:** NYLAS_API_KEY

## Parameters

### Path parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `grant_id` | string | Yes | ID of the grant to access. You can also use the email address associated with the grant, or use `/me/` to refer to the grant associated with an access token. |
| `configuration_id` | string | Yes | The ID of the Configuration object to access. |

## Responses

### 200 - Delete Succeeded

- `request_id` (string) **(required)** - ID of the request.

### 400 - Bad Request

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.
  - `provider_error` (object) - The error from the provider.

### 401 - Unauthorized

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.
  - `provider_error` (object) - The error from the provider.

### 404 - Not Found

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.
  - `provider_error` (object) - The raw error from the provider, if available
    - `code` (string)
    - `message` (string)

### 429 - Rate Limit

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.

### 504 - Provider Failure

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.

## Code samples

### cURL

```bash
curl --compressed --request DELETE \
  --url "https://api.us.nylas.com/v3/grants/<NYLAS_GRANT_ID>/scheduling/configurations/<SCHEDULER_CONFIG_ID>" \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer <NYLAS_API_KEY>' \
  --header 'Content-Type: application/json'
```

### Node.js SDK

```javascript
import Nylas from "nylas";

const nylas = new Nylas({
  apiKey: "<NYLAS_API_KEY>",
  apiUri: "<NYLAS_API_URI>",
});

async function deleteConfiguration() {
  try {
    const result = await nylas.scheduler.configurations.destroy({
      identifier: "<NYLAS_GRANT_ID>",
      configurationId: "<CONFIGURATION_ID>",
    });

    console.log("Deleted configuration:", result);
  } catch (error) {
    console.error("Error deleting configuration:", error);
  }
}

deleteConfiguration();

```

### Python SDK

```python
from nylas import Client

nylas = Client(
    "<NYLAS_API_KEY>",
    "<NYLAS_API_URI>",
)

response = nylas.scheduler.configurations.destroy(
    identifier="<NYLAS_GRANT_ID>",
    config_id="<SCHEDULER_CONFIG_ID>",
)

print("Configuration deleted:", response)

```

### Ruby SDK

```ruby
# Load gems
require 'nylas'

# Initialize Nylas client
nylas = Nylas::Client.new(
  api_key: "<NYLAS_API_KEY>"
)

_, request_ids = nylas.scheduler.configurations.destroy(identifier: "<NYLAS_GRANT_ID>", configuration_id: "<SCHEDULER_CONFIG_ID>")

puts request_ids
```

### Java SDK

```java
import com.nylas.NylasClient;
import com.nylas.models.DeleteResponse;
import com.nylas.models.NylasApiError;
import com.nylas.models.NylasSdkTimeoutError;

public class DeleteConfiguration {
  public static void main(String[] args) throws NylasSdkTimeoutError, NylasApiError {
    NylasClient nylas = new NylasClient.Builder("<NYLAS_API_KEY>").build();

    DeleteResponse result = nylas.scheduler().configurations()
        .destroy("<NYLAS_GRANT_ID>", "<CONFIGURATION_ID>", null);

    System.out.println("Deleted configuration: " + result);
  }
}

```

### Kotlin SDK

```kotlin
import com.nylas.NylasClient

fun main() {
  val nylas = NylasClient.Builder("<NYLAS_API_KEY>").build()

  val result = nylas.scheduler().configurations()
      .destroy("<NYLAS_GRANT_ID>", "<CONFIGURATION_ID>")

  println("Deleted configuration: $result")
}

```
