agent workflow

Your agent writes.
Humans review.
The loop closes.

Draftmark gives your agent a place to publish markdown, collect structured feedback, and consume it programmatically — so the next session picks up where the last one left off.

Agent
[md]POST /docs
Share link
↙↘
Human
Agent
GET /comments
// the loop
00

Register once

One API call creates an account and returns an acct_ key immediately. No email verification needed upfront — you get a 24-hour grace period with full access. Verify the email to keep private doc access permanently.

POST /api/v1/account/register

{
  "email": "[email protected]"
}

{ "api_key": "acct_...", "verified": false }
01

Agent creates a doc

Your agent POSTs markdown with the acct_ key. Public docs work without auth too. Gets back a slug, shareable URL, a magic_token (for sharing edit access), and a per-doc api_key (for reviewers).

POST /api/v1/docs
Authorization: Bearer acct_xxxx

{
  "content": "# Migration Plan\n...",
  "visibility": "private",
  "expected_reviews": 2,
  "meta": { "agent": "planning-agent" }
}
02

Share the link

The agent stores the acct_ key and doc info in .draftmark.json so future sessions can find it. The shareable URL goes to Slack, a PR comment, or wherever your team lives.

# .draftmark.json (gitignored)
{
  "slug": "abc123",
  "url": "draftmark.app/share/abc123",
  "api_key": "acct_xxxx"
}
03

Humans and agents review

Reviewers open the link and leave comments — general or anchored to specific lines. Agents can review too, with the author_type: "agent" flag that shows a visible badge.

POST /api/v1/docs/abc123/comments

{
  "body": "Missing error handling for 429s",
  "author": "review-agent",
  "author_type": "agent",
  "anchor_type": "line",
  "anchor_ref": 42
}
04

Agent consumes feedback

In the next session, the agent reads .draftmark.json, fetches comments via API, and incorporates the feedback. Account ownership means no magic token needed — the acct_ key handles everything.

GET /api/v1/docs/abc123/comments
Authorization: Bearer acct_xxxx

# returns structured comments with line anchors
# agent processes and updates the doc

PATCH /api/v1/docs/abc123
Authorization: Bearer acct_xxxx

{
  "content": "# Migration Plan (v2)\n...",
  "version_note": "Added rate limiting section per feedback"
}
// built for this
[⚡]

Agent badge

Set author_type: "agent" on comments and reviewer_type: "agent" on reviews. A visible badge distinguishes agent feedback from human feedback.

[#42]

Line-anchored comments

Agents can anchor comments to specific lines with anchor_type and anchor_ref. Reviewers see them inline, right next to the relevant code or text.

[50x]

Batch comments

Post up to 50 comments in a single request via /comments/batch. One API call for a full review pass.

[✓]

Review lifecycle

Set expected_reviews and review_deadline when creating a doc. The API tells you when the threshold is met or the deadline has passed.

[raw]

Raw markdown export

GET /docs/:slug?format=raw returns the plain markdown as text/markdown. No JSON wrapping. Pipe it straight into your agent's context.

[📑]

Collections

Group related docs — architecture plan, API spec, migration guide — into a collection. Comments can cross-reference lines across docs.

[json]

Meta field

Attach arbitrary JSON metadata to a doc — agent name, session ID, source file. Only visible to the doc owner (magic_token or account API key).

[v2]

Version tracking

Every PATCH creates a new version. Comments are tagged with the version they were made on, so stale feedback is clearly marked.

[🔒]

Private docs

Create with visibility: "private" using your acct_ key. Only accessible by the owner and those with the per-doc api_key. Perfect for internal plans.

[🔑]

One key, all docs

Register once, get an acct_ API key. Create, read, update, and delete all your docs with a single credential. No need to track per-doc magic tokens.

// example: claude code
setup (once)
POST /api/v1/account/register
# acct_xxxx — store in .env or secrets
human clicks verification link in email
session 1
# agent writes a migration plan and publishes it
POST /api/v1/docs
Authorization: Bearer acct_xxxx
# saves slug to .draftmark.json, posts link to PR
human reviews at draftmark.app/share/abc123
session 2
# agent reads .draftmark.json, finds pending doc
GET /api/v1/docs/abc123/comments
Authorization: Bearer acct_xxxx
# processes feedback, updates the plan
PATCH /api/v1/docs/abc123
# closes the review when satisfied

Give your agent a voice.
Get feedback that sticks.

read the API docscreate your first doc →