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
Parameterid (path) Typestring Requiredyes DescriptionKey ID from GET /v1/ai/credentials

Examples

curl — personal key

Terminal
curl -X DELETE https://vibecode.bitrix24.com/v1/ai/credentials/cred_abc123def456 \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
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

javascript
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

javascript
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
Fieldsuccess Typeboolean DescriptionAlways true on success

Response example

HTTP status 200 OK:

JSON
{
  "success": true
}

Error response example

404 not_found — the key was not found or belongs to another user:

JSON
{
  "success": false,
  "error": {
    "code": "not_found",
    "message": "Credential not found"
  }
}

Errors

HTTP Code Description
HTTP404 Codenot_found DescriptionA key with this id was not found or does not belong to you
HTTP403 Codescope_missing DescriptionThe API key lacks the vibe:ai scope
HTTP401 CodeMISSING_API_KEY DescriptionThe 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.

See also