Korely

Core memory operations

Delete a memory

Forget one memory, or erase it with erase=true. Forgetting closes the facts only it stated: the memory drops out of every read, and its facts stay as bi-temporal history. An audit row is written.

DELETE /v1/memories/{memory_id}

SDK: korely.delete(memory_id). Forgetting a memory sets its deleted_at and closes (sets invalid_at on) the active facts that only this memory stated. A fact another memory also states stays active: it only loses this memory from source_memory_ids. Without erase the rows stay in the database. The memory's text no longer comes back from any endpoint (its history keeps the deleted event), and the facts it closed stay readable with as_of or include_invalidated=true on Get facts. To erase everything about an end user use Forget a user, which deletes the rows.

Authentication

HTTP header, required: Authorization: Bearer kor_live_.... The key must carry the memories:write scope.

Path parameter

This endpoint takes no request body.

ParameterTypeRequiredDescription
memory_idstringRequiredThe public memory id to forget (mem_ and 32 hex characters, or the bare UUID).

Query parameter

ParameterTypeRequiredDescription
erasebooleanOptionalDefault false. true erases the memory for good: the row, its text and vector, the facts only it stated, its item in a /v1/batch payload. A memory forgotten earlier can be erased too. The receipt then has status erased, erasure: "permanent" and facts_deleted. The SDKs' delete() does not send it: erasing one memory is REST only.

Example request

Terminal window
curl -X DELETE https://api.korely.ai/v1/memories/mem_8f2c1aab4d7e4f0c9a1b2c3d4e5f6a7b \
-H "Authorization: Bearer kor_live_..."

Response

200 OK. A small receipt confirming the forget, with how many facts were closed and the id of the audit row.

{
"id": "mem_8f2c1aab4d7e4f0c9a1b2c3d4e5f6a7b",
"status": "forgotten",
"facts_invalidated": 2,
"audit_id": "aud_5d3e9f0a1b2c4d6e8f9a0b1c2d3e4f5a"
}
FieldTypeDescription
idstringPublic memory id (mem_) that was forgotten.
statusstringforgotten, or erased with erase=true.
facts_invalidatedintegerFacts closed (invalid_at set) because this memory was their only source. 0 when the memory stated none, or when every fact it stated is also stated by another memory.
erasurestringOnly with erase=true: permanent.
facts_deletedintegerOnly with erase=true: the facts deleted because this memory was their only source.
audit_idstringPublic id of the audit row recording the forget (scope memory).

Errors

StatusCodeCause
401invalid_keyMissing or invalid kor_live_ key in the Authorization header.
403forbiddenThe key lacks the memories:write scope required to forget a memory.
404not_foundThe memory_id is malformed, or no such memory exists, or it was already deleted.
429rate_limit_exceededRate limit exceeded. Retry after the interval in the Retry-After header.

Notes

  • Forget by default. Without erase, the memory's deleted_at is set and the facts only it stated are closed (their invalid_at is set). Because Korely is bi-temporal, the rows are kept: the memory drops out of every read, and the closed facts stay reachable via as_of. With erase=true the rows are deleted.
  • Write scope required. The key must carry memories:write; a read-only key gets a 403.
  • The request is always logged. The call is recorded in the audit log before the not-found check runs, so even a forget against an unknown id leaves an event, with result error.
  • Idempotent-ish. A second delete of the same memory without erase returns 404, deleted_at is already set, so the memory is filtered out of the lookup. With erase=true a forgotten memory is erased.

Related