Before you start
- Docs must be enabled for your workspace. AGO enables Docs per workspace: ask AGO support to turn it on. Until then, every
/spacesendpoint answers403with the codedocs_disabled, the MCP server does not list the space tools, and calling one fails with the same code. Turning Docs off keeps your spaces, their pages and their access, but agents stop answering from them until it is on again. - Scopes:
knowledge:readto list, read and search spaces.knowledge:writeto create spaces and to change pages.knowledge:writeincludesknowledge:read. Create the key in Studio > API Keys. See API Key Authentication. - A scope is not enough. Each space decides who can use it, and at which level: see Access. A space you have no access to does not appear at all.
- Spaces are written in AGO. A source synced from another system (Zendesk, Confluence, SharePoint…) cannot become a space: its original stays the source of truth. Keep using the document endpoints and tools for those sources.
- A new space is internal and is not attached to any agent.
- Changes are attributed. Each version records the API key (its name and prefix) or the OAuth application that made it, and the user behind it: the key’s creator, or the user who granted OAuth access.
Access
Every space is closed by default: only the people and keys it was opened to can see it. Each one has a level:- Who has access. A space can be opened to everyone who uses Docs (admins and Docs members), to a permission group, or to a specific API key. The space’s owner has
writeaccess for as long as they are an admin or a Docs admin. When several of these apply to you, you get the highest level. - API keys only get what was granted to the key. A key does not inherit the access of the person who created it.
- OAuth applications act with the access of the user who connected them.
- The scope caps the level. With
knowledge:readonly, you read, whatever your level on the space. - Creating a space opens it to its creator. A space created with an API key gives that key
writeaccess; the key’s creator owns the space. Turning a source into a space works the same way. Nobody else sees the space until its access is changed. - Who creates spaces. Admins and Docs admins create spaces and turn sources into spaces. An API key with the
knowledge:writescope can do the same, and is givenwriteaccess to the space it creates. A Docs member who is neither an admin nor a Docs admin works only in the spaces opened to them. - Changing access happens in AGO, never through the API or MCP, so a key can never widen its own access. A space is managed by its owner and by Docs admins (super admins are always Docs admins): they open it, change levels, choose the agents that answer from it, rename it, hand it to another owner and delete it. Managing a space does not let you read it: a Docs admin reads a space only when it is opened to them. The owner must be an admin or a Docs admin. See Docs roles.
- Agents. An agent answers from a space only when the space’s manager has attached it to that agent, in the space’s settings. Attaching a space shares its content with everyone who can talk to the agent. Attaching needs a manager who can also configure agents, that is an admin; any manager can detach a space. The agent’s answers use the space’s pages without citing them or linking to them, and the agent’s settings show which spaces it answers from.
- Rotating an API key. The new key keeps the old key’s access to the spaces that the person rotating it manages. Access to other spaces is not carried over: ask their owner or a Docs admin to open them to the new key. The old key keeps its access until it stops working. AGO tells you how many space accesses were carried over and how many were not.
GET /spaces and list_spaces carries your level on it. A call that needs a higher level fails with 403 insufficient_space_access; the error gives the required_level and your level.
Addresses
A page is addressed as<space>/<path>, for example handbook/onboarding/first-week. The space name alone (handbook) is the space root.
- A space name is lowercase letters and digits separated by single
-or_, such asengineering-handbook. - Each path segment comes from the page title:
First Week!becomesfirst-week. A page whose title gives the same segment as a sibling’s gets a suffix (first-week-2). The response of every write gives the page’s actual address. - Renaming a page, or moving it to another parent, changes its address and the address of every page below it.
Operations
The Scope column is the API scope. The space level each operation needs is in Access.
GET and DELETE endpoints take the address as a query parameter; POST and PUT endpoints take it in the JSON body. MCP tools take the same parameter names. The Endpoints section of the sidebar lists every parameter.
Edit a page safely
Every read returns the page’scontent_hash. Editing or replacing a page’s content must send it back as base_hash, so a change never overwrites an edit made since you read the page.
old_stringmust occur exactly once in the page, including whitespace and line breaks. If it occurs several times, add surrounding text or passreplace_all: true.- If the page changed since your read, the call fails with
409content_conflictand the page’scurrent_hash. Read the page again and reapply your change. - The response gives the new
content_hashandversion_number, so you can chain several edits without reading again. summaryis optional; it is recorded in the page history.
Read a page
GET /spaces/pages returns the page’s id, address, title, content_hash and total_lines, plus one of:
- the whole content (default);
outline=true: the headings, each with its level, line and the last line of its section;section=<heading>: one section, from its heading down to the next heading of the same or a higher level;start_line/end_line: a range of lines (numbered from 1, inclusive).
truncated is true and next_start_line says where to continue. Search and read number lines the same way, so a line found by grep can be read and edited directly.
Find text
POST /spaces/grep returns the matching lines of the pages you can read, with their address and line number.
- The
patternis literal by default. Setignore_casefor a case-insensitive search. - With
regex: true, the pattern is a POSIX advanced regular expression, matched against each line:\d,\sand\wclasses work, and a word boundary is written\y(\mfor the start of a word,\Mfor its end). addresslimits the search to a space or to a page and the pages below it.contextadds up to 10 lines before and after each match.paths_only: truereturns the matching pages with their number of matching lines instead of the lines.- At most 50 results come back (
limit);has_moretells whether there were more. Lines longer than 300 characters are cut, withtext_truncated: true; read the line to get all of it. - A search running longer than 5 seconds is stopped with
search_timeout. Narrow it with anaddressor a simpler pattern.
POST /spaces/search finds pages by meaning when you don’t know the exact words. It may take a moment before a page you just changed is found by meaning; grep sees changes immediately.
List pages
GET /spaces/tree lists the pages under a space or a page, in reading order, down to depth levels (default 2, at most 10). Each page comes with its address, title, position among its siblings, children_count, last update and a one-line summary: the description of the page’s frontmatter when it has one, otherwise its first line of text. At most 500 pages are listed (truncated).
Create, move and delete pages
- Create:
POST /spaces/pageswithparent(an existing page, or the space name for a top-level page),titleandcontent. - Replace:
PUT /spaces/pageswithaddress, the whole newcontentandbase_hash. - Move:
POST /spaces/pages/movewithparent(a page of the same space, or the space name),positionamong the new siblings (0is first) and/or a newtitle. A page cannot move to another space: create it there and delete the original. - Delete:
DELETE /spaces/pagesremoves the page and every page below it;descendants_deletedgives how many pages were below it.
Proposals
Withpropose access, POST /spaces/pages/edit and PUT /spaces/pages do not change the page. They answer 202 Accepted with a proposal (object: "space_change_proposal", status: "pending", applied: false) and a message saying the page is unchanged. MCP tools return the same object.
Someone with write access reviews it:
GET /spaces/proposalslists the proposals on your spaces, newest first. Filter withaddress(a space or a page) andstatus(pendingby default, oraccepted,rejected).GET /spaces/proposals/{proposal_id}adds the page content the proposal was made on (original_content) and theproposed_content.POST /spaces/proposals/{proposal_id}/acceptapplies it. Passcontentto apply an edited version instead, andnotesfor the record. The new version is credited to the reviewer, and its summary names who proposed it.POST /spaces/proposals/{proposal_id}/rejectcloses it without changing the page.
409 content_conflict and the proposal stays pending: read the page, apply the change to its current content, then reject the proposal.
File material into a space
Hand AGO a memo, meeting notes or a document and it files the content into the right pages: it adds new information to the page about that topic, creates a page when none is, and leaves pages that already say it alone. When the material contradicts a page, AGO does not pick a side: the contradiction waits for your decision.- What to send.
addressis a space or a page: the material is only filed in that space, or under that page.source_namenames the material in the page history. Send the text incontent, or a file infile_base64with itsfile_name(PDF, Word, PowerPoint, Excel, images, Markdown or plain text, up to 10 MB). The text, or the text read from the file, can be up to 60,000 characters and 25 separate topics: split longer material into several ingestions.instructions(optional) guides placement, for example “one page per product”. - The author’s words are meant to be kept. AGO is instructed to file each passage as written, without summarizing or rewording it, adding only the headings or list formatting the page needs. This is not guaranteed for every passage: the page history shows exactly what was written, and
review: alllets you approve each change first. Resolving a contradiction withkeep_bothadds a dated note saying that the sources disagree. Lines that carry nothing to keep, such as a greeting or a signature, are not filed and are listed inunfiled_excerpts. - Only what you can reach. The pages compared with the material are the ones you can read in that space. The changes are made with your access and credited to you, like your own edits.
- It takes a moment. The call answers
202withstatus: "planning". Passwait_seconds(up to 25) to wait for the result in the same call, or read it later withGET /spaces/ingestions/{ingestion_id}. Planning does not change any page: changes are made once the whole material is planned.
Review
review decides what waits for a decision:
With
propose access, review is always all and message says so: someone with write access decides.
When nothing waits, the ingestion is completed. Otherwise its status is awaiting_decisions. counts gives the number of pages created, updated and unchanged, and of changes waiting, skipped or failed.
Decide
GET /spaces/ingestions/{ingestion_id} lists the operations, one per page. Each one has its kind (create, update, unchanged or conflict), its status (applied, awaiting_decision, skipped or failed), the page, a one-line summary and the source_excerpt it comes from. A conflict also gives the page’s contradicted text in existing_excerpt.
For an operation waiting for a decision, current_content is the page now and proposed_content the page after the change. A conflict adds option_contents, the page as each choice would leave it. options lists the choices:
- Deciding needs
writeaccess. You can send up to 50 decisions at once, and decide some now and the rest later. Each decision is applied or refused on its own: the refused ones are indecision_errors, with a code and what to do. - Each change is a new page version credited to whoever decided, with a summary naming the material. The page’s previous content stays in its history.
- If the page changed since it was planned, the decision is refused with
page_changed. The operation keeps waiting, its contents and choices now show the page as it is: look again and decide. GET /spaces/ingestionslists ingestions, newest first, without their operations. Filter withaddressandstatus(planning,awaiting_decisions,completedorfailed).
When an ingestion fails
Afailed ingestion has an error with a code and a message, and changed no page. When internal is true, the failure is on AGO’s side: submit the material again later. Otherwise the message says what to change, for example too_many_passages (split the material), nothing_to_file (nothing in it to keep), extraction_failed (the file could not be read) or access_revoked (the key or person that submitted it lost access to the space before the material was filed).
History
GET /spaces/pages/versions lists a page’s versions, newest first, with version_number, date, change_summary, actor_type (user, api_key or agent for an OAuth application), actor_label (the key’s name and prefix, or the application’s name) and user. Versions saved before this attribution existed have no actor_type.
GET /spaces/pages/versions/{version_number} returns that version’s content. To restore it, send that content to PUT /spaces/pages with the page’s current content_hash.
Errors
Errors use the standard error format. Some carry extra fields that tell you how to recover. MCP tools return the same message, ending with the code in brackets, as a tool result withisError: true.
