API reference
Base URL: https://nimpost.com. All routes are agent-readable REST+JSON. The 12 MCP tools are a thin adapter over these paths. GET /openapi.json is the machine-readable contract.
REST routes
POST /api/identity
create_identity — mint a claim address (the agent mailbox). ephemeral:true = 24 h burn (Free); false = 30 d retention (Agent).
- Body
label(string, optional) — human/agent-readable label.ephemeral(boolean, defaultfalse).- Response 200
{ "id": "agent-01@nimpost.com", "address": "agent-01@nimpost.com", "tier": "agent", "retention_s": 2592000, "created_ms": 1735600000000 }
$ curl -X POST https://nimpost.com/api/identity \
-H "Content-Type: application/json" \
-d '{"label":"agent-01","ephemeral":false}'
GET /api/identities
list_identities — the caller's agent identities. v0 returns an empty-but-shaped list; P3 auth scopes the result.
- Response 200
{ "identities": [ { "id": "...", "label": "agent-01", "tier": "agent", "retention_s": 2592000 } ]}
$ curl https://nimpost.com/api/identities
POST /api/identity/:id/aliases
create_alias — plus-addressing under an identity. The alias routes to the canonical box at the same DO.
- Path
id(string) — identity ULID or address.- Body
alias(string, optional) — the local part to plus-address.- Response 200
{ "address": "agent-01+tag@nimpost.com", "canonical": "agent-01+tag@nimpost.com" }
$ curl -X POST https://nimpost.com/api/identity/agent-01@nimpost.com/aliases \
-H "Content-Type: application/json" -d '{"alias":"tag"}'
GET /api/mailbox/:id
list_inbox — the envelope index (metadata only; bodies are a separate read_email call).
- Path
id(string) — address.- Response 200
{ "count": 1, "messages": [ { "id": "01H9...", "from_addr": "noreply@github.com", "subject": "GitHub verification code", "received_ms": 1735600000000, "expiry_ms": 1735686400000, "read": 0, "identity": 1 } ]}
$ curl https://nimpost.com/api/mailbox/agent-01@nimpost.com
DELETE /api/mailbox/:id destroy
destroy_address — burn the mailbox now (PII scrub, audited, idempotent).
- Response 200
{ "deleted": 3, "audit_rows": 5 }
$ curl -X DELETE https://nimpost.com/api/mailbox/agent-01@nimpost.com
GET /api/mailbox/:id/wait
wait_inbox — the blocking long-poll receive primitive. Returns the newest match or a timeout marker.
- Query
wait_ms(int, default 0, max 60000).from(string).subject(string).since_ms(int).- Response 200
{ "status": "matched", "message": { "id": "01H9...", "from_addr": "noreply@github.com", "subject": "GitHub verification code", "received_ms": 1735600000000 } }
$ curl "https://nimpost.com/api/mailbox/agent-01@nimpost.com/wait?wait_ms=30000&from=github.com"
GET /api/message/:id/:mid
read_email — one message body (marks read; burns on first read if read_once).
- Response 200
{ "id": "01H9...", "from_addr": "noreply@github.com", "subject": "GitHub verification code", "body": "Your one-time verification code is 483920", "read_once": 0 }- 404
{ "gone": true }
$ curl https://nimpost.com/api/message/agent-01@nimpost.com/01H9K3XQZ4W2V1T6R8M5N4J7G0
DELETE /api/message/:id/:mid
Delete one message (audited). Returns {"deleted": true} or {"deleted": false} on 404.
$ curl -X DELETE https://nimpost.com/api/message/agent-01@nimpost.com/01H9...
GET /api/message/:id/:mid/extract
extract_code — the killer feature: structured codes/links/actions from a stored message. v0 is regex + heuristic, no LLM.
- Response 200
{ "codes": [ { "value": "483920", "kind": "otp6", "confidence": 0.98, "context": "Your one-time verification code is 483920" } ], "links": [ { "href": "https://github.com/session/verify", "purpose": "verification" } ], "actions": [ { "verb": "click", "ref": "links[0]", "label": "Verify / confirm" }, { "verb": "copy", "ref": "codes[0]", "label": "Use the code 483920" } ], "schema_version": 1 }
$ curl https://nimpost.com/api/message/agent-01@nimpost.com/01H9.../extract
GET /api/verify_code/:id
verify_code — the composite hero. wait_inbox + extract_code in one call. Long-polls for a matching mail, then hands back the extracted code, links, and actions. On timeout: found: false + empty fields.
- Query
wait_s(int, default 0, max 60).from(string).subject(string).since_ms(int).
$ curl "https://nimpost.com/api/verify_code/agent-01@nimpost.com?wait_s=60&from=github.com"
POST /api/send P3 — coming
send_email — outbound mail via the send binding (SPF/DKIM/DMARC). Requires an onboarded sending domain. Returns 501 until P3.
$ curl -X POST https://nimpost.com/api/send \
-H "Content-Type: application/json" -d '{"to":"x@y.com","subject":"hi","body":"hello"}'
GET /api/send/:id/status P3 — coming
send_status — poll the lifecycle of a sent message (delivered/bounced/queued). Returns 501 until P3.
PATCH /api/identity/:id/retention P3 — coming
set_retention — set an identity's retention (1h, 30d, 90d); re-arms the burn alarm. Returns 501 until P3.
MCP tools (12)
The 12-tool spine is a thin adapter over the REST routes above. tools/call maps args → REST route and returns 4xx/5xx as isError content (HTTP stays 200). See the MCP page →
create_identity
Create a persistent agent identity (or ephemeral with ephemeral:true). Returns the identity handle + a claim address. The agent's mailbox is this identity.
{ "label": "string?", "ephemeral": "boolean?" }{ "id", "address", "tier", "retention_s", "created_ms" }$ curl -X POST https://nimpost.com/mcp -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"create_identity","arguments":{"label":"agent-01","ephemeral":false}}}'
list_identities
List the caller's agent identities (the identity directory).
{}{ "identities": [{ "id", "label", "tier", "retention_s" }] }create_alias
Create a plus-addressing alias under an identity (e.g. name+tag@domain).
{ "identity": "string", "alias": "string" }{ "address", "canonical" }$ curl -X POST https://nimpost.com/mcp -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"create_alias","arguments":{"identity":"agent-01@nimpost.com","alias":"tag"}}}'
list_inbox
Return the envelope index for an identity (metadata only; bodies are a separate read_email call).
{ "identity": "string", "limit": "integer?" }{ "count", "messages": [{ "id","from_addr","subject","received_ms","expiry_ms","read" }] }wait_inbox
Long-poll (the blocking receive primitive): wait up to wait_s for a new mail matching the optional from/subject/since_ms filters, then return the newest match or a timeout marker.
{ "identity": "string", "from": "string?", "subject": "string?",
"since_ms": "integer?", "wait_s": "integer?" }{ "status": "matched"|"timeout",
"message": { "id","from_addr","subject","received_ms" } | null }$ curl -X POST https://nimpost.com/mcp -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"wait_inbox","arguments":{"identity":"agent-01@nimpost.com","wait_s":30,"from":"github.com"}}}'
read_email
Read one message body (marks read; burns on first read if read_once).
{ "identity": "string", "message_id": "string" }{ "id","from_addr","subject","body","read_once" }extract_code
The killer: server-side structured extraction of codes/links/actions from a stored message (regex + heuristic v0, no LLM).
{ "identity": "string", "message_id": "string" }{ "codes": [...], "links": [...], "actions": [...], "schema_version": 1 }verify_code
The composite hero: wait_inbox + extract_code in ONE call. Long-poll for a matching mail, then hand back the extracted code + links + actions, or found: false on timeout.
{ "identity": "string", "from": "string?", "subject": "string?",
"since_ms": "integer?", "wait_s": "integer?", "kind": "any|code|link?" }{ "found": "boolean", "status": "matched|timeout", "code": "string?",
"codes": [...], "links": [...], "actions": [...], "from": "string?",
"subject": "string?", "ts": "integer", "message_id": "string?",
"confidence": "number?", "schema_version": 1 }$ curl -X POST https://nimpost.com/mcp -d '{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"verify_code","arguments":{"identity":"agent-01@nimpost.com","wait_s":60,"from":"github.com"}}}'
send_email coming
Send outbound mail via the send binding (SPF/DKIM/DMARC). P3: requires an onboarded sending domain + send binding.
{ "to": "string", "subject": "string", "body": "string?", "html": "string?" }{ "message_id", "dkim", "spf", "dmarc" }send_status coming
Poll the lifecycle of a sent message (delivered/bounced/queued) from CF Event Subscriptions. P3.
{ "send_id": "string" }{ "status": "queued|delivered|bounced|unknown" }set_retention coming
Set an identity's retention (e.g. 1h, 30d, 90d); re-arms the burn alarm. P3.
{ "identity": "string", "retention": "string" }{ "retention_s", "next_burn_ms" }destroy_address
Burn an identity's mailbox now (PII scrub, audited, idempotent).
{ "identity": "string" }{ "deleted": "integer", "audit_rows": "integer" }$ curl -X POST https://nimpost.com/mcp -d '{"jsonrpc":"2.0","id":5,"method":"tools/call","params":{"name":"destroy_address","arguments":{"identity":"agent-01@nimpost.com"}}}'
The verify_code request / response, end to end
Request — one call, up to 60 s:
GET /api/verify_code/agent-01@nimpost.com?wait_s=60&from=github.com ↓
Response (matched):
{
"found": true,
"status": "matched",
"code": "483920",
"codes": [
{
"value": "483920",
"kind": "otp6",
"confidence": 0.98,
"context": "Your one-time verification code is 483920"
}
],
"links": [
{ "href": "https://github.com/session/verify", "purpose": "verification" }
],
"actions": [
{ "verb": "click", "ref": "links[0]", "label": "Verify / confirm" },
{ "verb": "copy", "ref": "codes[0]", "label": "Use the code 483920" }
],
"from": "noreply@github.com",
"from_address": "noreply@github.com",
"subject": "GitHub verification code",
"ts": 1735600000,
"expires_in_s": 3600,
"message_id": "01H9K3XQZ4W2V1T6R8M5N4J7G0",
"confidence": 0.98,
"schema_version": 1
}
Response (timeout) — deterministic found: false + empty fields. The agent branches on this.
{
"found": false,
"status": "timeout",
"code": null,
"codes": [],
"links": [],
"actions": [],
"from": "github.com",
"from_address": "github.com",
"subject": null,
"ts": 1735600060,
"expires_in_s": null,
"message_id": null,
"confidence": null,
"schema_version": 1
}