Delete Audience
Archives (soft delete) an audience criteria; responds 204 with no body. Fails with 409 if it is the project's root audience, and with 400 if another criteria references it as an operand.
DELETE /api/audience-criterias/:id
Archives an audience criteria. On deletion, the record is removed immediately
from the resource table —which is why it stops appearing in
GET /audience-criterias/:id (responds
404) and in GET /audience-criterias— and in
its place a recoverable snapshot is kept in the trash for a configurable retention
window.
Auth: Required — audience-criteria:delete permission
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | UUID | Audience criteria ID. Must be a valid UUID (otherwise, 400). |
Behavior
The endpoint validates in this order, and the first check that fails aborts the operation:
- Existence — if there is no audience criteria with that
idin the active project, it responds404(Audience criteria not found). - Not the root audience — the project's
root audience cannot be deleted: it responds
409with the messageLa audiencia raíz de un proyecto no se puede eliminar. - Not referenced — if another audience criteria that still exists (not
archived) references it as an operand in a composition, it responds
400with the messageCannot delete an audience criteria that is referenced by another active audience criteria. You must remove that composition (or delete the criteria that references it) before you can delete this one. - Archived — if it passes the three checks, the criteria is archived and the endpoint
responds
204 No Contentwith no body.
Example
curl -X DELETE https://api.reten.ai/api/audience-criterias/f47ac10b-58cc-4372-a567-0e02b2c3d479 \
-H "Authorization: Bearer <token>" \
-H "x-tenant-id: <tenant-id>" \
-H "x-project-id: <project-id>"
# → HTTP/1.1 204 No Content (empty body)import axios from 'axios';
const id = 'f47ac10b-58cc-4372-a567-0e02b2c3d479';
await axios.delete(
`https://api.reten.ai/api/audience-criterias/${id}`,
{ headers: { Authorization: 'Bearer <token>', 'x-tenant-id': '<tenant-id>', 'x-project-id': '<project-id>' } },
);
// The response is 204 with no body; axios does not reject (2xx).import requests
criteria_id = "f47ac10b-58cc-4372-a567-0e02b2c3d479"
response = requests.delete(
f"https://api.reten.ai/api/audience-criterias/{criteria_id}",
headers={"Authorization": "Bearer <token>", "x-tenant-id": "<tenant-id>", "x-project-id": "<project-id>"},
)
response.raise_for_status() # 204 No Content, response.content == b""Response 204 No Content
Empty body. The criteria has been archived.
Error 400 — referenced by another audience
If another audience criteria uses it as an operand in a composition, the deletion is
rejected with 400 and the criteria is not archived:
{
"statusCode": 400,
"message": "Cannot delete an audience criteria that is referenced by another active audience criteria",
"error": "Bad Request"
}Error Responses
| Status | Description |
|---|---|
400 | Another audience criteria references it as an operand in a composition (exact message above), or the id is not a valid UUID. |
401 | Missing or invalid Authorization: Bearer. |
403 | The user lacks the audience-criteria:delete permission, or the x-tenant-id is not authorized. |
404 | No audience criteria with that id exists in the active project (Audience criteria not found). |
409 | The criteria is the project's root audience (La audiencia raíz de un proyecto no se puede eliminar). |