Published with v0.395.0
REST Agent Contract
The REST Agent Contract is the typed HTTP surface for advanced integrations. The checked-in OpenAPI 3.1 document is authoritative; its current independent contract version is 2.4.0. Use the production base URL https://mcp.atmina.ai and an OAuth bearer token delegated for that resource.
What 2.0.0 removed
Contract 2.0.0 is a breaking release. It removes the compiled-context surface that Atmina retired: the generated Current State, its promotion and the generated Knowledge Base summary. A client written for 1.x must change if it uses any of these:
GET /api/v1/kbs/{id}/context(getKnowledgeBaseContext),GET /api/v1/account/contextand the routine run promote route are deleted. They answer404. To find your way around a Knowledge Base, search it, read the best hit and follow its links.- Knowledge Base objects no longer carry
summaryorsummary_long. Use the Knowledge Base'sdescription. public_collectionno longer hasinclude_consolidated. A request that still sends it is refused with400, and_consolidated/is never published.- Agent definitions no longer have a
context_injectionsection. Sending one is refused with400; a definition stored with one reads without it. - The Knowledge Base content graph has only
linkedges. Thecitationedge and theedgequery parameter are gone.
Send Atmina-Agent-Contract-Version: 2.4.0 on a new keyed create or keyed run start. A client that sends an earlier version can replay a completed receipt but cannot start a new one.
Operations
| Purpose | Method and path |
|---|---|
| Deployed version | GET /version |
Caller identity (includes own lens KBs as monitor) | GET /api/v1/whoami |
| List your MCP installations | GET /api/v1/account/mcp-connections |
| Activate a device installation | POST /api/v1/account/mcp-connections/activate |
| Revoke one installation | DELETE /api/v1/account/mcp-connections/{grant_id} |
| List or create KBs | GET or POST /api/v1/kbs |
| Resolve a Qualified KB Ref | GET /api/v1/kbs/by-ref/{team_slug}/{kb_slug} |
| Read or update one KB | GET or PATCH /api/v1/kbs/{id} |
| Exhaustively list files | GET /api/v1/kbs/{id}/files |
| Search one KB | POST /api/v1/kbs/{id}/search |
| Search accessible KBs | POST /api/v1/search |
| List models | GET /api/v1/models |
Search results can include an app_url for opening the file in Atmina. It uses the KB's owning team when you belong to that team; external shares use an eligible viewing team. The URL does not grant access.
Anonymous published reads
Contract 1.13.0 added getPublishedKnowledgeBase and
readPublishedKnowledgeBaseFile. Omit Authorization to read a published KB:
curl https://mcp.atmina.ai/api/v1/published-kbs/atmina-system/guide
curl --get https://mcp.atmina.ai/api/v1/published-kbs/atmina-system/guide/file \
--data-urlencode 'path=help/rest-agent-contract.md'
Use exactly one path or file_id query parameter. The server resolves it
directly, without a client-side catalog listing. Paths are decoded once and
matched exactly. The response contains file_id, path, filename, mime_type,
and content_base64. Its sha256 and size_bytes describe the returned UTF-8
public text after projection. The strong HTTP ETag hashes the entire serialized
JSON response. Responses use Cache-Control: no-store; conditional 304 is not
supported.
These two endpoints always return the current public representation, including when an owner supplies a valid token. Missing, private, shared, deleted, and malformed KB references have the same 404 response. Missing or excluded files also receive a neutral 404. Asset bytes are unavailable; a published Companion can be read at its own text path. Historical versions, image/rendition selectors, duplicate selectors, and unknown query parameters are rejected with 400.
A supplied Authorization header must be a valid bearer credential, even if a
browser cookie is also present. Empty, malformed, invalid, expired, or revoked
credentials receive 401 with an OAuth challenge. A valid bearer without
mcp:read receives 403. Published reads are rate limited; an unavailable live
public collection receives 503.
Use the detail response's kb_id with the existing searchKnowledgeBase
operation, POST /api/v1/kbs/{id}/search, and {"query":"memory"}. Anonymous
search uses keyword retrieval over the current public collection and removes
private metadata. It rejects filters, retrieval, ranking, and strict.
A valid independent KB grant searches that caller's authorized collection.
Supplied bearer tokens retain the POST scope requirement of both mcp:read and
mcp:write; invalid credentials fail rather than falling back to anonymous.
Search may return 401 or 403 for authentication or access failures, 429 for rate
limits, and 503 when the public collection is unavailable.
The existing listKnowledgeBaseFiles operation remains available when a catalog
listing is wanted. This contract addition does not publish file history, raw
Asset downloads, public graph operations, or additional mutations.
Authenticated file reads and authoring
Contract 1.14.0 publishes exact authenticated file reads and mutations
(LAT-1343):
| Purpose | Method and path | operationId |
|---|---|---|
| Exact file view by path or file id | GET /api/v1/kbs/{id}/files/exact | getKnowledgeBaseFile |
| File byte download (rendition required) | GET /api/v1/kbs/{id}/files/{file_id}/content | getKnowledgeBaseFileContent |
| Create file (multipart) | POST /api/v1/kbs/{id}/files | createKnowledgeBaseFile |
| Replace file (multipart, optional If-Match) | PUT /api/v1/kbs/{id}/files/{file_id} | replaceKnowledgeBaseFile |
| Delete file | DELETE /api/v1/kbs/{id}/files/{file_id} | deleteKnowledgeBaseFile |
Capabilities: file.view for reads and downloads; file.write for create,
replace, and delete. A monitor grant (read-only lens) does not admit any of
these operations: reads and downloads treat it as no grant, and writes refuse
it. On a public Knowledge Base, a caller without a usable grant still gets the
same public reads an anonymous visitor gets. Supply exactly one of path or
file_id on the exact view route. file.sha256 from a view is the concurrency
token for If-Match on replace; a mismatch returns 412 with current_etag. Create and replace use
multipart/form-data with a file part (the existing private REST→DO contract).
Create and replace need an editor or admin grant; delete needs Knowledge Base
admin. File history and restore remain unpublished.
Contract 1.16.0 corrected how these writes behave, and 1.17.0 closes the
last gap in create:
- Create does not replace a file it finds. The part's filename becomes the
catalog path. A path that starts with
/or contains..anywhere (including a name such asa..b.md) is a 400, as it is forwrite_file. When an active file already holds the path, or a case variant of it (Notes.mdwhennotes.mdexists), create answers 409conflictwith that file'sfile_idandcurrent_etagand leaves it unchanged. The message names the path that file holds. - Concurrent creates on one path are atomic. From
1.17.0, exactly one of them gets 201 and every other gets the 409. A refused create keeps none of its bytes. - Replacing is a separate call. Replace a Markdown or plain-text file
(a
text/markdownortext/plainpart, at most 1 MiB) withIf-Match: <current_etag>. Replace refuses an HTML file and any other type with a 400. Those are replaced over MCP withrequest_uploadsinmode: "overwrite"withif_match. That replacement starts a new lineage: the file gets a newfile_id, and only its one prior body is kept, as version 1. - A Team that is out of credits gets 429 before the path is checked, so a repeated create can answer 429 rather than 409.
No file write accepts an Idempotency-Key yet; that waits on LAT-1342. Retry a
write whose response was lost like this:
| Operation | Recovery | What a repeat returns, and what it means |
|---|---|---|
| Create | none (not retry-safe) | 409 with file_id and current_etag. If current_etag equals the SHA-256 of the bytes you sent, a file with your bytes holds the path. That is most likely your earlier create, but it can be another writer's identical bytes. Any other value means a different file holds the path. |
| Replace | convergent | With the same If-Match: 412 with current_etag. If it equals the SHA-256 of the bytes you sent, your replace landed. Any other value means someone else wrote, so re-read before you retry. |
| Delete | convergent | 404 for the same file_id: the file is gone. |
Knowledge Base archive, restore, graph, and activity
Contract 1.15.0 publishes authenticated Knowledge Base lifecycle and read
projections (LAT-1343), stacked after file authoring 1.14.0:
| Purpose | Method and path | operationId | Capability |
|---|---|---|---|
| Archive (soft-delete) | DELETE /api/v1/kbs/{id} | archiveKnowledgeBase | kb.archive |
| Restore archived KB | POST /api/v1/kbs/{id}/restore | restoreKnowledgeBase | kb.restore |
| KB content graph | GET /api/v1/kbs/{id}/graph | getKnowledgeBaseGraph | kb.view |
| Recall/capture activity | GET /api/v1/kbs/{id}/activity | getKnowledgeBaseActivity | kb.view |
Graph and activity reuse kb.view and need a viewer, editor, or admin
grant on that Knowledge Base. A monitor grant (read-only lens) admits none of
the four operations; graph and activity refuse it with 403. Activity
counts only that Knowledge Base's events.
Archive and restore require owning-team admin at the shared service layer;
editors are refused with 403. Archive answers 403 for a Knowledge Base id that
is missing or already archived, because the access check runs first; it does
not answer 404. getKnowledgeBaseGraph is the KB content
graph (files and links), not getTeamGraph (Team access graph). File history
and restore remain unpublished.
Archive and restore are convergent on state, but a repeat does not return the first answer:
| Operation | What a repeat returns, and what it means |
|---|---|
| Archive | 403. An archived Knowledge Base is outside the live access check, so the second archive looks like an id you cannot reach. Look for it in GET /api/v1/teams/{id}/archived-kbs to confirm it is archived. |
| Restore | 404 with no receipt. Nothing archived is left with that id. Read it with GET /api/v1/kbs/{id} to confirm it is live, and note that its slug may have changed. |
Governance and audit operations
Contract 1.11.0 published Team and Knowledge Base governance reads plus audit (LAT-2282 / LAT-1344). Authorization follows the Team admin / Team member / read-only lens (monitor) matrix: share inventory and Team audit stay admin-only; KB audit admits editor+ and an active lens on that Knowledge Base; /whoami includes the caller’s own lens KBs as monitor entries; Team status denies lenses; health and graph scope lenses to reachable or monitored Knowledge Bases; settings read and archived listing are admin-only.
Query text inside audit rows is retained only when the Team’s write-time audit_query_text setting was on when the event was recorded. Readers do not get a separate redaction operation.
| Purpose | Method and path |
|---|---|
| KB share inventory | GET /api/v1/kbs/{id}/share |
| Team share inventory | GET /api/v1/teams/{id}/shares |
| Team audit list | GET /api/v1/teams/{id}/audit |
| KB audit list | GET /api/v1/kbs/{id}/audit |
| Audit event detail | GET /api/v1/teams/{id}/audit/events/{event_id} |
| Team status | GET /api/v1/teams/{id}/status |
| Team health | GET /api/v1/teams/{id}/health |
| Team access graph | GET /api/v1/teams/{id}/graph |
| Team settings read | GET /api/v1/teams/{id}/settings |
| Archived Knowledge Bases | GET /api/v1/teams/{id}/archived-kbs |
Sharing and settings mutations
Contract 1.12.0 publishes sharing mutations and the Team settings update (LAT-2283 / LAT-1344). Only a Knowledge Base admin may share, revoke, or cancel: a Team admin of the owning Team, or an outside collaborator holding an admin grant on that Knowledge Base. Team members below admin and read-only lens holders are refused with 403. Only an admin of that Team may update its settings.
| Purpose | Method and path |
|---|---|
| Share a KB with a person, a Team, or an email address | POST /api/v1/kbs/{id}/share |
| Revoke one share grant | DELETE /api/v1/kbs/{id}/share/{grant_id} |
| Cancel a pending email invitation | DELETE /api/v1/kbs/{id}/share/pending/{invitation_id} |
| Update Team settings | PATCH /api/v1/teams/{id}/settings |
A share names exactly one target (target_user_id, target_team_id, or email) and exactly one access level: access of read, write, admin, or monitor, or the web alias role of viewer, editor, admin, or monitor. A read-only lens (monitor) can only go to one person; a Team or email lens is refused with 400. Sharing to the owning Team restores “Everyone in the team”; revoking that grant makes the Knowledge Base “Selected people” only.
Every mutation is safe to repeat. Revoking a grant that is already revoked returns revoked: false, cancelling an invitation that is already cancelled returns cancelled: false, and re-sending the current settings returns an empty changed list. Cancelling an invitation that was already accepted returns 409; revoke the resulting grant instead. A grant or invitation that belongs to a different Knowledge Base is 404.
Use Qualified KB Refs such as acme/handbook when resolving a human-readable identity. Every response is projected for the caller, so an inaccessible ref can look absent.
curl -sS https://mcp.atmina.ai/api/v1/kbs \
-H 'Authorization: Bearer <oauth-access-token>'
Search uses JSON and returns ranked, file-grouped results:
curl -sS https://mcp.atmina.ai/api/v1/kbs/<kb_id>/search \
-H 'Authorization: Bearer <oauth-access-token>' \
-H 'Content-Type: application/json' \
--data '{"query":"customer data retention decision","max_files":5}'
For the single-Knowledge Base route, the path already selects the Knowledge Base. Do not send scope.kb_ids or scope.kb_slugs. Either field produces a 400 validation_error; the message names the rejected selector and details.issues lists each rejected dotted path. Other scope filters, including path_prefix and file_ids, remain available.
MCP installation lifecycle
Contract 1.8.0 added the installation lifecycle operations. Each connection is a Delegated Grant for one client installation, so two installations of the same client can be revoked independently. Bearer requests require mcp:read; activation and revocation also require mcp:write.
List your installations with GET /api/v1/account/mcp-connections. The response contains a connections array, newest first, with each installation's grant_id, client name, scopes, status, and activity timestamps. Status is pending, active, revoked, or replaced. Listing and revoking accept an OAuth bearer token or an Account session cookie; they operate only on your own installations. A change made with the session cookie, such as a revocation, is accepted only from the Atmina app itself. A script or another client revokes with a bearer token.
After device authorization returns its first bearer token, the client must call POST /api/v1/account/mcp-connections/activate with that token before using protected MCP or REST operations. This is the only route that accepts a pending installation. It returns { "grant": { ... }, "activated": true } when activation succeeds; repeating it for an already active grant returns activated: false. Browser-authorized installations are active immediately and do not need this step. A client should verify a protected read, such as GET /api/v1/whoami, before reporting a device connection as ready.
Revoke an installation by sending DELETE /api/v1/account/mcp-connections/{grant_id} with the ID from the list. A successful response is 204 with no body, including when that installation was already revoked. Its outstanding access tokens stop working and it cannot refresh them; your other installations keep their access. Another user's grant ID returns 404. You can also review and revoke these connections under Account → MCP connections.
Source and public content
Contract 1.9.0 adds public_collection to Knowledge Base configuration. Its folder_prefixes and include_sources fields let an owner explicitly widen the published collection; 2.0.0 removed include_consolidated. All additions default off. They change every public reading surface, including anonymous search, rather than granting search-only access. See Publish a Knowledge Base for the publication boundary.
Asset rows from GET /api/v1/kbs/{id}/files may include description_source: atmina assigns description ownership to Atmina, provider-native identifies a provider-owned conversion that cannot be read back or edited, and none means neither route describes the Asset. The field is absent from non-Asset rows and when provider context cannot be resolved. It does not confirm that generated text exists.
Search responses can add an asset object for picture results. Its path identifies the Asset while the result's own path and read_ref cite the Companion. Catalog-backed results may also include file_id, media facts, state and a thumbnail rendition_url; clients must accept the path-only form.
On the existing GET /api/v1/kbs/{id}/files/{file_id} endpoint, a public Companion read's content_base64 can contain the coordinate-safe public representation. representation.sha256 and representation.size_bytes identify those returned bytes; file.sha256 and file.size_bytes still identify the stored source. Do not use a projected-content digest as a source write precondition. Direct original-content downloads remain unavailable to public visitors; owning-Team members can download original Assets.
Safe mutations and recovery
For a retry-safe create, send a unique RFC 8941 Idempotency-Key of at most 128 decoded bytes and Atmina-Agent-Contract-Version: 2.4.0. Repeating the same completed request with that key returns the earlier logical result. Never reuse the key for different input.
Error-capable operations use { "error", "message", "details"? } as their fallback envelope, including failures whose status is not otherwise listed. A version conflict on an agent configuration update includes current_version and may include current. A rate-limit 429 uses { "error": "rate_limited", "retry_after_s", "scope" } and includes Retry-After; a credit-exhaustion 429 uses the fallback envelope and does not promise that header. Check error and schedule a retry from Retry-After only when the header is present.
A 401 includes a protected-resource challenge and requires a fresh OAuth grant. 403 means the authenticated caller lacks the operation's role. 404 can mean absent or deliberately hidden from this caller. Fix 400 input rather than retrying it.
For interactive clients, start with MCP authentication and connections.
