---
docId: doc_8fc3b0f895744477a4b406215997a979
title: Disconnect an AI provider key
description: "Disconnect your key and return to using Platica's account."
api:
  group: proveedores-de-ia
  auth: bearer
  operations:
    - operationId: disconnectAiProvider
      method: DELETE
      path: '/v1/ai-providers/{provider}'
      postmanName: Disconnect an AI provider key
---

<script>
  import { Ways, Note } from '$lib/components';
</script>

# Disconnect an AI provider key

Stop using the provider key, remove its authorization, and delete the secret created when it was connected. The provider returns to `not_connected`, and agents use Platica's account again.

## Example

<Ways tabs="api,sdk">
<Ways.Way name="api">

```bash
curl -X DELETE https://api.platic.ai/v1/ai-providers/openai \
  -H "Authorization: Bearer $PLATIC_API_KEY"
```

</Ways.Way>
<Ways.Way name="sdk">

```ts
await platic.aiProviders.disconnect("openai");
```

</Ways.Way>
</Ways>

## Path parameters

| Parameter | Type | Description | Required |
|-----------|------|-------------|----------|
| `provider` | string | `openai`, `google`, `anthropic`, or `xai` | ✓ |

## Response

`200 OK` with the provider now without a key, in the shape of [list AI providers](/api-reference/ai-providers/list#the-provider).

```json
{
  "status": "success",
  "message": "Key disconnected",
  "data": {
    "provider": "openai",
    "name": "OpenAI",
    "status": "not_connected",
    "health": null,
    "fallback": null,
    "lastVerifiedAt": null,
    "lastError": null,
    "secretName": null,
    "models": [
      { "id": "gpt-6.1-sol", "name": "GPT-6.1 Sol", "status": "unverified", "code": null, "ownKeyOnly": false },
      { "id": "gpt-6.1-terra", "name": "GPT-6.1 Terra", "status": "unverified", "code": null, "ownKeyOnly": false },
      { "id": "gpt-6-luna", "name": "GPT-6 Luna", "status": "unverified", "code": null, "ownKeyOnly": false }
    ]
  }
}
```

## Errors

| Status | `details.code` | When it happens |
|--------|----------------|-----------------|
| `400` | `INVALID_PROVIDER` | `{provider}` is not one of the four |
| `403` | `FORBIDDEN` | The person behind the token cannot manage secrets |

<Note type="warning">

Agents that use a model that only works with your own key stop answering with it.

</Note>

## Notes

- The secret that created the connection is deleted (for example, `OpenAI key`): its encrypted value disappears and cannot be recovered. If you renamed it or another integration uses it, it stays in [Secrets](/api-reference/secrets/list) without authorization for the provider; [delete it](/api-reference/secrets/delete) if it is no longer useful.
- Disconnecting a provider without a key changes nothing and answers the same.
- From an AI agent, the tool is [`disconnect_ai_provider`](/mcp/tools#ai-providers).
