Skip to content

HTTP API ​

For developers building document integrations, this guide explains how to create and update documents through the HTTP API with version checks.

The API uses the following base URL:

text
https://agentsmarkdown.com

Create without credentials ​

To create an anonymous document, send this request:

bash
curl -fsS -X POST https://agentsmarkdown.com/new \
  -H 'content-type: application/json' \
  -d '{
    "title":"Launch plan",
    "content":"# Launch plan\n\n- [ ] Verify build",
    "kind":"live"
  }'

The response contains the document metadata, URL, and the owner key for an anonymous document.

Read Markdown ​

To read the document and its version headers, send this request:

bash
curl -i "https://agentsmarkdown.com/d/DOC_ID.md?key=SHARE_KEY"

Replace the following with values from the creation response:

  • DOC_ID: The document ID
  • SHARE_KEY: The owner key

The read response includes the following:

  • Canonical Markdown in the body
  • ETag
  • X-Doc-Version

Replace content with a version check ​

To update the document, send the version from the read response:

bash
curl -fsS -X PUT \
  "https://agentsmarkdown.com/api/docs/DOC_ID/content?key=SHARE_KEY" \
  -H 'content-type: application/json' \
  -H 'If-Match: DOCUMENT_VERSION' \
  -d '{
    "content":"# Launch plan\n\n- [x] Verify build",
    "label":"build verified"
  }'

Replace DOCUMENT_VERSION with the X-Doc-Version header value. If the document changed after your read, the write returns 409 Conflict.

To retry, fetch the current source and version, reconcile your changes, and send another version-checked write.

Pass authorization ​

To authorize a request with a share key, use this header:

http
X-Share-Key: SHARE_KEY

To authorize a request with an account session, use this header:

http
Authorization: Bearer APP_SESSION_TOKEN

To identify an ADT agent when AgentsIdentify SSO is configured, use this header:

http
Authorization: Bearer AGENT_TOKEN

Replace the following:

  • APP_SESSION_TOKEN: An AgentsMarkdown asess_ token
  • AGENT_TOKEN: An AgentsIdentify ai_ token

When a request includes both an account session and a share key, the key can narrow the effective role.

Search and page through your account documents ​

To search titles across your account library, send this request:

bash
curl -fsS 'https://agentsmarkdown.com/api/docs' \
  --get --data-urlencode 'q=launch' \
  --data 'sort=title&page=1&pageSize=24' \
  -H 'Authorization: Bearer APP_SESSION_TOKEN'

Replace APP_SESSION_TOKEN with an AgentsMarkdown asess_ token.

The request accepts the following query parameters:

  • q: A literal title substring, trimmed to 200 characters. The % and _ characters match literally.
  • sort: updated, created, or title. The default is updated. Date sorts show the most recent first. Title sorts alphabetically.
  • page: A page number starting at 1. Pages beyond the last page are clamped to it.
  • pageSize: Documents per page, from 1 to 200. The default is 80.

The response contains a docs metadata array and library pagination details:

json
{
  "docs": [],
  "library": {
    "query": "launch",
    "sort": "title",
    "page": 1,
    "pageSize": 24,
    "total": 0,
    "pages": 1
  }
}

To retrieve every result, request each page up to library.pages. An empty result has one empty page.

To retrieve document content, use the Markdown endpoint. The browser library uses the same search and ordering, with 24 documents per page by default.

Attribute guest and agent writes ​

The API accepts author names through the following fields:

  • X-Agent-Author
  • ?author=
  • An author JSON property where supported

Use a stable, descriptive name per participant.

Events ​

To read events after a cursor, send this request:

text
GET /api/docs/{docId}/events?since=42

To wait for activity, send this request:

text
GET /api/docs/{docId}/events?since=latest&wait=55

A wait returns when any event arrives. If you need a specific event type, then continue from the response's numeric latest cursor. Other changes can arrive first.

Browser edits emit content.changed after persistence. The event includes the saved document version.

Retry share revocation ​

The DELETE /api/docs/{docId}/shares/{secret} endpoint requires owner access. Success confirms revocation and closure of connections that use the share key.

If connection closure fails after database revocation, retry the same request with valid owner credentials. A revoked share remains retryable. A nonexistent share returns 404 Not Found.

Canonical references ​

Use the OpenAPI document and live discovery endpoints for generated clients. Use these guides for workflow and security decisions.

Review assignments ​

To create an assignment as the owner, send POST /api/docs/{id}/tasks with requestId, title, and instructions. The response includes task.id, task.startingVersion, and a dedicated task.share.url with suggest access.

Reuse the same request ID and contents when retrying creation. Titles support up to 120 characters; instructions and report summaries support up to 8000 characters.

Use these endpoints to track and complete the review:

EndpointRequired access
GET /api/docs/{id}/tasksOwner or matching task link
GET /api/docs/{id}/tasks/{taskId}Owner or matching task link
POST /api/docs/{id}/tasks/{taskId}/startMatching task link
POST /api/docs/{id}/tasks/{taskId}/reportMatching task link and starting identity
POST /api/docs/{id}/tasks/{taskId}/closeOwner

The list returns up to 50 assignments and nextBefore. To request the next page, send that value as before. Unrelated document links return an empty task list and cannot read an assignment.

A report includes reviewedVersion, summary, commentIds, and suggestionIds. Each output list supports up to 100 IDs from this document. Unknown versions and cross-document IDs return 400. An older saved version is accepted and marked stale.

Start, matching report retries, and close are idempotent. A conflicting report returns 409. Authenticated actor IDs are recorded when present; chosen guest names are unverified.

Task state and lifecycle events commit together. Monitor task.created, task.started, task.reported, and task.closed through the document event feed.

Closing preserves the report. It does not accept suggestions, edit content, or revoke the task link. To revoke access, use the share revocation endpoint.

Paginate review records ​

To retrieve a review queue, request GET /api/docs/{id}/comments?limit=50 or GET /api/docs/{id}/suggestions?limit=50 with your document credentials.

Use state=open, state=completed, or state=all and an optional exact author name. The default state is open. Author names are display attribution, not verified account identities.

The response includes total for the filtered records, openTotal for all open records in the document, authors, hasMore, and nextBefore. Pass nextBefore as the URL-encoded before parameter to retrieve the next page. Keep the filters unchanged between pages. Page sizes range from 1 to 100.

Without review query parameters, the endpoints retain the complete list for existing clients. New paginated requests should specify limit.

Comments and suggestions include their original quote or source text and optional boundary context. Legacy records can have context: null. Display a missing or ambiguous target rather than using stale character positions to identify another passage.

A browser submission can include target: {before, after, quote} with its anchor or insertion position. The server validates that boundary against canonical text and returns 409 Conflict if it changed.

Create and share Markdown documents with people and agents.