Korely

Reference

Administration API

The /admin routes manage the account around the memory: its keys, projects and webhooks, and a read of what it holds. The dashboard calls them, and so can a script.

The memory itself (write, search, context, facts) is the /v1 API. Where it is. On the Cloud, /admin is at https://agent.korely.ai, the address of the dashboard: api.korely.ai sends it elsewhere. On a Self-hosted install it is at the install's own address, the one its /v1 routes answer at.

A script calls /admin with Authorization: Bearer <key> (a Cloud key starts with kor_live_, a Self-hosted one with kor_self_) and a key that has the admin permission: an ordinary key gets 403 forbidden. Make such a key only for the script that needs it, and never put it in a tool that runs a model (a coding assistant's MCP client, for example): it can manage keys and projects. A read of memories or facts made through /admin with an admin key counts against the month's quota as a /v1 read does; the person signed in to the dashboard, looking at their own account, does not count. Signing in to the dashboard (POST /admin/session) is the dashboard's own and is not served on the Cloud. These routes are not in the OpenAPI file of the /v1 API.

Errors

The body is the same envelope as on /v1 (code and message). What the codes mean on /admin (Korely 1.0.31):

StatusCodeMeaning
400bad_requestA well-formed value that something outside the request refused: a webhook URL that resolves where the server does not connect, a model key the provider refused.
401invalid_keyNo session or key, or one that is unknown, revoked or expired.
403forbiddenA key without the admin permission. previous_secret_has_no_admin: the old secret of a rotated key (since 1.0.26). On the model routes, set_by_the_service and install_admin_only (see Model settings).
404not_foundNothing with that id in this account: malformed, or another account's.
409the case, or conflictThe change is refused as the account stands: project_name_taken, project_archived, cannot_archive_default, project_has_live_keys, project_region_differs, cannot_delete_default, connected_app_key, key_not_rotatable, too_many_endpoints, too_many_keys, too_many_names, too_many_projects, endpoint_disabled, fact_not_current (with current_fact_id).
422invalid_requestThe body or a parameter is malformed, or is a value the route does not take (an unknown permission or event name, an empty list).
429rate_limit_exceededSee Retry-After. Also while the account already has two webhook tests or address checks under way.
500internal_errorThe server failed on this request.
503unavailableA dependency is missing or did not answer; message says which.

Keys

A key made on the dashboard lasts 90 days unless you pick another length. The API keys page starts the length field at 90 days. On the Cloud it offers 30, 60, 90 and 180 (a Self-hosted install also offers Never expires); the Expires column shows the date. After that date the key is refused like any key that is not live: the client gets a 401, with the same words for an expired, revoked and unknown key, and the memory stops answering. Nothing in the editor warns you. To avoid it, rotate the key before the date: press Rotate on the key (the button is in the dashboard of 1.0.27 and later; before that, call POST /admin/keys/{key_id}/rotate), copy the new secret (it is shown once) and paste it where the old one is. An expired key cannot be rotated: make a new key instead. The old secret keeps working for a while you choose (24 hours by default), so the editor does not break in between. Each answer of the API carries the date in the header Korely-Key-Expires-At, and the webhooks key.expiring (14 days before) and key.expired tell it too. Key lifetime and rotation has the rules.

RouteWhat it does
GET /admin/keysThe account's keys, revoked ones included, a page at a time. last_used_at is the key's latest use (written at most once a minute).
POST /admin/keysMake a key. The secret is in this answer and never again. project_id binds it to a project (left out: the default one); scopes left out are the default ones, without admin; users confines it to some end users. 409 too_many_keys past the account's limit.
GET /admin/keys/lifetimesThe lengths the dashboard offers when a key is made, and the default (Key lifetime and rotation).
POST /admin/keys/{key_id}/rotateA new secret for the same key; the old one keeps working old_key_expires_in_hours (24 by default, at most 168).
POST /admin/keys/{key_id}/revokeFrom this moment every call with the key is a 401. It stays in the list with revoked_at.
POST /admin/keys/{key_id}/movePut the key in another project: from its next call it reads and writes there. 409 connected_app_key for the key of an app connected over OAuth, which stays in its own project.
GET /admin/scopesThe permissions a key can have, with what each opens. Needs no key.

Projects

RouteWhat it does
GET /admin/projectsThe account's projects, the default one first, each with its region and how many live keys it holds. Archived ones only with include_archived=true.
POST /admin/projectsMake a project: a wall inside the account. region is eu or global and decides where a model reads its memories; left out, on the Cloud the project is Global. 409 too_many_projects past the limit.
GET /admin/projects/{project_id}One project, with its region and where its memories are read now (processing_region).
PATCH /admin/projects/{project_id}Rename it, change its description or its region. A new region is used from the next write: no fact is extracted again.
POST /admin/projects/{project_id}/archive, /unarchiveHide a project from the lists without losing anything, and bring it back. 409 for the default project and for a project with live keys. An archived project takes no new key.
DELETE /admin/projects/{project_id}Delete a project. What it remembered (memories, facts, aliases, audit rows, queued batches) moves to the default project, and so do its keys, except the keys of apps connected over OAuth, which are revoked (apps_disconnected counts them). An alias whose name the default project decided differently is not moved (aliases_not_moved counts it). The project's webhook endpoints are deleted with it, with their secrets and the deliveries still waiting; an endpoint of no project stays. With ?erase=true nothing moves: every memory and fact the project held is physically deleted, history included, and an erasure audit row is filed and returned as audit_id; its keys still move, except a key confined to end users that were all erased, which is revoked (keys_revoked). Erasure cannot be undone. A deletion never changes a project's region: 409 project_region_differs, with nothing deleted, when the default project writes in another region and live keys would move or, without erase, any memory, fact or batch job would. Give the two the same region first. See Projects.

Webhooks

What the events carry is on Webhooks.

RouteWhat it does
GET /admin/webhooksThe endpoints, with how each has been behaving: failed attempts since its last accepted delivery, the last delivery and the last error. Never the secret.
GET /admin/webhooks/eventsThe events an endpoint can subscribe to.
POST /admin/webhooksAdd an endpoint. The service refuses an address that resolves somewhere it should not reach. 409 too_many_endpoints past the account's number.
POST /admin/webhooks/{endpoint_id}/testSend one delivery now and say what came back. 409 endpoint_disabled for a switched-off endpoint.
POST /admin/webhooks/{endpoint_id}/enableSwitch a disabled endpoint back on, its address checked again and its failures forgotten. An endpoint is switched off after a delivery spent its ten attempts, about three days, with nothing accepted since.
DELETE /admin/webhooks/{endpoint_id}Delete an endpoint: nothing more is delivered to it, and its secret is gone.

Reading the account

These routes read one project, or the whole account when no project is named. A read of a memory or of the audit trail is itself written to the audit trail.

RouteWhat it does
GET /admin/whoamiWho is asking and which account it is.
GET /admin/memoriesThe memories, newest first. days is the window; agent_id=__none__ picks the memories with no agent.
GET /admin/memories/countHow many memories it holds now: a number, no memory read.
GET /admin/memories/categoriesHow many memories produced a live fact in each predicate family.
GET /admin/memories/searchSearch with query. With project_id it finds what a key of that project would find (the Playground); without it, the whole account.
GET /admin/memories/{memory_id}One memory of any project: text, end user, agent, metadata, status, and every fact it asserted, the closed ones too, each with closed.
GET /admin/memories/{memory_id}/historyThe life of one memory in order: written, edited, each fact it produced and when that fact stopped being true, forgotten.
GET /admin/facts, GET /admin/facts/familiesThe facts as GET /v1/facts reads them, with known_as_of for what the store knew then; and the predicate families, in display order.
GET /admin/namespacesThe agent_ids written under, the most memories first, a page at a time. A namespace is a string the caller chose, so this is what the store has seen.
GET /admin/requests, /requests/summary, /requests/dailyThe recent calls on the memory, and their count by endpoint or by day over the last days days (1 to 400, 30 by default), from the audit trail. A call is a read or a write of the memory, whoever made it: a forget, an erase and a fact forgotten or corrected count as writes, from the dashboard too, and an admin key's reads through /admin count as reads. Not counted: the dashboard's own reads, and the administration (keys, settings, sign-in and sign-out), which is the audit log's.
GET /admin/audit, GET /admin/audit/readThe audit trail, newest first, with the filters of GET /v1/audit, plus the account's own events (a sign-in, a setting). /audit/read says what the ids of one event say now (a memory's text, a fact's line); a memory erased since comes back as null.

Changing and erasing

RouteWhat it does
DELETE /admin/memories/{memory_id}The same forget as DELETE /v1/memories/{id}, in any project of the account. With erase=true it erases for good, a memory forgotten earlier too. 404 for a memory forgotten already.
DELETE /admin/users/{end_user}/memoriesErase everything about one end user in every project of the account: the same erasure as DELETE /v1/users/{id}/memories, which a key makes in its own project only, because the same id in another project may be another person. Only an admin key, never a project key. 422 for an id that names an end user already erased. See Forget a user.
POST /admin/facts/{fact_id}/forgetTake a fact out of the current state. It stays in the history with the date it stopped being true, and as_of before that date still returns it.
PATCH /admin/facts/{fact_id}Supersede a fact with a corrected one; both stay readable. 409 fact_not_current for a fact that is history, with current_fact_id. 503 when a model the correction needs gave no usable answer: nothing is written.

Aliases and object links

RouteWhat it does
GET /admin/aliasesThe entity aliases ("Acme" is now "Globex"), newest first, at most 500; user_id narrows to one end user.
POST /admin/aliasesMerge alias into canonical in one memory: every fact of that memory is re-canonicalized at once. 409 on a cycle, on an alias already decided differently by hand, or too_many_names.
DELETE /admin/aliases/{alias_id}Remove an alias. It is not an undo: two open facts it had merged stay one row.
GET /admin/object-links, DELETE /admin/object-links/{link_id}The object links ("Italy" read as "Italia": one thing in two languages), newest first, at most 500; and undo one. A link never rewrote, merged or closed a fact, so deleting it changes nothing else.

Model settings

Which provider key and which model write the facts. These routes are for an install with a single account. On the Cloud every account gets 403 set_by_the_service on every /admin/provider and /admin/models route: the models and their key are the service's, for every account. On a Self-hosted install with more than one account, a key gets 403 install_admin_only: only the person named with manage grant-install-admin, signed in to the dashboard, sets them. None of these routes returns a key: only its last four characters.

RouteWhat it does
GET /admin/providerWhether a provider key is set, where it came from, and what it last did.
PUT /admin/providerCheck the key with the provider, then save it.
POST /admin/provider/testTry a key without saving it, or the one in force (an empty body means the one in force).
DELETE /admin/providerForget the key set from the screen; what the install's .env says takes over again.
GET /admin/modelsWhether a writer is configured, which one, and the providers the first-login screen offers.
POST /admin/models/{provider}/checkTry a key without saving it; the answer carries the provider's model list and the writer Korely suggests.
PUT /admin/models/{provider}Check the key with the provider, store the choice and put it in force.
DELETE /admin/modelsForget the screen's choice; what .env says writes again.

Others

  • DELETE /admin/session signs out the dashboard session it is called with. GET /admin/oauth/requests/{id} and its /approve and /deny are the consent page of an app that connects over OAuth: they work only for a person signed in to the dashboard, not for a key.
  • Other routes under /admin, for features this site does not document yet, are not listed here.
  • DELETE /admin/sessions ends every dashboard session of the operator asking, this one included ("Sign out of all devices"). A key has no sessions: it answers 409, revoke it instead.
  • GET /admin/usage is the model spend of an install of your own, by agent and by model. The Cloud answers 404.

See also