---
title: "Correct Fact"
method: PATCH
path: "/v1/facts/{fact_id}"
tags: ["v1"]
---

# Correct Fact

`PATCH /v1/facts/{fact_id}`

## Request

- Base URL: `https://api.korely.ai`
- URL: `https://api.korely.ai/v1/facts/{fact_id}`
- Auth: HTTP bearer

Supersede a fact with a corrected one. Both stay readable.

Not a mutation: the old row keeps its dates and gains an `invalidated_by`
pointing at the new one, so `as_of` before the correction still returns what
you believed then. A store that edits a row in place cannot answer "what did
we think in June", and answering that is the product.

## Path parameters

- `fact_id` string, required

## Request body

- CorrectBody: Superseding a fact with corrected values. At least one field.
  - `subject` string, nullable
  - `predicate` string, nullable
  - `object` string, nullable

## Response `200`

Successful Response

- FactWriteResponse: The write shape of POST /v1/facts (and the facts[] inline on a memory write): the new fact + the ids it superseded.
  - `id` string, required
  - `subject` string, required
  - `predicate` string, required
  - `object` string, required
  - `predicate_family` string, nullable
  - `valid_from` string, nullable
  - `invalidated` string[]
  - `tense` string, nullable
  - `invalid_at` string, nullable
  - `observation_count` integer
  - `user_id` string, nullable
  - `agent_id` string, nullable

## Other responses

- `401`: `invalid_key`: the `Authorization: Bearer` key is missing, unknown, revoked or expired.
- `403`: `forbidden`: the key lacks the scope this operation needs; `message` names it.
- `404`: `not_found`: nothing with that id is reachable with this key.
- `409`: `fact_not_current`: the fact is history (superseded, forgotten or ended); `current_fact_id` is the fact in force to correct instead, null when nothing took the fact's place, and the message says the same in words.
- `413`: `payload_too_large`: the body is larger than 2,097,152 bytes, the most this route takes. Refused before it is read; nothing was done.
- `422`: `invalid_request`: the body, a query parameter or a path parameter is malformed (`detail` is the list of fields that failed, `message` names the first), or the endpoint refuses a value (an empty content, an unreadable timestamp; `detail` is a sentence or `{code, message}`).
- `429`: `rate_limit_exceeded`: past the request ceiling, the per-minute one set on this install (`RATE_LIMIT_PER_MINUTE`) or, on the hosted service, the plan's minute, hour or day; `message` names the window and `Retry-After` the seconds until it resets. On this service also `quota_exceeded`: the plan's writes of the month are spent (`limit`, `used`, `resets_at`, and no `Retry-After`: a retry fails until `resets_at`, a top-up or a bigger plan).
- `500`: `internal_error`: the server failed on this request; `message` holds no detail of it.
- `503`: `model_unavailable`: a model the write needs (the one that resolves relations, or the contradiction check) gave no usable answer. Nothing was written; retry. A new fact whose own embedding fails is written anyway, and its vector is computed later by the worker.

---

[API](https://skmtc.dev/korely/apis/korely-agents-api.md) · [All operations](https://skmtc.dev/korely/apis/korely-agents-api/llms.txt) · [OpenAPI document](https://skmtc.dev/korely/apis/korely-agents-api/revisions/8a40bf09eca1?raw)
