API Reference

The simplest API
we could build.

A GET that returns Markdown. A POST that accepts it. Read access requires only the URL. Write access requires a passphrase. No OAuth, no token rotation, no complexity. Any agent with a fetch tool can read a pad today.

Why the API is this simple
Agents shouldn't need to manage tokens, headers, or authentication flows. The barrier to entry for reading a pad should be exactly one fetch call. If an agent can browse the web, it can read a pad. That's the design constraint we started from — and worked backwards.

Base URL

https://api.scratchthepad.com/api/{pad-id}

The pad ID is the 10-character hash in your pad's URL. If your pad lives at scratchthepad.com/#x7k2m9p4qw, your API endpoint is api.scratchthepad.com/api/x7k2m9p4qw.


Read a pad

Returns the full pad content as plain Markdown. No JSON wrapper — just the raw content your agent needs.

GET api.scratchthepad.com/api/{pad-id} Read pad
curl
curl https://api.scratchthepad.com/api/x7k2m9p4qw
200 OKContent-Type: text/plain
# Project brief

**Goal:** Redesign homepage and pricing page.

- [ ] Review current analytics
- [ ] Draft initial wireframes
- [x] Ship v1 homepage

---

↳ Waiting on: pricing page copy.
The response is always plain text. No JSON parsing required. Paste it directly into your agent's context window.

Write a pad

Replaces the pad content with the request body. Send Markdown — get Markdown back when you read it.

POST api.scratchthepad.com/api/{pad-id} Write pad
curl
curl -X POST https://api.scratchthepad.com/api/x7k2m9p4qw \
  -H "Content-Type: text/plain" \
  -H "X-Pad-Key: EXAMPLE-KEY-replace-with-yours" \
  -d "# Updated brief

**Status:** in progress

- [x] Analytics reviewed
- [ ] Wireframes pending"
200 OK
Saved.
Append mode: Add ?mode=append to add to existing content rather than replacing it. Useful for agent handoffs where you want to preserve previous output.
POST api.scratchthepad.com/api/{pad-id}?mode=append Append to pad
curl
curl -X POST "https://api.scratchthepad.com/api/x7k2m9p4qw?mode=append" \
  -H "Content-Type: text/plain" \
  -d "

---

## Agent summary — Apr 14

Analysis complete. Recommend leading with use case."

Pages

Pads support multiple named pages. Each page is a separate Markdown document within the same pad.

EndpointMethodDescription
/api/{id}/pagesGETList all pages
/api/{id}/pages/{name}GETRead a named page
/api/{id}/pages/{name}POSTWrite/create a named page
/api/{id}/pages/{name}?rename=NewPATCHRename a page
/api/{id}/pages/{name}DELETEDelete a page (cannot delete default)
List pages — curl
curl https://api.scratchthepad.com/api/x7k2m9p4qw/pages

# Returns JSON array:
["Project brief", "Open questions", "Decisions log"]

Metadata

Lightweight metadata about the pad — useful for agents checking freshness before reading full content.

GET api.scratchthepad.com/api/{pad-id}/meta Pad metadata
Response — JSON
{
  "id":         "x7k2m9p4qw",
  "created":     "2025-04-01T09:00:00Z",
  "modified":    "2025-04-14T14:32:00Z",
  "name":           "My Project",
  "pages":          4,
  "words":          847,
  "context_pct":    1,
  "context_health": "ok",   // "ok" | "warning" (70%+) | "critical" (90%+)
  "connections":    2,        // active WebSocket connections
  "last_by":        "human"
}
Update metadata: PATCH /api/{id}/meta with JSON body. Requires X-Pad-Key header. Supports: {"name": "New Name"}.

Create a pad

Agents can create pads programmatically. No authentication required.

POST api.scratchthepad.com/api/new Create pad
Response — JSON
{
  "id":        "x7k2m9p4qw",
  "url":       "https://scratchthepad.com/pad.html#x7k2m9p4qw",
  "api":       "https://api.scratchthepad.com/api/x7k2m9p4qw",
  "write_key": "EXAMPLE-KEY-replace-with-yours"
}

// Optional: send {"content": "initial content"} to pre-fill the pad
// Optional: send {"content": "# My pad"} for initial content
The write key is returned only once. Save it immediately. It cannot be recovered.

Changes & versions

Check what changed since your last read, and restore previous versions.

EndpointMethodDescription
/api/{id}/changes?since={ts}GETList pages changed since timestamp
/api/{id}/versionsGETList last 10 version snapshots
/api/{id}/versions/{ts}GETRead a specific version's content
/api/{id}/versions/{ts}POSTRestore a version (requires write key)

Webhooks

Get notified when a pad is written to. For server-based consumers. CLI agents should use /changes polling instead.

EndpointMethodDescription
/api/{id}/webhooksPOSTRegister a webhook (JSON: {"url": "...", "events": ["write"]})
/api/{id}/webhooksGETList registered webhooks
/api/{id}/webhooks?url=...DELETERemove a webhook

Webhook events: write, page-change, delete. Max 5 per pad. All require write key.


Setting up AI access

Set it once in custom instructions — every session starts with full pad context. Works for AI Agents (Claude Code, Claude Cowork, Codex, Manus — read + write) and AI Chat Assistants (Grok, Perplexity — read only). You explain yourself once.

01
Create a pad and copy the API endpoint
Visit scratchthepad.com — a pad generates instantly. Copy the API endpoint from the top bar or the Share panel.
02
Open your AI's custom instructions
For AI Agents — Claude: Settings → Custom instructions. For AI Chat Assistants — Gemini: Extensions → Custom instructions. Claude reads + writes via API. Gemini and others are read only. ChatGPT cannot reliably fetch URLs from newer domains.
03
Add the instruction
Paste this, replacing the endpoint with yours:
Custom instructions
Before we start each conversation, fetch the contents of my pad at https://api.scratchthepad.com/api/x7k2m9p4qw and use it as context for our work together.
04
Done. Every session starts with context.
The agent reads the pad at the start of each conversation. Update the pad as your project evolves — the agent always has the latest.

Code examples

Reading and writing a pad from the most common environments.

JavaScript
Read + write
// Read
const response = await fetch('https://api.scratchthepad.com/api/x7k2m9p4qw');
const markdown = await response.text();

// Write
await fetch('https://api.scratchthepad.com/api/x7k2m9p4qw', {
  method: 'POST',
  headers: { 'Content-Type': 'text/plain' },
  body: '# Updated content\n\nYour markdown here.'
});
Python
Read + write
import requests

PAD = 'https://api.scratchthepad.com/api/x7k2m9p4qw'

# Read
content = requests.get(PAD).text

# Write
requests.post(PAD,
  data='# Updated\n\nNew content here.',
  headers={'Content-Type': 'text/plain'}
)
Claude — system prompt pattern
Custom instructions
# Add to your system prompt or custom instructions:

You have access to a shared pad at:
https://api.scratchthepad.com/api/x7k2m9p4qw

At the start of each conversation, fetch this URL
and use the contents as project context.

After completing significant work, POST a summary
back to the pad so the next session starts informed.

Auth & security

scratchthepad is intentionally open in v1 alpha. Here's what that means and what's coming.

Split-key security. Every pad ships with two keys. The URL hash gives read access — safe to share freely, paste in Slack, or set in your agent's instructions. A separate write passphrase is required to modify content. Two addresses. Two trust levels. One neutral object.
How it works: Your pad URL (#x7k2m9p4qw) grants read access to anyone who has it. To write, include your write key as a header: X-Pad-Key: EXAMPLE-KEY-replace-with-yours. Agent writes append by default. Use ?mode=overwrite to replace.
Identify your agent: Include X-Pad-Actor-Name: Claude header on writes. Your agent's name appears in the pad's activity log and append timestamps.
Access model: Anyone with the URL can read. The write key (sent as X-Pad-Key header) is required to write. Simple, no account needed.

Why not API keys?

Agents shouldn't need to manage rotating credentials. The pad key in the URL is the read credential. The write passphrase is the write credential. Both are simple strings — no OAuth, no token refresh, no headers for read-only access. The barrier to entry for reading a pad is exactly one fetch call with no modifications.