Docs

API reference

Every operation and schema of the runtime API, generated from openapi/runtime.yaml.

/docs/api-reference.md

Memory for agents. Call decorate before every model call and submit what it returns; report the reply after.

Base URL: https://api.threadlessai.com/v1. Version 1.0.0. The raw spec is at /openapi/runtime.yaml.

Authenticate every request with a project key: Authorization: Bearer tl_live_… (or tl_test_…). Errors share one shape, Error, with a hint saying what to do about it.

Operations

OperationMethod and pathSummary
createMemoryPOST /memoriesCreate a memory: one per conversation.
getMemoryGET /memories/{memory_id}A memory's size and activity.
deleteMemoryDELETE /memories/{memory_id}Delete a memory and everything it holds. Cannot be undone.
decoratePOST /memories/{memory_id}/decorateBefore every model call: hand over what is new, get back the request to submit.
reportPOST /memories/{memory_id}/reportAfter the model replies: hand over the reply. Returns at once.
exportMemoryGET /memories/{memory_id}/exportEverything a memory holds: messages, episodes and facts.

createMemory

POST https://api.threadlessai.com/v1/memories

Create a memory: one per conversation.

Request body (optional): CreateMemoryRequest

StatusMeaningBody
201Created.Memory
400The request is malformed.Error
401The API key is missing or revoked.Error
404No memory with this id in this project.Error
429Too many requests, or the plan quota is used up.Error

getMemory

GET https://api.threadlessai.com/v1/memories/{memory_id}

A memory's size and activity.

ParameterInTypeRequired
memory_idpathstring ^mem_[A-Za-z0-9]{24}$yes
StatusMeaningBody
200The memory.Memory
400The request is malformed.Error
401The API key is missing or revoked.Error
404No memory with this id in this project.Error
429Too many requests, or the plan quota is used up.Error

deleteMemory

DELETE https://api.threadlessai.com/v1/memories/{memory_id}

Delete a memory and everything it holds. Cannot be undone.

ParameterInTypeRequired
memory_idpathstring ^mem_[A-Za-z0-9]{24}$yes
StatusMeaningBody
204Deleted and verified gone.none
400The request is malformed.Error
401The API key is missing or revoked.Error
404No memory with this id in this project.Error
429Too many requests, or the plan quota is used up.Error

decorate

POST https://api.threadlessai.com/v1/memories/{memory_id}/decorate

Before every model call: hand over what is new, get back the request to submit.

Returns the full request body for OpenAI: history with forgotten parts already out of view, remembered facts and recall in place, and the note ask when history is leaving. The Server-Timing header carries each step.

ParameterInTypeRequired
memory_idpathstring ^mem_[A-Za-z0-9]{24}$yes

Request body: DecorateRequest

StatusMeaningBody
200The request to submit.DecorateResult
400The request is malformed.Error
401The API key is missing or revoked.Error
404No memory with this id in this project.Error
429Too many requests, or the plan quota is used up.Error

report

POST https://api.threadlessai.com/v1/memories/{memory_id}/report

After the model replies: hand over the reply. Returns at once.

ParameterInTypeRequired
memory_idpathstring ^mem_[A-Za-z0-9]{24}$yes

Request body: ReportRequest

StatusMeaningBody
202Accepted; the work runs in the background.ReportResult
400The request is malformed.Error
401The API key is missing or revoked.Error
404No memory with this id in this project.Error
429Too many requests, or the plan quota is used up.Error

exportMemory

GET https://api.threadlessai.com/v1/memories/{memory_id}/export

Everything a memory holds: messages, episodes and facts.

ParameterInTypeRequired
memory_idpathstring ^mem_[A-Za-z0-9]{24}$yes
StatusMeaningBody
200The export.MemoryExport
400The request is malformed.Error
401The API key is missing or revoked.Error
404No memory with this id in this project.Error
429Too many requests, or the plan quota is used up.Error

Schemas

Error

FieldTypeRequiredDescription
errorobjectyes
error.code"invalid_request" or "unauthorized" or "forbidden" or "not_found" or "conflict" or "rate_limited" or "quota_exceeded" or "internal"yes
error.messagestringyes
error.hintstringnoWhat to do about it.

CreateMemoryRequest

FieldTypeRequiredDescription
metadatamap of string, at most 512noUp to 16 string pairs of your own, such as your conversation id.

DecorateRequest

FieldTypeRequiredDescription
format"chat.completions" or "responses"yesThe OpenAI API the request is for: Chat Completions (messages) or Responses (input items).
messagesarray of object or objectyesEverything new since the last call: the reply plus the user message, or the reply plus tool results. System and developer messages are the instructions: the latest set replaces the stored one and always leads the request.
messages[]objectA Chat Completions message, exactly as it would be sent to OpenAI.
messages[]objectA Responses input item (message, function_call, function_call_output, reasoning, …).
requestobjectyesThe rest of the request body as it would be sent to OpenAI (model, tools, tool_choice, temperature, instructions, …), without the history. previous_response_id and store are dropped.
request.modelstringyes

DecorateResult

FieldTypeRequiredDescription
requestobjectyesThe request body, ready to submit to OpenAI with your own key.
memoryobjectyes
memory.idstring ^mem_[A-Za-z0-9]{24}$yesA memory id, as POST /v1/memories returned it.
memory.revisionintegeryesIncreases with every change to the memory.
memory.turnintegeryesThe current user turn, counting from 1.
memory.notes_requestedbooleanyesTrue when this request asks the model for notes on history leaving live context. The model answers with the note tool.
memory.recalledintegeryesFacts and passages recalled into this request.
memory.facts_in_viewintegeryesRemembered facts shown in this request.
memory.tokensintegeryesOur estimate of the request size, in tokens.

Memory

FieldTypeRequiredDescription
idstring ^mem_[A-Za-z0-9]{24}$yesA memory id, as POST /v1/memories returned it.
object"memory"yes
created_atstring (date-time)yes
last_activity_atstring (date-time) or nullyes
metadatamap of stringyes
turnsintegeryes
messagesintegeryes
episodesobjectyes
episodes.liveintegeryesIn live context, messages and all.
episodes.sealedintegeryesMessages out of view; their facts still shown.
episodes.forgottenintegeryesOut of view entirely; held in long-term memory for recall.
factsintegeryes
bytesintegeryesStored size, the figure storage is billed on.

MemoryExport

FieldTypeRequiredDescription
memoryMemoryyes
messagesarray of objectyes
messages[].seqintegeryes
messages[].turnintegeryes
messages[].atstring (date-time)yes
messages[].itemobjectyes
episodesarray of objectyes
episodes[].idintegeryes
episodes[].state"live" or "leaving" or "sealed" or "forgotten"yes
episodes[].first_turnintegeryes
episodes[].last_turnintegeryes
episodes[].encoded_atstring (date-time)yes
episodes[].message_seqsarray of integeryes
factsarray of objectyes
facts[].idstringyes
facts[].textstringyes
facts[].entitiesarray of stringyes
facts[].milestonebooleanyes
facts[].written_by"model" or "system"yes
facts[].written_atstring (date-time)yes

ReportRequest

FieldTypeRequiredDescription
format"chat.completions" or "responses"yesThe OpenAI API the request is for: Chat Completions (messages) or Responses (input items).
replyobjectyesThe provider response, exactly as OpenAI returned it (usage included).

ReportResult

FieldTypeRequiredDescription
acceptedtrueyes
revisionintegeryes