Logo
User Context

Delete Context

View API

Overview

The Delete Context endpoint allows you to permanently remove one or multiple user contexts. This operation helps you manage and clean up your platform contexts when they are no longer required.

Use this endpoint to:

  • Delete contexts to free up resources
  • Implement context lifecycle management

Endpoint Details

Method: DELETE
Endpoint: /api/user_context/delete
Base URL: https://api.k-v.ai
Authentication: Access Key (Required)


Request Specification

Headers

HeaderTypeRequiredDescription
access-keystringYesYour unique access-key generated from the platform UI
Content-TypestringYesMust be application/json

Request Body

{
  "ids": [10, 11]
}

Body Fields

FieldTypeRequiredDescription
idsarrayYesArray of context integer IDs to delete

Code Snippets

curl --location --request DELETE 'https://api.k-v.ai/api/user_context/delete' \
--header 'access-key: YOUR_ACCESS_KEY' \
--header 'Content-Type: application/json' \
--data '{
    "ids": [10, 11]
}'
import requests
import json

url = "https://api.k-v.ai/api/user_context/delete"

payload = json.dumps({
  "ids": [
    10, 11
  ]
})
headers = {
  'access-key': 'YOUR_ACCESS_KEY',
  'Content-Type': 'application/json'
}

response = requests.request("DELETE", url, headers=headers, data=payload)

print(response.text)
const axios = require('axios');

let data = JSON.stringify({
  "ids": [
    10, 11
  ]
});

let config = {
  method: 'delete',
  url: 'https://api.k-v.ai/api/user_context/delete',
  headers: { 
    'access-key': 'YOUR_ACCESS_KEY', 
    'Content-Type': 'application/json'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

Response Specification

Success Response (200 OK)

{
  "data": {},
  "message": "Data deleted successfully"
}

Error Responses

422 Validation Error

{
  "detail": [
    {
      "loc": ["body", "ids"],
      "msg": "field required",
      "type": "value_error.missing"
    }
  ]
}

Next Steps

Explore the full API specifications in the User Context API Reference.

On this page