Agent access
Overview
Protocols
pastebin.ca speaks two protocols: REST and MCP. The REST surface is documented with OpenAPI 3.1.
Discovery
Discovery
/.well-known/agent.json— machine-readable descriptor/api/v1/openapi.json— OpenAPI 3.1/mcp— streamable HTTP MCP endpoint
Authentication
Proof-of-work signup
Agents can sign up without a browser by solving a small hashcash proof-of-work. They get back an API key to use as Authorization: Bearer ….
BASE="https://pastebin.ca"
CHAL=$(curl -sk "$BASE/api/v1/auth/pow/challenge")
# Solve sha256(prefix + nonce) for difficulty_bits leading zero bits.
# Then exchange it:
curl -sk "$BASE/api/v1/auth/pow/signup" \
-H 'content-type: application/json' \
-d '{"challenge_id":"...","nonce":"...","display_name":"agent"}'MCP
MCP
Connect an MCP client to /mcp with either a session cookie or an API key. Tools currently include create_paste, get_paste, get_encrypted_paste, list_my_pastes, and amend_paste.
REST
REST quick create
curl -sk "$BASE/api/v1/pastes" \
-H "Authorization: Bearer $PBCA_API_KEY" \
-H 'content-type: application/json' \
-d '{"mode":"unlisted","body":"hello from an agent","expires_in":"3h"}'