Delete all conversations for a user

DELETE/v2/agents/{agentId}/users/{userId}/conversations

Permanently delete every conversation that one userId has had with an agent, for example when a person asks you to remove their data.

Working draft. These docs are illustrative: names, endpoints and examples describe the intended behaviour and can change before launch.

Permanently deletes every conversation of one userId with an agent, including the messages and any feedback. Call it as a step when you remove a person's data from your systems. The deletion cannot be undone.

Request

DELETE /v2/agents/{agentId}/users/{userId}/conversations

Path parameters:

Name Type Required Description
agentId string Yes The ID of the agent, starting with agt_.
userId string Yes The ID you sent as userId in chat requests, starting with usr_.

The call has no query parameters and no body. It only affects the agent in the path. If the person also talked to other agents, repeat the call for each one.

Before you delete, you can keep a copy with Export conversations or read the list with List conversations for a user. The concept page User conversations explains how a userId groups conversations.

Example request

curl -X DELETE https://api.askocto.co/v2/agents/agt_8f3k2m/users/usr_3b6t0z/conversations \
  -H "Authorization: Bearer $OCTO_API_KEY"
const response = await fetch(
  "https://api.askocto.co/v2/agents/agt_8f3k2m/users/usr_3b6t0z/conversations",
  {
    method: "DELETE",
    headers: { Authorization: `Bearer ${process.env.OCTO_API_KEY}` },
  },
)

const result = await response.json()
console.log(`Deleted ${result.deletedCount} conversations`)

Example response

A successful call returns 200 OK.

{
  "userId": "usr_3b6t0z",
  "deletedCount": 3
}

Response fields

Name Type Description
userId string The user whose conversations were deleted.
deletedCount integer The number of conversations that were removed.

A user without conversations returns deletedCount: 0, not an error. Calling the endpoint twice is safe.

Errors

Status Code When
401 unauthorized The API key is missing, malformed or deleted.
403 forbidden The key is valid but is not allowed to delete this data.
404 not_found No agent has this ID in your workspace.
429 rate_limited Too many requests. Wait for the number of seconds in the Retry-After header.

Something unclear or missing? Tell us and we will fix the page.