Context window

Context window

Ask questions about a persisted document after extraction with window_context enabled.

Context Window · Remove from space

Detach a document from its space

Endpoint

DELETEhttps://claix.dev/remove-document-from-space/{document_id}

Sets espacio_id to null on the document. The document still exists; it just no longer belongs to the space. If it already had no space, the API returns 400.

Also accepts POST on the same URL. After detaching you can assign it again with POST /add-space.

Public URL: DELETE https://claix.dev/remove-document-from-space/{document_id}

This call is free: it is not billed and does not consume your extraction or context-window quota.

1. Authentication

Every request must include your API key. It is a personal server-side credential, different from any user session token.

Option A — Dedicated header (recommended):

x-api-key: <YOUR_API_KEY>

Option B — Standard Authorization header:

Authorization: Bearer <YOUR_API_KEY>

Either one is enough. If you send both, x-api-key wins.

Claix checks that the key exists and is active. Otherwise it returns 401.

2. Request format

Method: DELETE (also POST) · Body: not required · Query params: none

ParameterLocationRequiredDescription
document_idURL pathYesUUID of a document that currently has a space_id.

Expected URL shape: /remove-document-from-space/{document_id}

3. Building the call

  1. Get the document_id of the document you want to detach.
  2. Replace {document_id} in the URL with that UUID.
  3. Send DELETE (or POST) with your API key in x-api-key (no body).

4. Request examples

Use the code panel on the right to copy examples in cURL, JavaScript, Python, and more.

5. Success response format

HTTP 200 — The document no longer has a space assigned.

{
  "success": true,
  "document_id": "d4a1e9d2-8b1c-4f3e-9a02-8b1e9f3c7a4b",
  "previous_space_id": "5b9e2c14-7d3a-4f8b-9e1c-6a0d4b8f2e7c",
  "espacio_id": null,
  "file_name": "factura.pdf",
  "version": 1,
  "message": "Documento desacoplado del espacio. Ahora está sin space_id."
}
FieldTypeDescription
successbooleanAlways true in a 200 response.
document_idstring (uuid)Detached document.
previous_space_idstring (uuid)Space it was removed from.
espacio_idnullAlways null after the operation.
file_namestringDocument file name.
versionnumberCurrent document version.
messagestringHuman-readable confirmation.

6. Error codes

{
  "error": "Descripción legible del problema.",
  "detalle": "Información técnica adicional (solo presente en algunos casos).",
  "log_id": "7c2e1a90-4b3d-4f8a-9e21-6d5c8b0a1f34"
}

400 — Missing or invalid document_id, or the document already has no space assigned.

401 — Authentication failed: key missing, unknown, disabled, or account not active.

404 — Document does not exist or does not belong to your account.

405 — Method not allowed. · 500 — Internal error.

7. Code summary

CodeCategoryRetry?
200Success — document detached—
400Client error (already no space or invalid document_id)No — fix the request first
401Authentication errorNo — fix credentials first
404Document not foundNo — fix document_id first
405Incorrect HTTP methodNo — use DELETE or POST
500Internal server errorYes, with caution

8. Best practices

  • This does not delete the document — it only removes it from the space. To delete it use DELETE /delete-document/{document_id}.
  • After detaching, the document no longer appears in that space's /space-context queries.
  • Always use the public claix.dev domain, not the direct Supabase URL.
  • Never ship your API key in frontend code or public repositories.

Request examples

curl -X DELETE "https://claix.dev/remove-document-from-space/d4a1e9d2-8b1c-4f3e-9a02-8b1e9f3c7a4b" \
  -H "x-api-key: <TU_API_KEY>"