API reference For anything that cannot run rf. The CLI and the TypeScript SDK are thin layers over this, and this page is generated from the same contract they are, so it cannot drift from them.
Base address https://api.rentfree.dev/api. Every authenticated endpoint lives under /v1; only the health check, this document, and the login flow sit outside it. Bodies and answers are JSON. Timestamps are ISO 8601 in UTC. The OpenAPI 3.1 document is at /api/openapi.json , for generating a client in another language.
Authentication Authorization: Bearer rf_…A key is rf_ followed by 43 characters, and is shown once when made. A user-level key acts as the account; an agent key acts as one agent, within its permissions, and cannot manage the account. Every refusal is the same 401 body, so the answer does not say which check failed.
Writes are idempotent Every POST under /v1 that writes requires an Idempotency-Key header, any string up to 255 printable characters, remembered for 24 hours. A retry with the same key and the same body replays the first answer instead of running again. /search and /context are reads sent as POST because they have a body, and need none. The SDK and rf send the header themselves.
Errors An error is { error, issues? }, where issues is a list of { path, message } when a request field is at fault. Each endpoint below lists the codes it can answer.
Status error When 400 invalid_requestA field is missing or wrong; issues names each one. 401 unauthorizedNo key, a malformed key, a revoked key, or a deleted account. 403 access_deniedThe login was denied in the browser. 403 forbiddenThe key may not do this: an agent outside its permissions, or an agent key on an account endpoint. 404 not_foundNot the caller's, or does not exist; the two are not told apart. 409 collection_archivedA write into an archived collection, or making one the default. 409 collection_defaultThe default collection cannot be archived. 409 embed_model_in_useThe account has content, so its model is fixed. 409 idempotency_key_in_progressThe same Idempotency-Key while its first request is still running. 409 ingest_in_progressReading a source again while it is still being read. 409 memory_expiredRestoring a memory that expired; it stays expired. 409 memory_inactiveChanging a memory that is archived or expired. 409 name_takenAnother active collection has that name. 409 not_a_text_sourceReplacing the text of a url or file source. 409 not_refreshableRefreshing a source that is not a url. 409 session_endedAn event for a session that has ended. 409 source_kind_mismatchAdding a source under an external id a source of another kind has. 409 source_not_readyThe content of a source that is not ready yet. 410 device_session_expiredThe login's ten minutes passed, or its key was already handed out. 422 idempotency_key_reusedThe same Idempotency-Key with a different request. 429 rate_limitedToo many login sessions from one address in an hour. 429 slow_downPolled a login faster than its interval. 500 internalA fault on our side; it has been reported.
Endpoints memories What an agent should remember.
POST /v1/memoriesWrite a memory. Any key.
Body collectionIdstringnot empty typestringnot empty tier"working" | "long"contentstringat most 20000 characters subject?string | nullimportance?number0 to 1 expiresAt?timestamp
Answers 201 Created: Memory 400 invalid_request401 unauthorized403 forbidden404 not_found409 collection_archived, idempotency_key_in_progress422 idempotency_key_reused500 internalGET /v1/memoriesMemories in a collection, newest first. Any key.
Parameters collectionIdquery, string not empty status?query, "active" | "archived" | "expired" default "active" limit?query, integer 1 to 100; default 20 cursor?query, string not empty
Answers 200 OK: MemoryPage 400 invalid_request401 unauthorized403 forbidden404 not_found500 internalGET /v1/memories/{id}One memory. Any key.
Parameters Answers 200 OK: Memory 400 invalid_request401 unauthorized403 forbidden404 not_found500 internalPATCH /v1/memories/{id}Correct a memory, or archive or restore it. Any key.
Parameters Body content?stringat most 20000 characters subject?string | nullimportance?number0 to 1 status?"active" | "archived"
Answers 200 OK: Memory 400 invalid_request401 unauthorized403 forbidden404 not_found409 collection_archived, memory_expired, memory_inactive500 internalDELETE /v1/memories/{id}Archive a memory; its history and sources stay. Any key.
Parameters Answers 200 OK: Memory 400 invalid_request401 unauthorized403 forbidden404 not_found409 collection_archived500 internalGET /v1/memories/{id}/historyEvery change to a memory, newest first. Any key.
Parameters idpath, string not empty limit?query, integer 1 to 100; default 50
Answers 200 OK: object400 invalid_request401 unauthorized403 forbidden404 not_found500 internalGET /v1/memories/{id}/sourcesWhere a memory came from. Any key.
Parameters Answers 200 OK: object400 invalid_request401 unauthorized403 forbidden404 not_found500 internalrecall Search and the context pack.
POST /v1/searchFind memories and passages by meaning and by words. Any key.
Body querystringat most 2000 characters collectionIds?string[]1 to 50 items kinds?"memory" | "chunk"[]at least 1 items; default ["memory","chunk"] types?string[]1 to 20 items tiers?string[]1 to 20 items asOf?timestamplimit?integer1 to 50; default 10
Answers 200 OK: SearchResult 400 invalid_request401 unauthorized403 forbidden404 not_found409 collection_archived500 internalPOST /v1/contextA context pack: what an agent needs for its next turn, within a budget. Any key.
Body collectionIdstringnot empty query?stringat most 2000 characters tokenBudget?integer200 to 16000; default 2000
Answers 200 OK: ContextPack 400 invalid_request401 unauthorized403 forbidden404 not_found409 collection_archived500 internalGET /v1/collections/{id}/profileA collection's latest profile. Any key.
Parameters Answers 200 OK: Profile 400 invalid_request401 unauthorized403 forbidden404 not_found409 collection_archived500 internalGET /v1/index/statusHow much content is still waiting to be embedded. Any key.
Answers sessions Logging what happens, as it happens.
POST /v1/sessionsStart a session, or find the one with this externalId. Any key.
Body collectionId?stringnot empty externalId?stringat most 200 characters title?stringat most 500 characters
Answers 200 OK: Session 201 Created: Session 400 invalid_request401 unauthorized403 forbidden404 not_found409 collection_archived, idempotency_key_in_progress422 idempotency_key_reused500 internalGET /v1/sessionsSessions in a collection, newest first. Any key.
Parameters collectionIdquery, string not empty externalId?query, string at most 200 characters limit?query, integer 1 to 100; default 20 cursor?query, string not empty
Answers 200 OK: SessionPage 400 invalid_request401 unauthorized403 forbidden404 not_found500 internalGET /v1/sessions/{id}One session. Any key.
Parameters Answers 200 OK: Session 400 invalid_request401 unauthorized403 forbidden404 not_found500 internalPATCH /v1/sessions/{id}Retitle a session, or end it, which starts a recap. Any key.
Parameters Body title?string | nullended?true
Answers 200 OK: Session 400 invalid_request401 unauthorized403 forbidden404 not_found409 collection_archived500 internalPOST /v1/sessions/{id}/eventsLog one event, or a batch of up to 100, all or none. Any key.
Parameters Body One of:
eventsobject[]1 to 100 items
or:
type"message.user" | "message.assistant" | "tool.call" | "tool.result" | "note"contentstringat most 100000 characters metadata?objectdefault {}
Answers 201 Created: object400 invalid_request401 unauthorized403 forbidden404 not_found409 collection_archived, idempotency_key_in_progress, session_ended422 idempotency_key_reused500 internalGET /v1/sessions/{id}/eventsA session's events, oldest first. Any key.
Parameters idpath, string not empty limit?query, integer 1 to 100; default 20 cursor?query, string not empty
Answers 200 OK: EventPage 400 invalid_request401 unauthorized403 forbidden404 not_found500 internalsources Documents, URLs, and files.
POST /v1/sourcesAdd text, a URL, or an uploaded file; under an external id the collection already has, update that source. Any key.
Body One of:
kind"text"contentstringtitle?string | nullformat?"markdown" | "text"collectionId?stringnot empty uri?stringat most 2000 characters externalId?stringat most 500 characters metadata?objectdefault {}
or:
kind"url"urlstringat most 2000 characters title?string | nullcollectionId?stringnot empty externalId?stringat most 500 characters metadata?objectdefault {}
or:
kind"file"blobKeystringat most 1000 characters title?string | nullcollectionId?stringnot empty externalId?stringat most 500 characters metadata?objectdefault {}
Answers 200 OK: Source 201 Created: AddedSource 202 Accepted; the work continues in the background: Source 400 invalid_request401 unauthorized403 forbidden404 not_found409 collection_archived, idempotency_key_in_progress, ingest_in_progress, source_kind_mismatch422 idempotency_key_reused500 internalGET /v1/sourcesSources in a collection, newest first. Any key.
Parameters collectionIdquery, string not empty externalId?query, string at most 500 characters limit?query, integer 1 to 100; default 20 cursor?query, string not empty
Answers 200 OK: SourcePage 400 invalid_request401 unauthorized403 forbidden404 not_found500 internalGET /v1/sources/{id}One source, with its ingest status. Any key.
Parameters Answers 200 OK: Source 400 invalid_request401 unauthorized403 forbidden404 not_found500 internalPUT /v1/sources/{id}Replace a text source; unchanged content is a no-op. Any key.
Parameters Body contentstringtitle?string | nullformat?"markdown" | "text"
Answers 200 OK: Source 400 invalid_request401 unauthorized403 forbidden404 not_found409 collection_archived, not_a_text_source500 internalDELETE /v1/sources/{id}Remove a source and its chunks. Any key.
Parameters Answers 204 Done; no body400 invalid_request401 unauthorized403 forbidden404 not_found409 collection_archived500 internalGET /v1/sources/{id}/contentA ready source's text. Any key.
Parameters Answers 200 OK: object400 invalid_request401 unauthorized403 forbidden404 not_found409 source_not_ready500 internalGET /v1/sources/{id}/chunksA source's chunks, in document order. Any key.
Parameters idpath, string not empty level?query, "document" | "section" | "paragraph" limit?query, integer 1 to 200; default 50 cursor?query, string not empty
Answers 200 OK: ChunkPage 400 invalid_request401 unauthorized403 forbidden404 not_found500 internalPOST /v1/sources/{id}/refreshFetch a URL source again. Any key.
Parameters Answers 202 Accepted; the work continues in the background: Source 400 invalid_request401 unauthorized403 forbidden404 not_found409 collection_archived, idempotency_key_in_progress, ingest_in_progress, not_refreshable422 idempotency_key_reused500 internalPOST /v1/uploadsGet a short-lived URL to PUT a file to, before adding it. Any key.
Body filenamestringat most 255 characters contentType"application/pdf" | "text/markdown" | "text/plain"sizeinteger1 to 20971520
Answers 201 Created: Upload 400 invalid_request401 unauthorized409 idempotency_key_in_progress422 idempotency_key_reused500 internalrecap Turning events into memories.
POST /v1/recap/runStart a recap of the events not yet read. Any key.
Answers 200 OK: RecapRunAnswer 202 Accepted; the work continues in the background: RecapRunAnswer 400 invalid_request401 unauthorized403 forbidden409 idempotency_key_in_progress422 idempotency_key_reused500 internalGET /v1/recap/runsRecap runs, newest first. Any key.
Parameters limit?query, integer 1 to 100; default 20
Answers 200 OK: object400 invalid_request401 unauthorized403 forbidden500 internalGET /v1/recap/runs/{id}One recap run. Any key.
Parameters Answers 200 OK: RecapRun 400 invalid_request401 unauthorized403 forbidden404 not_found500 internalaccount Collections, agents, and keys.
GET /v1/meThe user, the key in use, and what it can see. Any key.
Answers 200 OK: Me 401 unauthorized404 not_found500 internalPATCH /v1/meChoose the embedding model, while the account has no content. A user-level key.
Body embedModelstringnot empty embedDimensions?integer | null
Answers 200 OK: User 400 invalid_request401 unauthorized403 forbidden404 not_found409 embed_model_in_use500 internalDELETE /v1/meDelete the account; every key stops at once. A user-level key.
Answers 200 OK: object401 unauthorized403 forbidden404 not_found500 internalGET /v1/collectionsCollections; an agent sees the active ones it may read. Any key.
Parameters status?query, "active" | "archived" default "active"
Answers 200 OK: object400 invalid_request401 unauthorized403 forbidden500 internalPOST /v1/collectionsMake a collection. A user-level key.
Body namestringat most 100 characters
Answers 201 Created: Collection 400 invalid_request401 unauthorized403 forbidden409 idempotency_key_in_progress, name_taken422 idempotency_key_reused500 internalPATCH /v1/collections/{id}Rename a collection, or make it the default. A user-level key.
Parameters Body name?stringat most 100 characters isDefault?boolean
Answers 200 OK: Collection 400 invalid_request401 unauthorized403 forbidden404 not_found409 collection_archived, name_taken500 internalDELETE /v1/collections/{id}Archive a collection: still readable, nothing new goes in. A user-level key.
Parameters Answers 200 OK: Collection 400 invalid_request401 unauthorized403 forbidden404 not_found409 collection_default500 internalGET /v1/agentsAgents, live by default. A user-level key.
Parameters status?query, "active" | "revoked" default "active"
Answers 200 OK: object400 invalid_request401 unauthorized403 forbidden500 internalPOST /v1/agentsMake an agent with its permissions. A user-level key.
Body namestringat most 100 characters canReadMemoriesbooleancanWriteMemoriesbooleanreadCollectionIdsstring[]at most 100 items writeCollectionIdsstring[]at most 100 items
Answers 201 Created: Agent 400 invalid_request401 unauthorized403 forbidden409 idempotency_key_in_progress422 idempotency_key_reused500 internalPATCH /v1/agents/{id}Change an agent's name or permissions. A user-level key.
Parameters Body name?stringat most 100 characters canReadMemories?booleancanWriteMemories?booleanreadCollectionIds?string[]at most 100 items writeCollectionIds?string[]at most 100 items
Answers 200 OK: Agent 400 invalid_request401 unauthorized403 forbidden404 not_found500 internalDELETE /v1/agents/{id}Revoke an agent and every key it holds. A user-level key.
Parameters Answers 200 OK: object400 invalid_request401 unauthorized403 forbidden404 not_found500 internalGET /v1/keysKeys, live by default; never the secret. A user-level key.
Parameters status?query, "active" | "revoked" default "active"
Answers 200 OK: object400 invalid_request401 unauthorized403 forbidden500 internalPOST /v1/keysMint a key; the secret is in this answer only. A user-level key.
Body namestringat most 100 characters agentId?stringnot empty
Answers 201 Created: CreatedKey 400 invalid_request401 unauthorized403 forbidden409 idempotency_key_in_progress422 idempotency_key_reused500 internalDELETE /v1/keys/{id}Revoke a key. A user-level key.
Parameters Answers 200 OK: Key 400 invalid_request401 unauthorized403 forbidden404 not_found500 internallogin The browser login the CLI runs.
POST /auth/deviceStart a login; the CLI shows the code and opens the page. No key.
Body namestringat most 100 characters
Answers 201 Created: LoginStarted 400 invalid_request429 rate_limited500 internalPOST /auth/device/pollAsk whether the browser has approved; the key comes back once. No key.
Body deviceCodestringnot empty
Answers 200 OK: LoginPoll 400 invalid_request403 access_denied404 not_found410 device_session_expired429 slow_down500 internalGET /auth/device/{userCode}What the approval page shows about a login. A browser session.
Parameters userCodepath, string not empty
Answers 200 OK: DeviceSession 400 invalid_request401 unauthorized404 not_found500 internalPOST /auth/device/approveApprove or deny a login; a first approval creates the account. A browser session.
Body userCodestringat most 20 characters decision"approve" | "deny"
Answers 200 OK: object400 invalid_request401 unauthorized403 forbidden404 not_found500 internalLiveness.
GET /healthWhether the api and its database are up. No key.
Answers 200 OK: Health 500 internal503 The database is unreachableGET /openapi.jsonThis document. No key.
Answers Schemas AddedSourceidstringcollectionIdstringkind"text" | "url" | "file"status"pending" | "processing" | "ready" | "failed"titlestring | nulluristring | nullexternalIdstring | nullformat"markdown" | "text"metadataobjecterrorstring | nullversioninteger-9007199254740991 to 9007199254740991 createdAttimestampupdatedAttimestampduplicateOf?object
AgentidstringnamestringcanReadMemoriesbooleancanWriteMemoriesbooleanreadCollectionIdsstring[]writeCollectionIdsstring[]createdAttimestamprevokedAttimestamp | null
ChunkidstringparentIdstring | nulllevel"document" | "section" | "paragraph"ordinalinteger-9007199254740991 to 9007199254740991 headingPathstring | nullcontextHeaderstring | nulltextstringtokenCountinteger-9007199254740991 to 9007199254740991 charStartinteger-9007199254740991 to 9007199254740991 charEndinteger-9007199254740991 to 9007199254740991
ChunkHitidstringtextstringheadingPathstring | nullsourceobjectscorenumbervectorRankinteger | nulltextRankinteger | null
ChunkPageitemsChunk []nextCursorstring | null
CollectionidstringnamestringisDefaultbooleancreatedAttimestamparchivedAttimestamp | null
ContextPacktextstringtokenCountinteger-9007199254740991 to 9007199254740991 tokenBudgetinteger-9007199254740991 to 9007199254740991 mode"hybrid" | "text" | "importance"profileobject | nullmemoriesobject[]chunksChunkHit []
CreatedKeyidstringnamestring | nullkeyPrefixstringagentIdstring | nullcreatedAttimestamplastUsedAttimestamp | nullrevokedAttimestamp | nullapiKeystring
DeviceSessionuserCodestringnamestringstatus"pending" | "approved" | "denied" | "claimed" | "expired"createdAttimestampexpiresAttimestamp
Errorerrorstringissues?object[]
Eventidinteger-9007199254740991 to 9007199254740991 sessionIdstringagentIdstring | nulltype"message.user" | "message.assistant" | "tool.call" | "tool.result" | "note"contentstringmetadataobjectcreatedAttimestamp
EventPageitemsEvent []nextCursorstring | null
HealthIndexStatuswaitinginteger-9007199254740991 to 9007199254740991 failedinteger-9007199254740991 to 9007199254740991 oldestWaitingAttimestamp | null
Keyidstringnamestring | nullkeyPrefixstringagentIdstring | nullcreatedAttimestamplastUsedAttimestamp | nullrevokedAttimestamp | null
LoginPollOne of:
or:
status"approved"apiKeystringkeyPrefixstringuserobjectdefaultCollectionIdstring | null
LoginStarteddeviceCodestringuserCodestringverifyUrlstringexpiresIninteger-9007199254740991 to 9007199254740991 intervalinteger-9007199254740991 to 9007199254740991
MeMemoryidstringcollectionIdstringtypestringtierstringoriginstringstatus"active" | "archived" | "expired"subjectstring | nullcontentstringconfidencenumberimportancenumberimportanceNownumberversioninteger-9007199254740991 to 9007199254740991 validFromtimestampvalidTotimestamp | nullsupersedesIdstring | nullaccessCountinteger-9007199254740991 to 9007199254740991 lastAccessedAttimestamp | nullcreatedAttimestampupdatedAttimestampexpiresAttimestamp | null
MemoryChangeidinteger-9007199254740991 to 9007199254740991 opstringactorstringreasonstring | nullbeforeobject | nullafterobject | nullrecapRunIdstring | nullcreatedAttimestamp
MemoryHitidstringcollectionIdstringtypestringtierstringsubjectstring | nullcontentstringimportancenumbervalidFromtimestampcreatedAttimestampscorenumbervectorRankinteger | nulltextRankinteger | null
MemoryPageitemsMemory []nextCursorstring | null
MemorySourcesourceIdstring | nullchunkIdstring | nulleventIdinteger | nullsessionIdstring | nullquotestring | nullcreatedAttimestamp
OpenApiDocumentopenapi"3.1.0"infoobjectpathsobject
ProfilecollectionIdstringversioninteger-9007199254740991 to 9007199254740991 contentstringtokenCountinteger-9007199254740991 to 9007199254740991 generatedAttimestamp
RecapRunidstringtriggerstringstatusstringeventsFromIdinteger-9007199254740991 to 9007199254740991 eventsToIdinteger-9007199254740991 to 9007199254740991 extractModelstring | nullreconcileModelstring | nullinputTokensinteger | nulloutputTokensinteger | nullcostUsdnumber | nullstatsobjecterrorstring | nullstartedAttimestampfinishedAttimestamp | null
RecapRunAnswerOne of:
or:
or:
status"started"unreadinteger-9007199254740991 to 9007199254740991
SearchResultSessionidstringcollectionIdstring | nullagentIdstring | nullexternalIdstring | nulltitlestring | nullstartedAttimestampendedAttimestamp | null
SessionPageitemsSession []nextCursorstring | null
SourceidstringcollectionIdstringkind"text" | "url" | "file"status"pending" | "processing" | "ready" | "failed"titlestring | nulluristring | nullexternalIdstring | nullformat"markdown" | "text"metadataobjecterrorstring | nullversioninteger-9007199254740991 to 9007199254740991 createdAttimestampupdatedAttimestamp
SourcePageitemsSource []nextCursorstring | null
UploadblobKeystringuploadUrlstringmethod"PUT"headersobjectexpiresAttimestamp
Useridstringemailstring | nullembedModelstringembedDimensionsinteger | nullcreatedAttimestamp