{
  "info": {
    "_postman_id": "5f0c6b1e-7c1d-4d8e-9a57-3b2f7a4e9c10",
    "name": "Mezdoc REST API",
    "description": "Render PDFs from your Mezdoc templates and run workflows. Set the token variable to your API key: sk_live_ for production, sk_test_ for staging, sk_dev_ for development. Keys and webhooks are managed in the dashboard. Reference: https://mezdoc.com/developers",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{token}}",
        "type": "string"
      }
    ]
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://api.mezdoc.com",
      "type": "string"
    },
    {
      "key": "token",
      "value": "sk_test_REPLACE_ME",
      "type": "string"
    },
    {
      "key": "templateAlias",
      "value": "coi_v3",
      "type": "string"
    },
    {
      "key": "submissionId",
      "value": "sub_REPLACE_ME",
      "type": "string"
    },
    {
      "key": "workflowAlias",
      "value": "renewal_packet",
      "type": "string"
    },
    {
      "key": "runId",
      "value": "run_REPLACE_ME",
      "type": "string"
    }
  ],
  "item": [
    {
      "name": "Templates",
      "item": [
        {
          "name": "List templates",
          "request": {
            "method": "GET",
            "description": "Scope template:read. Returns your templates: alias, name, kind, status and live version.",
            "url": {
              "raw": "{{baseUrl}}/api/v1/templates",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "templates"
              ]
            }
          }
        },
        {
          "name": "Get a template and its input schema",
          "request": {
            "method": "GET",
            "description": "Scope template:read. The data keys, types and required flags to send to render.",
            "url": {
              "raw": "{{baseUrl}}/api/v1/templates/{{templateAlias}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "templates",
                "{{templateAlias}}"
              ]
            }
          }
        },
        {
          "name": "Render a PDF",
          "request": {
            "method": "POST",
            "description": "Scope template:render. Returns 200 with the PDF bytes and the X-Mezdoc-Submission-Id header. Reuse an idempotency_key to retry safely: the same key and data return the original submission.",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"data\": {\n    \"insured_name\": \"Harbor Point LLC\",\n    \"each_occurrence\": 1000000,\n    \"effective_date\": \"2026-06-01\"\n  },\n  \"idempotency_key\": \"{{$guid}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/api/v1/templates/{{templateAlias}}/render",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "templates",
                "{{templateAlias}}",
                "render"
              ]
            }
          }
        },
        {
          "name": "Render a PDF and return a URL",
          "request": {
            "method": "POST",
            "description": "Scope template:render. Returns JSON: submission_id, pdf_url, page_count, render_ms. pdf_url needs the same key.",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"data\": {\n    \"insured_name\": \"Harbor Point LLC\",\n    \"each_occurrence\": 1000000,\n    \"effective_date\": \"2026-06-01\"\n  },\n  \"idempotency_key\": \"{{$guid}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/api/v1/templates/{{templateAlias}}/render?return=url",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "templates",
                "{{templateAlias}}",
                "render"
              ],
              "query": [
                {
                  "key": "return",
                  "value": "url"
                }
              ]
            }
          }
        },
        {
          "name": "Render a PDF in the background",
          "request": {
            "method": "POST",
            "description": "Scope template:render. Returns 202 with submission_id, status and poll_url. Poll the submission, or wait for the submission.completed webhook.",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"data\": {\n    \"insured_name\": \"Harbor Point LLC\",\n    \"each_occurrence\": 1000000,\n    \"effective_date\": \"2026-06-01\"\n  },\n  \"idempotency_key\": \"{{$guid}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/api/v1/templates/{{templateAlias}}/render?async=true",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "templates",
                "{{templateAlias}}",
                "render"
              ],
              "query": [
                {
                  "key": "async",
                  "value": "true"
                }
              ]
            }
          }
        }
      ]
    },
    {
      "name": "Submissions",
      "item": [
        {
          "name": "List submissions",
          "request": {
            "method": "GET",
            "description": "Scope submission:read. Newest first. Returns { data, next_cursor }; pass next_cursor as created_before for the next page.",
            "url": {
              "raw": "{{baseUrl}}/api/v1/submissions",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "submissions"
              ],
              "query": [
                {
                  "key": "limit",
                  "value": "50",
                  "description": "1 to 100. Default 50.",
                  "disabled": true
                },
                {
                  "key": "status",
                  "value": "completed",
                  "description": "Filter by status.",
                  "disabled": true
                },
                {
                  "key": "environment",
                  "value": "production",
                  "description": "Filter by environment.",
                  "disabled": true
                },
                {
                  "key": "template",
                  "value": "{{templateAlias}}",
                  "description": "Filter by template alias.",
                  "disabled": true
                },
                {
                  "key": "created_before",
                  "value": "2026-09-27T00:00:00.000Z",
                  "description": "Cursor: ISO timestamp.",
                  "disabled": true
                }
              ]
            }
          }
        },
        {
          "name": "Get a submission",
          "request": {
            "method": "GET",
            "description": "Scope submission:read. Status and metadata. This is the poll_url of an async render; once completed it carries pdf_url.",
            "url": {
              "raw": "{{baseUrl}}/api/v1/submissions/{{submissionId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "submissions",
                "{{submissionId}}"
              ]
            }
          }
        },
        {
          "name": "Download a submission's PDF",
          "request": {
            "method": "GET",
            "description": "Scope submission:read. The PDF bytes. 404 until the render has completed.",
            "url": {
              "raw": "{{baseUrl}}/api/v1/submissions/{{submissionId}}/pdf",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "submissions",
                "{{submissionId}}",
                "pdf"
              ]
            }
          }
        }
      ]
    },
    {
      "name": "Workflow runs",
      "item": [
        {
          "name": "Run a workflow",
          "request": {
            "method": "POST",
            "description": "Scope workflow:run. Body { data } keyed by the workflow's field aliases. Returns run_id, status, page_count, merged_pdf_url, documents and document_pdf_urls.",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"data\": {\n    \"insured_name\": \"Harbor Point LLC\",\n    \"state\": \"TX\"\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/api/v1/workflows/{{workflowAlias}}/runs",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "workflows",
                "{{workflowAlias}}",
                "runs"
              ]
            }
          }
        },
        {
          "name": "Run a workflow in the background",
          "request": {
            "method": "POST",
            "description": "Scope workflow:run. Returns 202 with run_id, status and poll_url. Poll the run, or wait for the workflow.run.completed webhook.",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"data\": {\n    \"insured_name\": \"Harbor Point LLC\",\n    \"state\": \"TX\"\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{baseUrl}}/api/v1/workflows/{{workflowAlias}}/runs?async=true",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "workflows",
                "{{workflowAlias}}",
                "runs"
              ],
              "query": [
                {
                  "key": "async",
                  "value": "true"
                }
              ]
            }
          }
        },
        {
          "name": "Get a run",
          "request": {
            "method": "GET",
            "description": "Scope workflow:run. The run's status. This is the poll_url of an async run.",
            "url": {
              "raw": "{{baseUrl}}/api/v1/workflows/runs/{{runId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "workflows",
                "runs",
                "{{runId}}"
              ]
            }
          }
        },
        {
          "name": "Download a run's PDF",
          "request": {
            "method": "GET",
            "description": "Scope workflow:run. doc=merged for the merged packet, a number (0, 1, ...) for one document, or zip for every file.",
            "url": {
              "raw": "{{baseUrl}}/api/v1/workflows/runs/{{runId}}/pdf?doc=merged",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "workflows",
                "runs",
                "{{runId}}",
                "pdf"
              ],
              "query": [
                {
                  "key": "doc",
                  "value": "merged"
                }
              ]
            }
          }
        }
      ]
    }
  ]
}
