{"openapi":"3.1.0","info":{"title":"agentmailbox — the agent-mailbox API","version":"0.1.0","description":"An email service FOR AI/CHAT agents: send/create/manage mail through a chat. One flat, versioned REST+JSON API; one 12-tool MCP spine; one hibernated-WS push. All routes are agent-readable (no zero-knowledge claim on the agent lane)."},"servers":[{"url":"https://nimpost.com"}],"paths":{"/api/identity":{"post":{"summary":"create_identity — mint a claim address (the agent mailbox)","operationId":"createIdentity","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string"},"ephemeral":{"type":"boolean"}}}}}},"responses":{"200":{"description":"identity + claim address","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"address":{"type":"string"},"tier":{"type":"string"},"retention_s":{"type":"number"},"created_ms":{"type":"number"}}}}}}}}},"/api/identities":{"get":{"summary":"list_identities — the caller's agent identities","operationId":"listIdentities","responses":{"200":{"description":"identity list","content":{"application/json":{"schema":{"type":"object","properties":{"identities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"tier":{"type":"string"},"retention_s":{"type":"number"}}}}}}}}}}}},"/api/identity/{id}/aliases":{"post":{"summary":"create_alias — plus-addressing under an identity","operationId":"createAlias","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"the plus-addressed claim address","content":{"application/json":{"schema":{"type":"object","properties":{"address":{"type":"string"},"canonical":{"type":"string"}}}}}}}}},"/api/mailbox/{id}":{"get":{"summary":"list_inbox — the envelope index (metadata only)","operationId":"listInbox","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"envelope index","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer"},"messages":{"type":"array","items":{"type":"object"}}}}}}}}},"delete":{"summary":"destroy_address — burn the mailbox now (PII scrub, audited)","operationId":"destroyAddress","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"deletion counts + audit rows","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"integer"},"audit_rows":{"type":"integer"}}}}}}}}},"/api/mailbox/{id}/wait":{"get":{"summary":"wait_inbox — the blocking long-poll receive primitive","operationId":"waitInbox","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"wait_ms","in":"query","schema":{"type":"integer","default":0,"maximum":60000}},{"name":"from","in":"query","schema":{"type":"string"}},{"name":"subject","in":"query","schema":{"type":"string"}},{"name":"since_ms","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"matched newest mail, or a timeout marker","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["matched","timeout"]},"message":{"type":["object","null"]}}}}}}}}},"/api/message/{id}/{mid}":{"get":{"summary":"read_email — one message body (marks read; burns on first read if read_once)","operationId":"readEmail","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"mid","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"message row","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"description":"gone"}}},"delete":{"summary":"delete one message (audited)","operationId":"deleteMessage","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"mid","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"deleted"},"404":{"description":"gone"}}}},"/api/message/{id}/{mid}/extract":{"get":{"summary":"extract_code — the killer feature: structured codes/links/actions (regex+heuristic v0)","operationId":"extractCode","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"mid","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"the §3.2b extraction shape","content":{"application/json":{"schema":{"type":"object","properties":{"codes":{"type":"array","items":{"type":"object"}},"links":{"type":"array","items":{"type":"object"}},"actions":{"type":"array","items":{"type":"object"}},"schema_version":{"type":"integer","const":1}}}}}},"404":{"description":"gone"}}}},"/api/verify_code/{id}":{"get":{"summary":"verify_code — the composite hero (wait + extract in one call)","operationId":"verifyCode","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"wait_s","in":"query","schema":{"type":"integer","default":0,"maximum":60}},{"name":"from","in":"query","schema":{"type":"string"}},{"name":"subject","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"found:true + code/links/actions, or found:false + empty fields on timeout","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/send":{"post":{"summary":"send_email (P3 — requires an onboarded sending domain + send binding)","operationId":"sendEmail","responses":{"501":{"description":"not yet"}}}},"/api/send/{id}/status":{"get":{"summary":"send_status (P3)","operationId":"sendStatus","responses":{"501":{"description":"not yet"}}}},"/api/identity/{id}/retention":{"patch":{"summary":"set_retention (P3 — re-arms the burn alarm)","operationId":"setRetention","responses":{"501":{"description":"not yet"}}}},"/mcp":{"post":{"summary":"MCP Streamable-HTTP (12-tool spine: tools/list, tools/call, resources/list, prompts/list)","operationId":"mcp","responses":{"200":{"description":"JSON-RPC result"}}}},"/mcp/manifest.json":{"get":{"summary":"crawlable 12-tool manifest","operationId":"mcpManifest"}},"/llms.txt":{"get":{"summary":"LLM-readable tool catalog","operationId":"llmsTxt"}}},"components":{"schemas":{"code":{"type":"object","properties":{"value":{"type":"string"},"kind":{"type":"string","enum":["otp4","otp6","otp8","link_token"]},"confidence":{"type":"number"},"context":{"type":"string"}},"required":["value","kind","confidence"]},"link":{"type":"object","properties":{"href":{"type":"string"},"purpose":{"type":"string","enum":["confirmation","verification","activation","unknown"]},"text":{"type":"string"}},"required":["href","purpose"]},"action":{"type":"object","properties":{"verb":{"type":"string","enum":["click","copy"]},"ref":{"type":"string"},"label":{"type":"string"}},"required":["verb","ref","label"]}}}}