AI Ready Document API v2

The document endpoint
for AI agents.

Your agent creates the content. PasteToPrint turns it into a structured, human-reviewable document — ready to edit, draw on, print or export.

Machine-discoverable at /.well-known/ai.json
create-document.json 201 Created
1POST /api/v2/documents 2{ 3 "schemaVersion": "ptp.document/1", 4 "title": "Service report", 5 "template": "work_report", 6 "blocks": [ /* semantic content */ ] 7}
Response 182 ms
{ "success": true, "editorUrl": "https://www.pastetoprint.com/open/…", "requiresUserConfirmation": true }
01Structured JSON in
02Editor URL out
15 minAnonymous session TTL
HumanConfirmation required

A standard destination for generated documents

One endpoint. A complete handoff.

Instead of returning a wall of text, give the user a real document they can inspect and finish in a browser.

01

Agent generates

The model emits semantic PTDF blocks: headings, paragraphs, lists, tables and more.

schemaVersion: ptp.document/1
03

Human finishes

The user reviews the result, confirms the import, then edits text, draws directly on the page, adds shapes or image layers, prints or exports it.

editorUrl → review

Long documents · no POST

Move the complete result without copy-paste.

When a document is too large for a portable URL, use a local PTDF file or the optional AI-chat radar. Both routes keep the validation preview and human confirmation boundary.

provider-independent

Open or drop a .ptdf file

Ask a file-capable AI client for validated UTF-8 PTDF 1.0. Open the artifact with an installed PasteToPrint PWA, choose Import PTDF, or drag it anywhere over the editor.

.ptdf · .ptdf.json · 5 MiB
File handoff instructions
local extension

Add a handoff button to AI chat

The optional Manifest V3 extension detects assistant responses on ChatGPT, Gemini, Claude and Copilot. A user click transfers one response through the nonce-bound postMessage protocol.

AI DOM → click → postMessage → preview
Extension setup and permissions

The extension has no background worker, cookie access or clipboard permission. It reads the selected response only after its button is clicked. Neither route can confirm an import, print or export for the user. See the security boundary and release gate.

Quick start

Create a document in a few lines.

No account is required for a short-lived anonymous session. Keep the returned editorUrl private and give it to the user.

JavaScript example
const documentData = {
  schemaVersion: "ptp.document/1",
  title: "AI-generated service report",
  locale: "en-US",
  paper: { size: "A4", orientation: "portrait" },
  template: "work_report",
  blocks: [
    { type: "heading", level: 1, text: "Service report" },
    { type: "paragraph", text: "Prepared by an AI assistant." },
    { type: "list", style: "bullet", items: ["Inspection complete", "No defects found"] }
  ]
};

const response = await fetch("https://www.pastetoprint.com/api/v2/documents", {
  method: "POST",
  headers: {
    "Content-Type": "application/vnd.pastetoprint.ptdf+json",
    "Idempotency-Key": `ai-${crypto.randomUUID()}`
  },
  body: JSON.stringify(documentData)
});

if (!response.ok) throw new Error(`PasteToPrint API: ${response.status}`);
const result = await response.json();
console.log(result.editorUrl); // Give this temporary URL to the user.

Add Authorization: Bearer ptp_ai_… for provisioned clients and longer TTL tiers. Never put tokens in a URL or document content. Authentication guide →

Integration surface

Use the interface your agent already speaks.

Every path converges on the same validated PTDF document and the same human-controlled editor handoff.

browser

JavaScript SDK

Add a secure “Open in PasteToPrint” handoff to a website without rebuilding the document editor.

assets/js/import-button.js
SDK integration guide
strict

JSON Schema

Validate model output before sending it. The schema defines supported blocks, marks, paper settings and limits.

application/schema+json
Open JSON Schema

Model Context Protocol

Give your AI a document tool.

The local MCP bridge keeps API credentials in the process environment. The model receives focused tools, never the bearer token.

  • list_templatesRead the current presentation catalog.
  • get_document_schema · validate_documentInspect and validate PTDF locally before creating a session.
  • create_documentCreate a temporary editor session from semantic blocks.
  • update_document · get_document_linksUpdate a session safely and retrieve editable or read-only links.
  • Human-controlled outputManaged PTDF may fill only an empty editor with Undo; print and export never start automatically.
Open the complete MCP guide
mcp.json
{
  "mcpServers": {
    "pastetoprint": {
      "command": "node",
      "args": [
        "/path/to/pastetoprint/integrations/mcp/src/server.js"
      ],
      "env": {
        "PASTETOPRINT_API_BASE_URL":
          "https://www.pastetoprint.com",
        "PASTETOPRINT_API_TOKEN":
          "ptp_ai_..."
      }
    }
  }
}
Node.js 20+ Token is optional
AI Ready

Automatic discovery

Tell AI systems what PasteToPrint can do.

The discovery manifest points machines to the canonical OpenAPI contract, documentation, MCP guide, JSON Schema, PTDF specification and the no-POST inline links, PTDF files and the optional local AI-chat extension.

ai.json discoverable
{
  "name": "PasteToPrint",
  "openapi":
    "https://www.pastetoprint.com/api/v2/openapi.yaml",
  "documentation":
    "https://www.pastetoprint.com/ai-agents.html",
  "mcp":
    "https://www.pastetoprint.com/MCP-SERVER.md",
  "inline_text_deep_link": {
    "version": "1",
    "http_post_required": false
  },
  "inline_ptdf_deep_link": {
    "schema_version": "ptp.document/1",
    "http_post_required": false
  },
  "long_document_handoff": {
    "http_post_required": false,
    "requires_user_confirmation": true
  },
  "document_format":
    "https://www.pastetoprint.com/PTDF-1.0.md"
}

Deep links

Use a local fragment for short text or compact PTDF. Use capability or protocol links for API-created sessions.

Can’t inspect the user’s open tab? URL import does not require active-tab, DOM or MCP access. Read the canonical URL import guide →

AI Ready

Let AI create the content.
Let people own the document.