Context Window · Create space
Create a knowledge space
Endpoint
https://claix.dev/create-spaceA knowledge space is a logical folder for grouping persisted documents. This endpoint creates the empty space and returns its space_id, the piece that ties the whole flow together: group on extraction, ask the whole group, and delete it when you no longer need it.
The only input field is name. There is nothing else to configure: a space has no schema, no expiry, and no settings of its own.
Public URL: POST https://claix.dev/create-space. Never expose the direct Supabase URL.
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, and that the account is not suspended. Otherwise it returns 401. The space belongs to the account that owns the key, so only that account can use or delete it later.
2. Request format
Method: POST · Content-Type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Space name, for example “Suppliers 2026”. Max 200 characters. Leading and trailing whitespace is trimmed. |
Example body:
{
"name": "Proveedores 2026"
}Duplicate names are allowed: every call creates a new space with its own space_id. If you need unique names, check for them on your side before calling.
3. Building the call
- Send
POSTtohttps://claix.dev/create-spacewith your API key and a JSON body containingname. - Store the
space_idfrom the response in your database: you need it for the next two steps. - When extracting with any of the five extraction endpoints (or their Agent versions), add
space_idas an optional field so the saved document lands inside the space. Remember that a document is only saved when the schema has the context window enabled. - Ask the whole group with
POST /space-context/{space_id}.
4. Request examples
Use the code panel on the right to copy examples in cURL, JavaScript, Python, and more.
5. Success response format
HTTP 201 — Space created. The response returns the identifier, the stored name, and the creation timestamp.
{
"success": true,
"space": {
"space_id": "5b9e2c14-7d3a-4f8b-9e1c-6a0d4b8f2e7c",
"name": "Proveedores 2026",
"created_at": "2026-09-05T14:32:11.482Z"
}
}| Field | Type | Description |
|---|---|---|
| success | boolean | Always true in a 201 response. |
| space.space_id | string (uuid) | Space identifier. This is the value you send as space_id when extracting, and the one that goes in the space-context and delete-space URLs. |
| space.name | string | Stored name, already trimmed of surrounding whitespace. |
| space.created_at | string (ISO 8601) | Date and time the space was created. |
6. Error codes
{
"error": "Descripción legible del problema.",
"detalle": "Información técnica adicional (solo presente en algunos casos)."
}400 — The body is not a JSON object, or name is missing, empty, or longer than 200 characters.
401 — Authentication failed: key missing, unknown, disabled, or account not active.
405 — Method other than POST. · 500 — Internal error.
7. Code summary
| Code | Category | Retry? |
|---|---|---|
| 201 | Success — space created | — |
| 400 | Client error (name missing, empty, or too long) | No — fix the request first |
| 401 | Authentication error | No — fix credentials first |
| 405 | Incorrect HTTP method | No — use POST |
| 500 | Internal server error | Yes, with caution |
8. Best practices
- Create the space once and reuse its
space_id; do not create one on every extraction. - Use one space per real unit of work (a client, a case file, a quarter) rather than one giant space: cross-document answers get more precise the tighter the group is.
- Give spaces descriptive names — the name is all you have to identify them.
- Always use the public
claix.devdomain, not the direct Supabase URL. - Never ship your API key in frontend code or public repositories.