> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stateset.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Add a knowledge-base document (near-duplicates update in place)

> The write result. action is updated when a near-duplicate document (at or above similarity_threshold) was updated in place instead of creating a new one…

### Request body

`object`

<ParamField body="knowledge" type="string" required />

<ParamField body="metadata" type="object" />

<ParamField body="force_create" type="boolean" />

### Response

`object`

<ResponseField name="object" type="string" required />

<ResponseField name="action" type="string" required />

<ResponseField name="point_id" type="string (uuid)" required>
  The knowledge document id (a Qdrant point id).
</ResponseField>

<ResponseField name="embedding_model" type="string" required>
  The embedding model used to (re)embed the text.
</ResponseField>

### Status codes

| Code  | Meaning                                                                                                                                                                                                                                        |
| ----- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `200` | The write result. `action` is `updated` when a near-duplicate document (at or above `similarity_threshold`) was updated in place instead of creating a new one; `force_create: true` always creates.                                           |
| `400` | Invalid request. `issues` names the offending field(s).                                                                                                                                                                                        |
| `401` | Missing, invalid, or expired API key.                                                                                                                                                                                                          |
| `403` | The key lacks a required scope.                                                                                                                                                                                                                |
| `409` | Conflict — either the creation ceiling was reached for this organization (`agent_limit_reached`), or a request with the same Idempotency-Key is still in flight (`idempotency_in_progress`); retry the latter after the first attempt settles. |
| `422` | The Idempotency-Key was already used with a DIFFERENT request body (`idempotency_key_reused`). Reuse a key only to retry the identical request.                                                                                                |
| `429` | Rate limit exceeded.                                                                                                                                                                                                                           |

### Access

|                |                        |
| -------------- | ---------------------- |
| Required scope | `knowledge:write`      |
| Rate limit     | 10 requests per minute |

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://response.stateset.com/api/v1/knowledge' \
    --header "Authorization: Bearer $RESPONSECX_API_KEY" \
    --header 'Content-Type: application/json' \
    --data '{
    "knowledge": "string",
    "metadata": {},
    "force_create": true
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "object": "knowledge.write_result",
    "action": "created",
    "point_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "embedding_model": "string"
  }
  ```
</ResponseExample>
