# Create Document ## Create from a template > See the [Create document from template](https://developers.pandadoc.com/docs/create-document-from-template) tutorial for details on how to use this endpoint, as well as a sample template. ## Create from a URL > See the [Create from public PDF](https://developers.pandadoc.com/docs/create-and-send-a-document-from-a-publicly-available-pdf) guide for info about roles and fields, as well as PDF examples. # OpenAPI definition ```json { "openapi": "3.0.3", "info": { "title": "PandaDoc Public API", "description": "PandaDoc API spans a broad range of functionality to help you build incredible documents automation experiences inside your product.\n\nPandaDoc API is organized around REST. Our API has predictable resource-oriented URLs and uses standard HTTP response codes, authentication, and verbs.\n\n## Getting started\n\nYou can start testing PandaDoc API with a sandbox key on our [Enterprise](https://www.pandadoc.com/pricing/) plan, either active or in trial.\n\nGenerate your [sandbox key](https://developers.pandadoc.com/reference/sandbox-key) on the Developer Dashboard with predefined [rate limits](https://developers.pandadoc.com/reference/limits). Or contact our solutions expert if you work with high-transaction volumes.\n\n## Guides\n\nIf you’re just getting started with PandaDoc, you may want to jump straight into one of our [getting started guides](https://developers.pandadoc.com/docs/getting-started) for the feature you’re most interested in, whether that’s:\n\n- [Create from template](https://developers.pandadoc.com/docs/create-send-document),\n- [Upload and send a local PDF](https://developers.pandadoc.com/docs/upload-and-send-a-local-pdf),\n- or [Listening for changes in document status](https://developers.pandadoc.com/docs/listen-document-status-changes).\n\nWe also recommend you to discover our dynamic content generation on a fly: [Create from a template with content placeholder](https://developers.pandadoc.com/docs/create-with-content-placeholders-from-template).\n", "termsOfService": "https://www.pandadoc.com/master-services-agreement/", "contact": { "name": "PandaDoc API Support", "url": "https://developers.pandadoc.com/", "email": "api-track@pandadoc.com" }, "license": { "name": "MIT", "url": "https://github.com/PandaDoc/pandadoc-openapi-specification/blob/main/LICENSE" }, "version": "7.18.2" }, "servers": [ { "url": "https://api.pandadoc.com", "description": "Public API" } ], "security": [ { "apiKey": [] }, { "oauth2": [] } ], "tags": [ { "name": "Documents", "description": "Operations for managing documents, including appending content library items and creating document sessions for embedded signing." } ], "paths": { "/public/v1/documents": { "post": { "tags": [ "Documents" ], "summary": "Create Document", "description": "## Create from a template\n> See the [Create document from template](https://developers.pandadoc.com/docs/create-document-from-template) tutorial for details on how to use this endpoint, as well as a sample template.\n\n## Create from a URL\n> See the [Create from public PDF](https://developers.pandadoc.com/docs/create-and-send-a-document-from-a-publicly-available-pdf) guide for info about roles and fields, as well as PDF examples.\n", "operationId": "createDocument", "parameters": [ { "name": "editor_ver", "in": "query", "deprecated": true, "schema": { "type": "string" }, "example": "ev2", "description": "Set this parameter as `ev1` if you want to create a document from PDF with Classic Editor when both editors are enabled for the workspace." }, { "name": "use_form_field_properties", "in": "query", "schema": { "type": "string" }, "example": "true", "description": "Set this parameter as `yes` or `1` or `true` (only when upload pdf with form fields) if you want to respect form fields properties, like `required`." } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DocumentCreateRequest" }, "examples": { "Simple API Sample": { "summary": "Simple API Sample Document from PandaDoc Template", "value": { "name": "Simple API Sample Document from PandaDoc Template", "template_uuid": "onoznwTq4Y3EELMPyvucnc", "recipients": [ { "email": "josh@example.com", "first_name": "Josh", "last_name": "Ron", "role": "user", "phone": "555-5555-5555", "signing_order": 1, "company": "PandaDoc", "default": false, "delivery_methods": { "sms": true, "email": false }, "redirect": { "is_enabled": true, "url": "https://super.redirect.url/1" }, "verification_settings": { "verification_place": "before_open", "passcode_verification": null, "phone_verification": null, "kba_verification": null, "id_verification": { "enabled": true } } } ], "tokens": [ { "name": "Favorite.Pet", "value": "Panda" } ], "fields": { "Favorite.Color": { "value": "PandaDoc green" }, "Delivery": { "value": "Same Day Delivery" }, "Like": { "value": true }, "Date": { "value": "2019-12-31T00:00:00.000Z" } }, "metadata": { "my_favorite_pet": "Panda" }, "tags": [ "created_via_api", "test_document" ], "images": [ { "name": "Image 1", "urls": [ "https://s3.amazonaws.com/pd-static-content/public-docs/pandadoc-panda-bear.png" ] } ], "pricing_tables": [ { "name": "Pricing Table 1", "data_merge": true, "options": { "Tax": { "type": "percent", "name": "Tax", "value": 10 }, "Fee": { "type": "percent", "name": "Fee", "value": 5 } }, "sections": [ { "title": "Sample Section", "default": true, "rows": [ { "options": { "optional": true, "optional_selected": true, "qty_editable": true }, "data": { "Name": "Toy Panda", "Description": "Fluffy!", "Price": 10, "QTY": 3, "Tax": { "value": 20, "type": "percent" }, "Fee": { "value": 5, "type": "percent" } }, "custom_fields": { "Fluffiness": "5 / 5" } } ] } ] } ] } }, "Full API Sample": { "summary": "Full API Sample Document from PandaDoc Template", "value": { "name": "Full API Sample Document from [PandaDoc] Template", "detect_title_variables": true, "template_uuid": "hryJY9mqYZHjQCYQuSjRQg", "folder_uuid": "QMDSzwabfFzTgjW4kUijqQ", "owner": { "membership_id": "QMDSzwabfFzTgjW6KijHyu" }, "recipients": [ { "email": "josh@example.com", "first_name": "Josh", "last_name": "Ron", "role": "user" } ], "tokens": [ { "name": "Favorite.Pet", "value": "Panda" } ], "fields": { "Favorite.Color": { "value": "PandaDoc green" }, "Delivery": { "value": "Same Day Delivery" }, "Like": { "value": true }, "Date": { "value": "2019-12-31T00:00:00.000Z" } }, "texts": [ { "name": "Legal Terms Section", "data": "## Terms of Service\nThis document outlines the terms and conditions. \n- **Acceptance:** By using our service, you agree to these terms.\n- **Changes:** We may update these terms at any time.\n" } ], "metadata": { "my_favorite_pet": "Panda" }, "tags": [ "created_via_api", "test_document" ], "images": [ { "name": "Image 1", "urls": [ "https://s3.amazonaws.com/pd-static-content/public-docs/pandadoc-panda-bear.png" ] } ], "pricing_tables": [ { "name": "Pricing Table 1", "data_merge": true, "options": { "Tax": { "type": "percent", "name": "Tax", "value": 10 }, "Fee": { "type": "percent", "name": "Fee", "value": 15 } }, "sections": [ { "title": "Sample Section", "default": true, "rows": [ { "options": { "optional": true, "optional_selected": true, "qty_editable": true }, "data": { "Name": "Toy Panda", "Description": "Fluffy!", "Price": 10, "QTY": 3, "Tax": { "value": 20, "type": "percent" }, "Fee": { "value": 15, "type": "percent" } }, "custom_fields": { "Fluffiness": "5 / 5" } } ] } ] } ], "tables": [ { "name": "Table 1", "data": { "sections": [ { "header": [ { "text": "header 1" }, { "text": "header 2" } ], "rows": [ [ { "text": "value 1" }, { "text": "value 2" } ], [ { "text": "value 3" }, { "text": "value 4" } ] ] } ] } } ], "content_placeholders": [ { "block_id": "{block_id}", "content_library_items": [ { "id": "{cli_id}", "pricing_tables": [ { "name": "Pricing Table 1", "data_merge": false, "options": { "discount": { "type": "absolute", "name": "Discount", "value": 2.26 } }, "sections": [ { "title": "Sample Section", "default": true, "rows": [ { "options": { "optional": true, "optional_selected": true, "qty_editable": true }, "data": { "name": "Placeholder Panda", "price": 10, "qty": 3 } } ] } ] } ] }, { "id": "{cli_id_2}", "recipients": [ { "email": "john@example.com", "first_name": "John", "last_name": "Roe", "role": "Signer", "signing_order": 2 } ], "fields": { "Date": { "value": "2019-12-31T00:00:00.000Z" } } } ] } ] } } } } } }, "responses": { "201": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DocumentCreateResponse" }, "examples": { "Document from Template": { "value": { "id": "D3okRfgHRX7NEhavcACReB", "name": "Document from Template", "status": "document.uploaded", "date_created": "2024-07-04T19:27:14.927317Z", "date_modified": "2024-07-04T19:27:14.927317Z", "expiration_date": null, "version": null, "uuid": "D3okRfgHRX7NEhavcACReB", "links": [ { "rel": "status", "href": "https://api.pandadoc.com/public/v1/documents/D3okRfgHRX7NEhavcACReB", "type": "GET" } ], "info_message": "You need to poll the Document Status method until the status will be changed to document.draft" } } } } } }, "400": { "$ref": "#/components/responses/400ValidationError" }, "401": { "$ref": "#/components/responses/401" }, "403": { "$ref": "#/components/responses/403" }, "429": { "$ref": "#/components/responses/429" } } } } }, "components": { "securitySchemes": { "apiKey": { "type": "apiKey", "name": "Authorization", "in": "header", "description": "The `Authorization` header must contain the API key. The value should be prefixed with `API-Key` followed by a space and the actual API key.\n", "x-default": "API-Key 3039ba033eb1410caa0a2227158d63c9d6502cd8" }, "oauth2": { "type": "oauth2", "flows": { "authorizationCode": { "authorizationUrl": "https://app.pandadoc.com/oauth2/authorize", "tokenUrl": "https://api.pandadoc.com/oauth2/access_token", "refreshUrl": "https://api.pandadoc.com/oauth2/access_token", "scopes": { "read+write": "Use `read+write` to create, send, delete, and download documents, and `read` to view templates and document details." } } }, "description": "Send the authenticating user to the PandaDoc OAuth2 request URL. We recommend a button or a link titled\n\"Connect to PandaDoc\" if you are connecting users from a custom application. Users will see the \"Authorize Application\" screen.\nWhen the user clicks \"Authorize\", PandaDoc redirects the user back to your site with an authorization code inside the URL.\n\nhttps://app.pandadoc.com/oauth2/authorize?client_id={client_id}&redirect_uri={redirect_uri}&scope=read+write&response_type=code\n\n`client_id` and `redirect_uri` values should match your application settings.\n" } }, "schemas": { "PricingTableRequest": { "type": "object", "properties": { "name": { "type": "string", "example": "Pricing Table 1" }, "data_merge": { "type": "boolean", "description": "When set to true all field names in data rows must be passed as external names defined in the template." }, "options": { "type": "object", "example": { "currency": "USD", "Discount": { "type": "absolute", "name": "Global Discount", "value": 10 }, "Tax": { "type": "percent", "name": "Tax First", "value": 15 } } }, "sections": { "type": "array", "items": { "type": "object", "properties": { "title": { "type": "string", "example": "Sample Section" }, "default": { "type": "boolean" }, "multichoice_enabled": { "type": "boolean", "default": false }, "rows": { "type": "array", "items": { "type": "object", "properties": { "options": { "type": "object", "title": "Pricing Table Request Row Options", "properties": { "qty_editable": { "type": "boolean" }, "optional_selected": { "type": "boolean" }, "optional": { "type": "boolean" } } }, "data": { "type": "object", "title": "Pricing Table Request Row Data", "example": { "Name": "Toy Panda", "Description": "Fluffy", "Price": 10, "Cost": 8.5, "QTY": 3, "SKU": "toy_panda", "Discount": { "value": 10, "type": "percent" }, "Tax": { "value": 10, "type": "percent" } } }, "custom_fields": { "type": "object", "example": { "Fluffiness": "5/5" } } } } } }, "required": [ "title" ] } } }, "required": [ "name" ] }, "TableCell": { "type": "object", "description": "Defines a single cell in the table, which can appear in either the header or the rows.", "properties": { "text": { "type": "string", "description": "Cell text." }, "col_span": { "type": "integer", "description": "Represents how many columns the cell occupies.", "nullable": true }, "row_span": { "type": "integer", "description": "Represents the number of rows the cell occupies.", "nullable": true } }, "required": [ "text" ] }, "TableRequest": { "type": "object", "properties": { "name": { "type": "string", "description": "Name of the table." }, "data": { "type": "object", "properties": { "sections": { "type": "array", "items": { "type": "object", "properties": { "header": { "type": "array", "items": { "$ref": "#/components/schemas/TableCell" } }, "rows": { "type": "array", "items": { "type": "array", "items": { "$ref": "#/components/schemas/TableCell" } } } }, "required": [ "header", "rows" ] } } }, "required": [ "sections" ] } }, "required": [ "name", "data" ] }, "RecipientDeliveryMethods": { "type": "object", "nullable": true, "properties": { "email": { "type": "boolean" }, "sms": { "type": "boolean" } } }, "RecipientRedirect": { "type": "object", "properties": { "is_enabled": { "type": "boolean", "default": false }, "url": { "type": "string", "nullable": true, "default": null, "example": "https://example.com", "description": "A URL to redirect to after the document is signed." } }, "required": [ "is_enabled", "url" ] }, "BaseActor": { "type": "object", "properties": { "role": { "type": "string", "example": "user", "description": "A recipient's role in the document from the template. A recipient will be added in CC if a role parameter is not provided." }, "signing_order": { "type": "integer", "example": 1, "description": "Set a signing order for a recipient. Learn more: https://developers.pandadoc.com/docs/set-signing-order\n" } } }, "BaseIdentity": { "type": "object", "properties": { "email": { "type": "string", "nullable": true, "example": "josh@example.com", "description": "A recipient's email address." }, "phone": { "type": "string", "nullable": true, "example": "+14842634627", "description": "A recipient's phone number." }, "first_name": { "type": "string", "example": "Josh", "description": "A recipient's first name. We automatically take the first name from contact data if this field is missed." }, "last_name": { "type": "string", "example": "Ron", "description": "A recipient's last name. We automatically take the last name from contact data if this field is missed." } } }, "RecipientVerificationPlaceEnum": { "description": "Specifies when a recipient must complete the verification process:\n- `before_open` (before opening the document),\n- `before_sign` (before signing the document).\n", "type": "string", "enum": [ "before_open", "before_sign" ] }, "RecipientVerificationSettings": { "type": "object", "nullable": true, "description": "To set up recipient verification, fill in verification_place and specify the type: passcode_verification, phone_verification, kba_verification or id_verification.\n- For passcode_verification, provide the passcode.\n- For phone_verification, provide the phone_number.\n- For kba_verification and id_verification, set the enabled parameter to true.\n", "properties": { "verification_place": { "$ref": "#/components/schemas/RecipientVerificationPlaceEnum" }, "passcode_verification": { "type": "object", "description": "Sets the passcode.", "properties": { "passcode": { "type": "string", "pattern": "^(?=(?:.*[a-zA-Z]){1,})(?=(?:.*[0-9]){1,})^[\\S]{6,100}$", "example": "SimpleCode1", "description": "Document passcode." } }, "required": [ "passcode" ], "nullable": true }, "phone_verification": { "type": "object", "description": "Sets the phone number to send a passcode to.", "properties": { "phone_number": { "type": "string", "pattern": "^\\+[1-9]\\d{0,4}\\d{2,14}$", "example": "+1234567890", "description": "A phone number to send a passcode to." } }, "required": [ "phone_number" ] }, "kba_verification": { "type": "object", "description": "Sets the KBA verification.", "properties": { "time_limit_sec": { "type": "integer", "example": 120 }, "score_threshold": { "type": "integer", "example": 80 }, "max_attempts_count": { "type": "integer", "example": 2 } } }, "id_verification": { "type": "object", "description": "Sets the ID verification.", "properties": { "enabled": { "type": "boolean", "example": true } } } } }, "CreateDocumentRecipient": { "title": "Recipient", "allOf": [ { "$ref": "#/components/schemas/BaseActor" }, { "$ref": "#/components/schemas/BaseIdentity" }, { "type": "object", "properties": { "delivery_methods": { "$ref": "#/components/schemas/RecipientDeliveryMethods" }, "redirect": { "$ref": "#/components/schemas/RecipientRedirect" }, "type": { "type": "string", "example": "recipient", "enum": [ "recipient" ] }, "verification_settings": { "$ref": "#/components/schemas/RecipientVerificationSettings" } } } ] }, "CreateDocumentRecipientGroup": { "title": "RecipientGroup", "allOf": [ { "$ref": "#/components/schemas/BaseActor" }, { "type": "object", "properties": { "name": { "type": "string", "maxLength": 120 }, "type": { "type": "string", "example": "recipient_group", "enum": [ "recipient_group" ] }, "members": { "type": "array", "minLength": 1, "items": { "$ref": "#/components/schemas/BaseIdentity" } } }, "required": [ "name", "type" ] } ] }, "CreateDocumentActor": { "anyOf": [ { "$ref": "#/components/schemas/CreateDocumentRecipient" }, { "$ref": "#/components/schemas/CreateDocumentRecipientGroup" } ], "discriminator": { "propertyName": "type", "mapping": { "recipient": "#/components/schemas/CreateDocumentRecipient", "recipient_group": "#/components/schemas/CreateDocumentRecipientGroup" } } }, "DocumentCreateByTemplateRequest": { "type": "object", "required": [ "template_uuid", "recipients" ], "properties": { "template_uuid": { "type": "string", "description": "The ID of a template you want to use. You can copy it from an in app template url such as `https://app.pandadoc.com/a/#/templates/{ID}/content`. A template ID is also obtained by listing templates.", "example": "hryJY9mqYZHjQCYQuSjRQg" }, "fields": { "type": "object", "description": "Set specific values to the fields. This object maps merge field names to their corresponding values.\n\nEach key represents a merge field name, and each value is an object containing the data to populate that field with. The structure allows you to pre-populate various field types including text inputs, checkboxes, dropdowns, and date fields.\n\n**Key Points:**\n- Keys must match the exact merge field names from your template or file.\n- Values must be wrapped in an object with a `value` property.\n- Supported value types: string, number, boolean.\n- Date fields should use RFC 3339 format (e.g., '2019-12-31T00:00:00.000Z').\n- Signature fields cannot be pre-filled.\n\n**Example Usage:**\n- Text field: `\"CustomerName\": {\"value\": \"John Doe\"}`\n- Checkbox: `\"AgreeToTerms\": {\"value\": true}`\n- Date field: `\"DeliveryDate\": {\"value\": \"2019-12-31T00:00:00.000Z\"}`\n", "example": { "Like": { "value": true }, "Delivery": { "value": "Same Day Delivery" }, "Date": { "value": "2019-12-31T00:00:00.000Z" } }, "additionalProperties": { "type": "object", "properties": { "value": { "description": "The value to pre-fill the field with. The type of the value depends on the field type in the template.\nFor example, for a checkbox field, you can pass a boolean value, and for a date field, you can pass a date string in RFC 3339 format (e.g., 2019-12-31T00:00:00.000Z).\n", "oneOf": [ { "type": "boolean" }, { "type": "string" }, { "type": "number" } ] }, "role": { "type": "string", "description": "Assign this field to a recipient role. The role must be present in the `recipients` list.\n", "example": "user" } }, "required": [ "value" ] } }, "images": { "type": "array", "description": "You can pass a list of images to image blocks (one image in one block) for replacement.", "items": { "type": "object", "nullable": true, "properties": { "urls": { "type": "array", "items": { "type": "string" }, "example": [ "https://s3.amazonaws.com/pd-static-content/public-docs/pandadoc-panda-bear.png" ] }, "name": { "type": "string", "example": "Image 1" } }, "required": [ "urls", "name" ] } }, "pricing_tables": { "type": "array", "description": "Information to construct or populate a pricing table can be passed when creating a document. All product information must be passed when creating a new document. Products stored in PandaDoc cannot be used to populate table rows at this time. Keep in mind that this is an array, so multiple table objects can be passed to a document. Make sure that \"Automatically add products to this table\" is enabled in the PandaDoc template pricing tables you wish to populate via API.", "items": { "$ref": "#/components/schemas/PricingTableRequest" } }, "tables": { "type": "array", "description": "Information to construct or populate a table can be passed when creating a document. Keep in mind that this is an array, so multiple table objects can be passed to a document.", "items": { "$ref": "#/components/schemas/TableRequest" } }, "texts": { "type": "array", "description": "You can pass a list of rich text values to pre-fill text blocks in a template. This is useful for inserting dynamic content like introductions or terms and conditions. Markdown is supported.", "items": { "type": "object", "properties": { "name": { "type": "string", "description": "The name of the Text Block to update. This name is defined in the template.", "example": "Legal Terms Section" }, "data": { "type": "string", "description": "The text content to be inserted into the block. Supports markdown.", "example": "## Terms of Service\nThis document outlines the terms and conditions.\n- **Acceptance:** By using our service, you agree to these terms.\n- **Changes:** We may update these terms at any time.\n" } }, "required": [ "name", "data" ] } }, "detect_title_variables": { "type": "boolean", "description": "Set this parameter as true if you want to detect title variables in the document.", "example": true }, "content_placeholders": { "type": "array", "description": "You may replace Content Library Item Placeholders with a few content library items each and pre-fill fields/variables values, pricing table items, and assign recipients to roles from there.", "items": { "type": "object", "properties": { "content_library_items": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "Content library item id", "example": "hryJY9mqYZHjQCYQuSjRQg" }, "fields": { "type": "object" }, "pricing_tables": { "type": "array", "items": { "$ref": "#/components/schemas/PricingTableRequest" } }, "recipients": { "type": "array", "items": { "type": "object", "properties": { "email": { "type": "string", "nullable": true, "example": "josh@example.com" }, "phone": { "type": "string", "nullable": true, "example": "+14842634627" }, "delivery_methods": { "$ref": "#/components/schemas/RecipientDeliveryMethods" }, "first_name": { "type": "string", "example": "Josh" }, "last_name": { "type": "string", "example": "Ron" }, "role": { "type": "string", "example": "user" }, "signing_order": { "type": "integer", "example": 1, "nullable": true }, "redirect": { "$ref": "#/components/schemas/RecipientRedirect" } } } } }, "required": [ "id" ] } }, "block_id": { "type": "string", "description": "Content placeholder block id", "example": "Content Placeholder 1" } }, "required": [ "block_id" ] } }, "name": { "type": "string", "description": "Name the document you are creating.", "example": "API Sample Document from PandaDoc Template" }, "folder_uuid": { "type": "string", "example": "QMDSzwabfFzTgjW4kUijqQ", "description": "ID of the folder where the created document should be stored." }, "owner": { "type": "object", "properties": { "email": { "type": "string", "example": "john.doe@example.com" }, "membership_id": { "type": "string", "example": "QMDSzwabfFzTgjW6KijHyu" } }, "description": "The owner of the document. Pass either `email` or `membership_id` of the user in the workspace.", "example": { "membership_id": "QMDSzwabfFzTgjW6KijHyu" } }, "recipients": { "type": "array", "description": "The list of recipients to whom the document will be sent. Either `email` or `phone` is required. Specifying the `role` assigns all matching fields to the recipient or group. If `first_name` and `last_name` are not specified, the system looks them up in the workspace contacts list using the `email` or `phone number`. If `first_name` and `last_name` are provided, they override the existing contact's data.", "items": { "$ref": "#/components/schemas/CreateDocumentActor" } }, "tokens": { "type": "array", "description": "Also known as variables. Pass values for the variables in the template to render them into the created document or make them available for insertion later.", "items": { "type": "object", "properties": { "name": { "type": "string", "example": "Client.CompanyName" }, "value": { "type": "string", "example": "PandaDoc" } }, "required": [ "name", "value" ] } }, "metadata": { "type": "object", "nullable": true, "description": "You can pass any data in a key-value format to associate it with a document. Searching by metadata is available in the List Documents endpoint and is also included in the Document Details response.", "example": { "lead_id": "1234567", "lead_source": "PandaDoc" } }, "tags": { "type": "array", "description": "Mark your document with one or more tags. Tags are displayed in the UI, and you can filter by tags in the List Documents endpoint.", "items": { "type": "string" }, "example": [ "created_via_api", "test_document", "created_from_source" ] } } }, "DocumentCreateByPdfRequest": { "type": "object", "required": [ "name" ], "properties": { "parse_form_fields": { "type": "boolean", "description": "Set this parameter as `true` if you create a document from a PDF with form fields and as `false` if you upload a PDF with field tags." }, "fields": { "type": "object", "description": "Set specific values to the fields. This object maps merge field names to their corresponding values.\n\nEach key represents a merge field name, and each value is an object containing the data to populate that field with. The structure allows you to pre-populate various field types including text inputs, checkboxes, dropdowns, and date fields.\n\n**Key Points:**\n- Keys must match the exact merge field names from your template or file.\n- Values must be wrapped in an object with a `value` property.\n- Supported value types: string, number, boolean.\n- Date fields should use RFC 3339 format (e.g., '2019-12-31T00:00:00.000Z').\n- Signature fields cannot be pre-filled.\n\n**Example Usage:**\n- Text field: `\"CustomerName\": {\"value\": \"John Doe\"}`\n- Checkbox: `\"AgreeToTerms\": {\"value\": true}`\n- Date field: `\"DeliveryDate\": {\"value\": \"2019-12-31T00:00:00.000Z\"}`\n", "example": { "Like": { "value": true }, "Delivery": { "value": "Same Day Delivery" }, "Date": { "value": "2019-12-31T00:00:00.000Z" } }, "additionalProperties": { "type": "object", "properties": { "value": { "description": "The value to pre-fill the field with. The type of the value depends on the field type in the template.\nFor example, for a checkbox field, you can pass a boolean value, and for a date field, you can pass a date string in RFC 3339 format (e.g., 2019-12-31T00:00:00.000Z).\n", "oneOf": [ { "type": "boolean" }, { "type": "string" }, { "type": "number" } ] }, "role": { "type": "string", "description": "Assign this field to a recipient role. The role must be present in the `recipients` list.\n", "example": "user" } }, "required": [ "value" ] } }, "name": { "type": "string", "description": "Name the document you are creating.", "example": "API Sample Document from PandaDoc Template" }, "folder_uuid": { "type": "string", "example": "QMDSzwabfFzTgjW4kUijqQ", "description": "ID of the folder where the created document should be stored." }, "owner": { "type": "object", "properties": { "email": { "type": "string", "example": "john.doe@example.com" }, "membership_id": { "type": "string", "example": "QMDSzwabfFzTgjW6KijHyu" } }, "description": "The owner of the document. Pass either `email` or `membership_id` of the user in the workspace.", "example": { "membership_id": "QMDSzwabfFzTgjW6KijHyu" } }, "recipients": { "type": "array", "description": "The list of recipients to whom the document will be sent. Either `email` or `phone` is required. Specifying the `role` assigns all matching fields to the recipient or group. If `first_name` and `last_name` are not specified, the system looks them up in the workspace contacts list using the `email` or `phone number`. If `first_name` and `last_name` are provided, they override the existing contact's data.", "items": { "$ref": "#/components/schemas/CreateDocumentActor" } }, "tokens": { "type": "array", "description": "Also known as variables. Pass values for the variables in the template to render them into the created document or make them available for insertion later.", "items": { "type": "object", "properties": { "name": { "type": "string", "example": "Client.CompanyName" }, "value": { "type": "string", "example": "PandaDoc" } }, "required": [ "name", "value" ] } }, "metadata": { "type": "object", "nullable": true, "description": "You can pass any data in a key-value format to associate it with a document. Searching by metadata is available in the List Documents endpoint and is also included in the Document Details response.", "example": { "lead_id": "1234567", "lead_source": "PandaDoc" } }, "tags": { "type": "array", "description": "Mark your document with one or more tags. Tags are displayed in the UI, and you can filter by tags in the List Documents endpoint.", "items": { "type": "string" }, "example": [ "created_via_api", "test_document", "created_from_source" ] } } }, "DocumentCreateRequest": { "oneOf": [ { "allOf": [ { "type": "object", "title": "From PandaDoc Template", "description": "Use a PandaDoc template to create a document.", "properties": { "template_uuid": { "type": "string", "description": "ID of the template you want to use. You can copy it from an in-app template URL such as `https://app.pandadoc.com/a/#/templates/{ID}/content`. A template ID is also obtained by listing templates.", "example": "hryJY9mqYZHjQCYQuSjRQg" } }, "required": [ "template_uuid" ] }, { "$ref": "#/components/schemas/DocumentCreateByTemplateRequest" } ] }, { "allOf": [ { "type": "object", "title": "From File By Url", "description": "Use a URL to create a document.", "properties": { "url": { "type": "string", "example": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf", "description": "Secure (HTTPS) and publicly accessible URL to the PDF document." } }, "required": [ "url" ] }, { "$ref": "#/components/schemas/DocumentCreateByPdfRequest" } ] } ] }, "DocumentStatusEnum": { "type": "string", "enum": [ "document.draft", "document.sent", "document.completed", "document.uploaded", "document.error", "document.viewed", "document.waiting_approval", "document.approved", "document.rejected", "document.waiting_pay", "document.paid", "document.voided", "document.declined", "document.external_review" ], "example": "document.draft" }, "DocumentCreateResponse": { "type": "object", "properties": { "id": { "type": "string", "example": "cKbJ7uay3cEGtsKuGPwYGX" }, "name": { "type": "string", "example": "API Sample Document from PandaDoc Template" }, "status": { "$ref": "#/components/schemas/DocumentStatusEnum" }, "date_created": { "type": "string", "example": "2021-10-08T11:06:32.337395Z" }, "date_modified": { "type": "string", "example": "2021-10-08T11:06:32.337395Z" }, "expiration_date": { "type": "string", "nullable": true, "example": "2021-10-08T11:06:32.337395Z" }, "version": { "type": "string", "nullable": true, "example": "EV2" }, "uuid": { "type": "string", "example": "cKbJ7uay3cEGtsKuGPwYGX" }, "links": { "type": "array", "items": { "type": "object", "properties": { "rel": { "type": "string", "example": "status" }, "href": { "type": "string", "example": "https://api.pandadoc.com/public/v1/documents/jzjCfYgKQYm2u9ctwN6io4" }, "type": { "type": "string", "example": "GET" } } } }, "info_message": { "type": "string", "example": "You need to poll the Document Status method until the status will be changed to document.draft" } } } }, "responses": { "401": { "description": "Authentication error", "content": { "application/json": { "schema": { "properties": { "type": { "type": "string", "example": "authentication_error" }, "detail": { "type": "string", "example": "Authentication credentials were not provided." } } } } } }, "403": { "description": "Permission error", "content": { "application/json": { "schema": { "properties": { "type": { "type": "string", "example": "permission_error" }, "detail": { "type": "string", "example": "You do not have permission to perform this action." }, "info_message": { "type": "string", "description": "Human-readable explanation of the permission error.", "example": "You are not allowed to send documents outside of your organization" }, "links": { "type": "array", "description": "Optional links related to the error (e.g. a status endpoint).", "items": { "type": "object", "properties": { "rel": { "type": "string", "example": "status" }, "href": { "type": "string", "example": "https://api.pandadoc.com/public/v1/documents/RsXrKarV524iCpjci9CMGa" }, "type": { "type": "string", "example": "POST" } } } } } } } } }, "429": { "description": "Too Many Requests", "content": { "application/json": { "schema": { "properties": { "type": { "type": "string", "example": "throttled" }, "detail": { "type": "string", "example": "Request was throttled." } } } } } }, "400ValidationError": { "description": "Bad Request", "content": { "application/json": { "schema": { "properties": { "type": { "type": "string", "example": "validation_error" }, "detail": { "type": "object", "example": { "count": [ "A valid integer is required." ], "order_by": [ "value is not a valid choice." ] } } } } } } } } } } ```