For AI agents: markdown of this page — /docs-content-en/ai/credentials/delete.md documentation index — /llms.txt
Delete a provider key
DELETE /v1/ai/credentials/:id
Deletes a connected provider key. Related Custom provider models bound to this key are cascade-deleted. Usage history (AiUsageLog) is preserved — statistics records are not lost.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id (path) |
string | yes | Key ID from GET /v1/ai/credentials |
Examples
curl — personal key
curl -X DELETE https://vibecode.bitrix24.com/v1/ai/credentials/cred_abc123def456 \
-H "X-Api-Key: YOUR_API_KEY"
curl — OAuth application
curl -X DELETE https://vibecode.bitrix24.com/v1/ai/credentials/cred_abc123def456 \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN"
JavaScript — personal key
const id = 'cred_abc123def456'
const res = await fetch(`https://vibecode.bitrix24.com/v1/ai/credentials/${id}`, {
method: 'DELETE',
headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})
const { success } = await res.json()
if (success) console.log('Key deleted')
JavaScript — OAuth application
const id = 'cred_abc123def456'
const res = await fetch(`https://vibecode.bitrix24.com/v1/ai/credentials/${id}`, {
method: 'DELETE',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
},
})
if ((await res.json()).success) console.log('OK')
Response fields
| Field | Type | Description |
|---|---|---|
success |
boolean | Always true on success |
Response example
HTTP status 200 OK:
{
"success": true
}
Error response example
404 not_found — the key was not found or belongs to another user:
{
"success": false,
"error": {
"code": "not_found",
"message": "Credential not found"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| 404 | not_found |
A key with this id was not found or does not belong to you |
| 403 | scope_missing |
The API key lacks the vibe:ai scope |
| 401 | MISSING_API_KEY |
The X-Api-Key header is missing |
Full list of common API errors — Errors.
Known specifics
Cascade deletion of models. For a Custom provider whose key has models bound via POST /v1/ai/credentials/:id/models or POST /v1/ai/credentials/:id/fetch-models, all bound models are deleted together with the key.
Usage history is preserved. AiUsageLog records are not deleted — statistics for this provider from past periods remain in GET /v1/ai/usage. The modelId and providerId fields are stored as strings, with no FK relation to the keys table.
USER keys only. The endpoint works only with the current user's keys. PORTAL keys that an administrator connected for all users are not available here.