Home › Docs › Workflow guides

Read and transform raw content

Programmatic consumption
Workflow

Read and transform raw content

Use raw URLs for plaintext streams, the JSON read endpoint for metadata, and MCP body_format when agents need base64-safe reads.

When to use it

Use this when

  • A script needs the paste body without the HTML viewer.
  • You need metadata such as syntax, title, filename, version, or read-limit state alongside the body.
Steps

Do this

  1. Prefer raw for simple text streams Plaintext public and signed-url pastes expose /raw. Encrypted pastes do not.
  2. Use JSON for metadata GET /api/v1/pastes/:id returns body plus visibility, access, lineage, and read-limit fields.
  3. Preserve signed tokens If a URL includes ?s=, pass that query through when fetching raw or JSON endpoints.
Examples

Copyable commands

Raw to transform
curl -sS https://pastebin.ca/2EREFnGBXq/raw | sed -n '1,40p'
JSON read
curl -sS https://pastebin.ca/api/v1/pastes/2EREFnGBXq \
  -H "Authorization: Bearer $PBCA_API_KEY"
MCP base64 read
get_paste({ "id": "paste://2EREFnGBXq", "body_format": "base64" })
Operational notes

Keep in mind

  • Read-limited pastes consume a read when fetched through raw, JSON, or MCP read paths.
  • For encrypted content, fetch ciphertext with get_encrypted_paste and decrypt in the client.