# Delete credential

> **DELETE** `https://api.us.nylas.com/v3/connectors/{provider}/creds/{id}`

Source: https://developer.nylas.com/docs/reference/api/connector-credentials/delete_credential_by_id/

Deletes the credential with the specified ID. You can't delete a connector's default (active) credential, only a non-default one. Any grants that use the deleted credential stop working right away.

To learn what gets removed and when, see [Deleting resources and data](/docs/dev-guide/platform/deleting-resources/).

**Authentication:** NYLAS_API_KEY

## Parameters

### Path parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `provider` | string | Yes |  |
| `id` | string | Yes |  |

## Responses

### 200 - The credential is deleted from the database.

- `request_id` (string) - The request ID.

### 400 - Bad Request

- `request_id` (string) **(required)** - ID of the request
- `error` (object) **(required)** - Error object
  - `type` (string) - Type of error
  - `message` (string) - Informative error message
  - `provider_error` (object) - (OPTIONAL) informative error message from provider's side

### 401 - Not Authenticated

- `request_id` (string) **(required)** - ID of the request
- `error` (object) **(required)** - Error object
  - `type` (string) - Type of error
  - `message` (string) - Informative error message
  - `provider_error` (object) - (OPTIONAL) informative error message from provider's side

## Code samples

### cURL

```bash
curl --request DELETE \
  --url 'https://api.us.nylas.com/v3/connectors/<CONNECTOR>/creds/<CREDENTIAL_ID>' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer <NYLAS_API_KEY>' \
```

### Node.js SDK

```javascript
import Nylas from "nylas";

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

const result = await nylas.connectors.credentials.destroy({
  provider: "google",
  credentialsId: "<CREDENTIAL_ID>",
});

console.log("Deleted:", result);

```

### Python SDK

```python
from nylas import Client

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

response = nylas.connectors.credentials.destroy(
    provider="google",
    credential_id="<CREDENTIAL_ID>",
)

print("Credential deleted:", response)

```

### Java SDK

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

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

    DeleteResponse result = nylas.connectors().credentials()
        .destroy(AuthProvider.GOOGLE, "<CREDENTIAL_ID>");

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

```

### Kotlin SDK

```kotlin
import com.nylas.NylasClient
import com.nylas.models.AuthProvider

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

  val result = nylas.connectors().credentials().destroy(AuthProvider.GOOGLE, "<CREDENTIAL_ID>")

  println("Deleted: $result")
}

```
