Skip to main content
DELETE
/
v1
/
agents
/
{agent_id}
/
knowledge-bases
/
versions
Delete Knowledge Base Version By Label Agent Scoped
curl --request DELETE \
  --url https://api.getbluejay.ai/v1/agents/{agent_id}/knowledge-bases/versions \
  --header 'X-API-Key: <x-api-key>'
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>",
      "input": "<unknown>",
      "ctx": {}
    }
  ]
}
Integration Prompt for AI Agents
# Bluejay — Testing & Monitoring Platform for Conversational AI Agents

You are a senior backend engineer integrating the Bluejay API. Think step-by-step: first understand the endpoint, then plan the integration, then implement with minimal changes.

## Delete Knowledge Base Version By Label — DELETE /v1/agents/{agent_id}/knowledge-bases/versions

> **What this endpoint does:** delete a knowledge base version by label. - if label is production -> 400 (must move production first) - if label resolves to 0 -> 404; >1 -> 400 ambiguous (except latest which should be unique) - if deleting latest, reassign latest to highest remaining version - cannot delete if it is the only version

**Endpoint:** DELETE `https://api.getbluejay.ai/v1/agents/{agent_id}/knowledge-bases/versions`
**Auth:** `X-API-Key` header

### Required Parameters
| Name | Type | Description |
|------|------|-------------|
| agent_id | integer |  |
| X-API-Key | string | API key required to authenticate requests. |

Review the full parameter list at https://docs.getbluejay.ai/api-reference/endpoint/delete-knowledge-base-version-by-label and include any optional parameters (e.g., `label`) that serve your integration's use case and align with Bluejay's testing and monitoring capabilities.

### Example
**DELETE request:**
```python
import requests

def delete_knowledge_base_version_by_label(agent_id: int, api_key: str) -> dict:
    url = f"https://api.getbluejay.ai/v1/agents/{agent_id}/knowledge-bases/versions"
    headers = {"X-API-Key": api_key}
    response = requests.delete(url, headers=headers)
    response.raise_for_status()
    return response.json()
```

### Constraints
- Minimal changes — only add/change files needed for this integration.
- Match existing codebase patterns (naming, file structure, error handling).
- Include error handling for 422: Validation Error.

### Integration Checklist
Before writing code, verify:
1. Which module/service owns this API domain in the codebase?
2. What HTTP client and error-handling patterns does the project use?
3. Are there existing types/interfaces to extend?

Then implement the integration, export it, and confirm it compiles/passes lint.
Deletes a knowledge base version by label.
  • if label is production -> 400 (must move production first)
  • if label resolves to 0 -> 404; >1 -> 400 ambiguous (except latest which should be unique)
  • if deleting latest, reassign latest to highest remaining version
  • cannot delete if it is the only version

Headers

X-API-Key
string
required

API key required to authenticate requests.

Path Parameters

agent_id
integer
required

Query Parameters

label
string | null

Response

Successful Response