{
  "info": {
    "name": "ParseKit API",
    "description": "Postman collection for the ParseKit API — document conversion and extraction.\n\n## Setup\n1. Set `base_url` (default: `https://api.parsekit.dev`)\n2. Set `api_key` to your API key from the dashboard\n3. Run **Authorize** — the bearer token is saved automatically\n\n## Workflow\n1. **Authorize** — exchange your API key for a bearer token (1 hour)\n2. **Upload** a file — copy the `file_id` from the response\n3. Paste `file_id` into a **/convert** or **/extract** request body\n4. **Poll** GET /job/:id until status is `complete`\n5. **Download** the result from `output_url`\n\n## Notes\n- Provide either `file_id` or `file_url` in each request, not both\n- `from` is optional — the API auto-detects from the file extension\n- Max file size: 25 MB\n- Files auto-delete after 2 hours\n- Bearer tokens expire after 1 hour",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "base_url", "value": "https://api.parsekit.dev", "type": "string" },
    { "key": "api_key", "value": "YOUR_API_KEY_HERE", "type": "string" },
    { "key": "access_token", "value": "", "type": "string" }
  ],
  "auth": {
    "type": "bearer",
    "bearer": [{ "key": "token", "value": "{{access_token}}", "type": "string" }]
  },
  "item": [
    {
      "name": "Auth",
      "item": [
        {
          "name": "Authorize",
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "const res = pm.response.json();",
                  "if (res.access_token) {",
                  "  pm.collectionVariables.set('access_token', res.access_token);",
                  "  console.log('Bearer token saved. Expires in ' + res.expires_in + 's');",
                  "} else {",
                  "  console.error('Authorization failed:', JSON.stringify(res));",
                  "}"
                ],
                "type": "text/javascript"
              }
            }
          ],
          "request": {
            "auth": { "type": "noauth" },
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"api_key\": \"{{api_key}}\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/authorize",
              "host": ["{{base_url}}"],
              "path": ["authorize"]
            },
            "description": "Exchange your API key for a short-lived bearer token (1 hour).\n\nThe token is automatically saved to the `access_token` collection variable."
          }
        }
      ]
    },
    {
      "name": "Upload",
      "item": [
        {
          "name": "Upload File",
          "request": {
            "method": "POST",
            "header": [],
            "body": {
              "mode": "formdata",
              "formdata": [
                {
                  "key": "file",
                  "type": "file",
                  "src": "",
                  "description": "Select a file: PDF, DOCX, DOC, HTML, MD, TXT, PNG, JPG, JPEG, GIF, WEBP, TIFF (max 25 MB)"
                }
              ]
            },
            "url": {
              "raw": "{{base_url}}/upload",
              "host": ["{{base_url}}"],
              "path": ["upload"]
            },
            "description": "Upload a file for processing.\n\nCopy `file_id` from the response and paste it into your /convert or /extract request.\n\nFiles are encrypted (AES-256) and auto-deleted after 2 hours."
          }
        }
      ]
    },
    {
      "name": "Convert",
      "description": "Convert documents between formats.\n\nPaste the `file_id` from your upload response, or provide a `file_url`. Set `from` and `to` for the conversion type.",
      "item": [
        {
          "name": "PDF → Text",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"file_id\": \"\",\n  \"from\": \"pdf\",\n  \"to\": \"text\"\n}" },
            "url": { "raw": "{{base_url}}/convert", "host": ["{{base_url}}"], "path": ["convert"] },
            "description": "Extract text from a PDF. Falls back to OCR for scanned documents.\n\nPaste your file_id or replace with file_url."
          }
        },
        {
          "name": "PDF → Images",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"file_id\": \"\",\n  \"from\": \"pdf\",\n  \"to\": \"images\"\n}" },
            "url": { "raw": "{{base_url}}/convert", "host": ["{{base_url}}"], "path": ["convert"] },
            "description": "Render each PDF page as a PNG image. Multi-page PDFs return a .zip archive."
          }
        },
        {
          "name": "PDF → HTML",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"file_id\": \"\",\n  \"from\": \"pdf\",\n  \"to\": \"html\"\n}" },
            "url": { "raw": "{{base_url}}/convert", "host": ["{{base_url}}"], "path": ["convert"] },
            "description": "Convert PDF content to HTML."
          }
        },
        {
          "name": "DOCX → PDF",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"file_id\": \"\",\n  \"from\": \"docx\",\n  \"to\": \"pdf\"\n}" },
            "url": { "raw": "{{base_url}}/convert", "host": ["{{base_url}}"], "path": ["convert"] },
            "description": "Convert a Word document (.docx) to PDF."
          }
        },
        {
          "name": "DOCX → Text",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"file_id\": \"\",\n  \"from\": \"docx\",\n  \"to\": \"text\"\n}" },
            "url": { "raw": "{{base_url}}/convert", "host": ["{{base_url}}"], "path": ["convert"] },
            "description": "Extract raw text from a Word document (.docx)."
          }
        },
        {
          "name": "DOCX → HTML",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"file_id\": \"\",\n  \"from\": \"docx\",\n  \"to\": \"html\"\n}" },
            "url": { "raw": "{{base_url}}/convert", "host": ["{{base_url}}"], "path": ["convert"] },
            "description": "Convert a Word document (.docx) to HTML."
          }
        },
        {
          "name": "HTML → PDF",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"file_id\": \"\",\n  \"from\": \"html\",\n  \"to\": \"pdf\"\n}" },
            "url": { "raw": "{{base_url}}/convert", "host": ["{{base_url}}"], "path": ["convert"] },
            "description": "Render HTML to PDF using a headless browser."
          }
        },
        {
          "name": "HTML → Markdown",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"file_id\": \"\",\n  \"from\": \"html\",\n  \"to\": \"markdown\"\n}" },
            "url": { "raw": "{{base_url}}/convert", "host": ["{{base_url}}"], "path": ["convert"] },
            "description": "Convert HTML to Markdown."
          }
        },
        {
          "name": "HTML → Text",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"file_id\": \"\",\n  \"from\": \"html\",\n  \"to\": \"text\"\n}" },
            "url": { "raw": "{{base_url}}/convert", "host": ["{{base_url}}"], "path": ["convert"] },
            "description": "Strip HTML tags and extract plain text."
          }
        },
        {
          "name": "Markdown → HTML",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"file_id\": \"\",\n  \"from\": \"markdown\",\n  \"to\": \"html\"\n}" },
            "url": { "raw": "{{base_url}}/convert", "host": ["{{base_url}}"], "path": ["convert"] },
            "description": "Render Markdown to HTML."
          }
        },
        {
          "name": "Markdown → PDF",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"file_id\": \"\",\n  \"from\": \"markdown\",\n  \"to\": \"pdf\"\n}" },
            "url": { "raw": "{{base_url}}/convert", "host": ["{{base_url}}"], "path": ["convert"] },
            "description": "Render Markdown to PDF."
          }
        },
        {
          "name": "Image → Text (OCR)",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"file_id\": \"\",\n  \"from\": \"image\",\n  \"to\": \"text\"\n}" },
            "url": { "raw": "{{base_url}}/convert", "host": ["{{base_url}}"], "path": ["convert"] },
            "description": "Extract text from an image using OCR (Tesseract)."
          }
        },
        {
          "name": "Image → PDF",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"file_id\": \"\",\n  \"from\": \"image\",\n  \"to\": \"pdf\"\n}" },
            "url": { "raw": "{{base_url}}/convert", "host": ["{{base_url}}"], "path": ["convert"] },
            "description": "Embed an image into a PDF document."
          }
        },
        {
          "name": "TXT → PDF",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"file_id\": \"\",\n  \"from\": \"txt\",\n  \"to\": \"pdf\"\n}" },
            "url": { "raw": "{{base_url}}/convert", "host": ["{{base_url}}"], "path": ["convert"] },
            "description": "Render plain text as a PDF document."
          }
        },
        {
          "name": "TXT → Markdown",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"file_id\": \"\",\n  \"from\": \"txt\",\n  \"to\": \"markdown\"\n}" },
            "url": { "raw": "{{base_url}}/convert", "host": ["{{base_url}}"], "path": ["convert"] },
            "description": "Convert plain text to Markdown."
          }
        }
      ]
    },
    {
      "name": "Extract",
      "description": "Extract content from documents.\n\nPaste the `file_id` from your upload response, or provide a `file_url`. Choose a format: text, chunks, or structured.",
      "item": [
        {
          "name": "Extract — Text",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"file_id\": \"\",\n  \"format\": \"text\"\n}" },
            "url": { "raw": "{{base_url}}/extract", "host": ["{{base_url}}"], "path": ["extract"] },
            "description": "Extract the full document as clean plain text."
          }
        },
        {
          "name": "Extract — Chunks",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"file_id\": \"\",\n  \"format\": \"chunks\"\n}" },
            "url": { "raw": "{{base_url}}/extract", "host": ["{{base_url}}"], "path": ["extract"] },
            "description": "Extract text split into paragraph-level chunks for RAG pipelines."
          }
        },
        {
          "name": "Extract — Structured",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"file_id\": \"\",\n  \"format\": \"structured\"\n}" },
            "url": { "raw": "{{base_url}}/extract", "host": ["{{base_url}}"], "path": ["extract"] },
            "description": "Extract structured JSON with title, sections, tables, and metadata."
          }
        }
      ]
    },
    {
      "name": "Jobs",
      "description": "Check job status and list recent jobs.\n\nPoll GET /job/:id until status is `complete` or `failed`.\n\nWhen complete, download the result from `output_url` (signed URL, expires in 2 hours).",
      "item": [
        {
          "name": "Get Job Status",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{base_url}}/job/PASTE_JOB_ID_HERE",
              "host": ["{{base_url}}"],
              "path": ["job", "PASTE_JOB_ID_HERE"]
            },
            "description": "Poll a job by ID. Replace PASTE_JOB_ID_HERE with the job_id from a convert/extract response."
          }
        },
        {
          "name": "List Recent Jobs",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{base_url}}/jobs?take=10",
              "host": ["{{base_url}}"],
              "path": ["jobs"],
              "query": [
                { "key": "take", "value": "10" }
              ]
            },
            "description": "List your most recent jobs. Supports pagination with ?take=N&cursor=ID."
          }
        }
      ]
    },
    {
      "name": "Account",
      "item": [
        {
          "name": "Get Me",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{base_url}}/auth/me",
              "host": ["{{base_url}}"],
              "path": ["auth", "me"]
            },
            "description": "Get your account info, plan, usage, and API keys."
          }
        },
        {
          "name": "Health Check",
          "request": {
            "auth": { "type": "noauth" },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{base_url}}/health",
              "host": ["{{base_url}}"],
              "path": ["health"]
            },
            "description": "Check if the API is running. No auth required."
          }
        }
      ]
    }
  ]
}
