{
  "openapi": "3.1.0",
  "info": {
    "title": "DocAISign API",
    "version": "1.2.0",
    "description": "Send documents for e-signature, follow them and download signed PDFs. Authenticate with an API key from https://docaisign.com/account/developer as a Bearer token. Test mode (a dsk_test_ key, the X-Test-Mode: true header or testMode: true) makes free, watermarked envelopes that are not legally binding. The same key works with the MCP server at https://docaisign.com/mcp.",
    "contact": {
      "url": "https://docaisign.com/developers"
    }
  },
  "servers": [
    {
      "url": "https://docaisign.com/api/v1"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "tags": [
    {
      "name": "Account"
    },
    {
      "name": "Envelopes"
    },
    {
      "name": "Templates"
    },
    {
      "name": "Bulk send"
    },
    {
      "name": "Webhook"
    }
  ],
  "paths": {
    "/me": {
      "get": {
        "tags": [
          "Account"
        ],
        "operationId": "getMe",
        "summary": "The account the key belongs to",
        "responses": {
          "200": {
            "description": "Account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Me"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/envelopes": {
      "get": {
        "tags": [
          "Envelopes"
        ],
        "operationId": "listEnvelopes",
        "summary": "List envelopes, newest first",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "sent",
                "completed",
                "voided",
                "expired",
                "declined"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Envelopes",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Envelope"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Envelopes"
        ],
        "operationId": "createEnvelope",
        "summary": "Create and (by default) send an envelope",
        "parameters": [
          {
            "$ref": "#/components/parameters/TestMode"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnvelopeIn"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvelopeDetail"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/envelopes/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "tags": [
          "Envelopes"
        ],
        "operationId": "getEnvelope",
        "summary": "Envelope, recipients and fields",
        "responses": {
          "200": {
            "description": "Envelope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvelopeDetail"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "tags": [
          "Envelopes"
        ],
        "operationId": "deleteEnvelope",
        "summary": "Delete a draft, or the files of a finished envelope (void one that is out first)",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Ok"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/envelopes/{id}/send": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "post": {
        "tags": [
          "Envelopes"
        ],
        "operationId": "sendEnvelope",
        "summary": "Send a draft",
        "responses": {
          "200": {
            "description": "Sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvelopeDetail"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/envelopes/{id}/recipients/{slot}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        },
        {
          "name": "slot",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer",
            "minimum": 1
          }
        }
      ],
      "put": {
        "tags": [
          "Envelopes"
        ],
        "operationId": "updateRecipient",
        "summary": "Change a recipient's name or email (on a sent envelope they get a new link and the old one stops)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string",
                    "format": "email"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvelopeDetail"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/envelopes/{id}/remind": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "post": {
        "tags": [
          "Envelopes"
        ],
        "operationId": "remind",
        "summary": "Email a reminder (one recipient by slot, or everyone whose turn it is). At most every 10 minutes",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "slot": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/Ok"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/envelopes/{id}/resend": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "post": {
        "tags": [
          "Envelopes"
        ],
        "operationId": "resend",
        "summary": "Same as remind; slot 0 = everyone whose turn it is",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "slot": {
                    "type": "integer"
                  }
                },
                "required": [
                  "slot"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/Ok"
          }
        }
      }
    },
    "/envelopes/{id}/extend": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "post": {
        "tags": [
          "Envelopes"
        ],
        "operationId": "extend",
        "summary": "More time for every open signing link",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "days": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 120
                  }
                },
                "required": [
                  "days"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Extended",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvelopeDetail"
                }
              }
            }
          }
        }
      }
    },
    "/envelopes/{id}/void": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "post": {
        "tags": [
          "Envelopes"
        ],
        "operationId": "voidEnvelope",
        "summary": "Cancel an envelope that is out; every open link stops",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Voided",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvelopeDetail"
                }
              }
            }
          }
        }
      }
    },
    "/envelopes/{id}/edit-url": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "post": {
        "tags": [
          "Envelopes"
        ],
        "operationId": "editUrl",
        "summary": "Embedded sending: a link to the editor for a draft, to show in an iframe on one website. Valid 4 hours, for this draft only",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "embedOrigin": {
                    "type": "string",
                    "format": "uri",
                    "description": "Exact https origin allowed to frame the editor, such as https://app.example.com. The page posts {source:'docaisign', event, envelopeId} to the parent: ready, sent, scheduled, signed."
                  }
                },
                "required": [
                  "embedOrigin"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Link",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/envelopes/{id}/signing-url": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "post": {
        "tags": [
          "Envelopes"
        ],
        "operationId": "signingUrl",
        "summary": "Embedded signing: a link that signs as one recipient. Use returnUrl for a redirect (?event=signing_complete|decline|reassign), or embedOrigin to show it in an iframe on one website",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "slot": {
                    "type": "integer"
                  },
                  "returnUrl": {
                    "type": "string",
                    "format": "uri"
                  },
                  "embedOrigin": {
                    "type": "string",
                    "format": "uri",
                    "description": "Exact https origin allowed to frame the link, such as https://app.example.com. Not with returnUrl. A recipient with an access code enters it inside the iframe. The page posts {source:'docaisign', event} to the parent: ready, signing_complete, decline, reassign."
                  }
                },
                "required": [
                  "slot"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Link",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/envelopes/{id}/documents/{kind}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        },
        {
          "name": "kind",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "enum": [
              "signed",
              "certificate",
              "combined",
              "current",
              "original"
            ]
          }
        }
      ],
      "get": {
        "tags": [
          "Envelopes"
        ],
        "operationId": "download",
        "summary": "Download a PDF",
        "responses": {
          "200": {
            "description": "PDF",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/templates": {
      "get": {
        "tags": [
          "Templates"
        ],
        "operationId": "listTemplates",
        "summary": "Templates and their roles",
        "responses": {
          "200": {
            "description": "Templates",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TemplateSummary"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Templates"
        ],
        "operationId": "createTemplate",
        "summary": "Create a template from a document; recipients become roles (names and emails may be empty)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TemplateIn"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Template"
                }
              }
            }
          }
        }
      }
    },
    "/templates/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "tags": [
          "Templates"
        ],
        "operationId": "getTemplate",
        "summary": "Roles and fields",
        "responses": {
          "200": {
            "description": "Template",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Template"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "tags": [
          "Templates"
        ],
        "operationId": "deleteTemplate",
        "summary": "Delete a template",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Ok"
          }
        }
      }
    },
    "/templates/{id}/export": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "tags": [
          "Templates"
        ],
        "operationId": "exportTemplate",
        "summary": "Export a template as one JSON file",
        "description": "The same file as Export on the templates page: the PDF (base64), roles, fields with their rules, and envelope settings. Access codes are never exported.",
        "responses": {
          "200": {
            "description": "Template file",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplateFile"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/templates/import": {
      "post": {
        "tags": [
          "Templates"
        ],
        "operationId": "importTemplate",
        "summary": "Create a template from an exported file",
        "description": "Send the JSON from GET /templates/{id}/export as the body (up to 30 MB). Set access codes again afterwards.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TemplateFile"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Template",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Template"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/bulk-sends": {
      "get": {
        "tags": [
          "Bulk send"
        ],
        "operationId": "listBulkSends",
        "summary": "Bulk sends with counts",
        "responses": {
          "200": {
            "description": "Batches",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BulkSummary"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Bulk send"
        ],
        "operationId": "createBulkSend",
        "summary": "One envelope per row from a template (up to 100 rows)",
        "parameters": [
          {
            "$ref": "#/components/parameters/TestMode"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkIn"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Per-row results",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkResult"
                }
              }
            }
          }
        }
      }
    },
    "/bulk-sends/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/Id"
        }
      ],
      "get": {
        "tags": [
          "Bulk send"
        ],
        "operationId": "getBulkSend",
        "summary": "The envelopes of one bulk send",
        "responses": {
          "200": {
            "description": "Batch",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "envelopes": {
                      "type": "integer"
                    },
                    "completed": {
                      "type": "integer"
                    },
                    "waiting": {
                      "type": "integer"
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Envelope"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/webhook": {
      "get": {
        "tags": [
          "Webhook"
        ],
        "operationId": "getWebhook",
        "summary": "Webhook URL and events",
        "responses": {
          "200": {
            "description": "Webhook",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Webhook"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Webhook"
        ],
        "operationId": "setWebhook",
        "summary": "Set the webhook; the signing secret is returned once, when it is created",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/EventName"
                    }
                  }
                },
                "required": [
                  "url"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Webhook"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Webhook"
        ],
        "operationId": "deleteWebhook",
        "summary": "Remove the webhook",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Ok"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "dsk_... (live) or dsk_test_... (test) key"
      }
    },
    "parameters": {
      "Id": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "maxLength": 24
        }
      },
      "TestMode": {
        "name": "X-Test-Mode",
        "in": "header",
        "schema": {
          "type": "string",
          "enum": [
            "true",
            "false"
          ]
        },
        "description": "true makes a test envelope (wins over testMode in the body)"
      }
    },
    "responses": {
      "Error": {
        "description": "Error",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "Ok": {
        "description": "Done",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "ok": {
                  "type": "boolean"
                }
              }
            }
          }
        }
      }
    },
    "schemas": {
      "Me": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "company": {
            "type": [
              "string",
              "null"
            ]
          },
          "plan": {
            "type": "string"
          },
          "emailConfirmed": {
            "type": "boolean"
          },
          "testKey": {
            "type": "boolean"
          }
        }
      },
      "Document": {
        "type": "object",
        "description": "base64 or url (https, public, up to 20 MB). PDF, DOCX, DOC, JPEG or PNG.",
        "properties": {
          "name": {
            "type": "string",
            "description": "File name with extension"
          },
          "base64": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "RecipientIn": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "role": {
            "type": "string",
            "enum": [
              "signer",
              "viewer",
              "cc"
            ],
            "default": "signer"
          },
          "routingOrder": {
            "type": "integer",
            "minimum": 1,
            "description": "Same number = at the same time"
          },
          "accessCode": {
            "type": "string"
          },
          "emailCode": {
            "type": "boolean",
            "description": "Email the recipient a one-time 6-digit code that they must enter before the document opens. Not together with accessCode."
          },
          "note": {
            "type": "string"
          },
          "language": {
            "type": "string",
            "enum": [
              "en",
              "zh",
              "es",
              "fr",
              "de"
            ]
          },
          "witnessFor": {
            "type": "integer",
            "description": "This person witnesses that recipient (1-based)"
          }
        }
      },
      "FieldIn": {
        "type": "object",
        "required": [
          "recipient"
        ],
        "properties": {
          "recipient": {
            "type": "integer",
            "description": "1-based position in recipients; 0 = the sender"
          },
          "type": {
            "type": "string",
            "enum": [
              "signature",
              "initials",
              "date",
              "name",
              "email",
              "company",
              "title",
              "text",
              "number",
              "checkbox",
              "radio",
              "dropdown",
              "attachment",
              "stamp",
              "formula",
              "note"
            ],
            "default": "signature"
          },
          "page": {
            "type": "integer"
          },
          "x": {
            "type": "number"
          },
          "y": {
            "type": "number"
          },
          "w": {
            "type": "number"
          },
          "h": {
            "type": "number"
          },
          "required": {
            "type": "boolean"
          },
          "label": {
            "type": "string"
          },
          "options": {
            "type": "string",
            "description": "Dropdown choices, one per line"
          },
          "value": {
            "type": "string",
            "description": "For the sender's own fields"
          },
          "anchor": {
            "type": "string",
            "description": "Place at every occurrence of this text; offsets and size in points"
          },
          "anchorXOffset": {
            "type": "number"
          },
          "anchorYOffset": {
            "type": "number"
          },
          "anchorIgnoreIfNotPresent": {
            "type": "boolean"
          }
        }
      },
      "EnvelopeIn": {
        "type": "object",
        "properties": {
          "templateId": {
            "type": "string"
          },
          "document": {
            "$ref": "#/components/schemas/Document"
          },
          "recipients": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecipientIn"
            },
            "maxItems": 20
          },
          "fields": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FieldIn"
            }
          },
          "withSignaturePage": {
            "type": "boolean",
            "description": "Add a page with a signature and date box per signer"
          },
          "subject": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "expireDays": {
            "type": "integer",
            "minimum": 1,
            "maximum": 120
          },
          "reminderDays": {
            "type": "integer"
          },
          "allowReassign": {
            "type": "boolean",
            "description": "false stops signers from assigning their part to someone else (default true)"
          },
          "sequential": {
            "type": "boolean"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "maxProperties": 10
          },
          "fieldValues": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Your own fields (recipient 0) by label, for templates and for documents with {{text:0:Label}} tags"
          },
          "sendAt": {
            "type": "string",
            "format": "date-time"
          },
          "send": {
            "type": "boolean",
            "default": true
          },
          "testMode": {
            "type": "boolean"
          },
          "textTags": {
            "type": "boolean",
            "description": "Turn {{type:recipient}} tags in the document into fields and cover them (see /developers#text-tags)"
          },
          "autoSignaturePage": {
            "type": "boolean",
            "description": "Add a signature page only when there are no fields and no text tags"
          }
        }
      },
      "Envelope": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "sent",
              "completed",
              "voided",
              "expired",
              "declined"
            ]
          },
          "subject": {
            "type": "string"
          },
          "fileName": {
            "type": "string"
          },
          "pages": {
            "type": "integer"
          },
          "createdAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "sentAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "voidedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "voidReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "signedSha256": {
            "type": [
              "string",
              "null"
            ]
          },
          "batchId": {
            "type": [
              "string",
              "null"
            ]
          },
          "scheduledSendAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "testMode": {
            "type": "boolean"
          },
          "metadata": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      },
      "Recipient": {
        "type": "object",
        "properties": {
          "slot": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "role": {
            "type": "string"
          },
          "routingOrder": {
            "type": "integer"
          },
          "status": {
            "type": "string",
            "enum": [
              "created",
              "sent",
              "delivered",
              "completed",
              "declined",
              "expired",
              "revoked"
            ]
          },
          "sentAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "deliveredAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "completedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "declineReason": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "Field": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "recipient": {
            "type": "integer"
          },
          "type": {
            "type": "string"
          },
          "page": {
            "type": "integer"
          },
          "x": {
            "type": "number"
          },
          "y": {
            "type": "number"
          },
          "w": {
            "type": "number"
          },
          "h": {
            "type": "number"
          },
          "required": {
            "type": "boolean"
          },
          "label": {
            "type": [
              "string",
              "null"
            ]
          },
          "filled": {
            "type": "boolean"
          },
          "value": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "EnvelopeDetail": {
        "type": "object",
        "properties": {
          "envelope": {
            "$ref": "#/components/schemas/Envelope"
          },
          "recipients": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Recipient"
            }
          },
          "fields": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Field"
            }
          }
        }
      },
      "TemplateIn": {
        "type": "object",
        "required": [
          "document"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "document": {
            "$ref": "#/components/schemas/Document"
          },
          "recipients": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecipientIn"
            }
          },
          "fields": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FieldIn"
            }
          },
          "withSignaturePage": {
            "type": "boolean"
          },
          "subject": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "expireDays": {
            "type": "integer"
          },
          "reminderDays": {
            "type": "integer"
          },
          "sequential": {
            "type": "boolean"
          },
          "textTags": {
            "type": "boolean"
          }
        }
      },
      "TemplateSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "fileName": {
            "type": "string"
          },
          "pages": {
            "type": "integer"
          },
          "sequential": {
            "type": "boolean"
          },
          "recipients": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "slot": {
                  "type": "integer"
                },
                "name": {
                  "type": "string"
                },
                "email": {
                  "type": "string"
                },
                "role": {
                  "type": "string"
                },
                "routingOrder": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "Template": {
        "allOf": [
          {
            "$ref": "#/components/schemas/TemplateSummary"
          },
          {
            "type": "object",
            "properties": {
              "subject": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "message": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "publicLink": {
                "type": "boolean"
              },
              "fields": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Field"
                }
              }
            }
          }
        ]
      },
      "BulkIn": {
        "type": "object",
        "required": [
          "templateId",
          "rows"
        ],
        "properties": {
          "templateId": {
            "type": "string"
          },
          "testMode": {
            "type": "boolean"
          },
          "rows": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "object",
              "required": [
                "name",
                "email"
              ],
              "properties": {
                "name": {
                  "type": "string"
                },
                "email": {
                  "type": "string"
                },
                "values": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      },
      "BulkResult": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "templateId": {
            "type": "string"
          },
          "sent": {
            "type": "integer"
          },
          "failed": {
            "type": "integer"
          },
          "rows": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "row": {
                  "type": "integer"
                },
                "name": {
                  "type": "string"
                },
                "email": {
                  "type": "string"
                },
                "ok": {
                  "type": "boolean"
                },
                "error": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "envelopeId": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          }
        }
      },
      "BulkSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "templateId": {
            "type": [
              "string",
              "null"
            ]
          },
          "templateName": {
            "type": [
              "string",
              "null"
            ]
          },
          "envelopes": {
            "type": "integer"
          },
          "completed": {
            "type": "integer"
          },
          "waiting": {
            "type": "integer"
          },
          "testMode": {
            "type": "boolean"
          }
        }
      },
      "EventName": {
        "type": "string",
        "enum": [
          "envelope-sent",
          "recipient-sent",
          "recipient-delivered",
          "recipient-completed",
          "recipient-declined",
          "envelope-completed",
          "envelope-declined",
          "envelope-voided",
          "envelope-expired",
          "recipient-corrected",
          "recipient-reassigned"
        ]
      },
      "Webhook": {
        "type": "object",
        "properties": {
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventName"
            }
          },
          "secret": {
            "type": [
              "string",
              "null"
            ],
            "description": "Only when first created"
          }
        }
      },
      "TemplateFile": {
        "type": "object",
        "required": [
          "format",
          "version",
          "name",
          "fileName",
          "pdf",
          "recipients",
          "fields"
        ],
        "properties": {
          "format": {
            "type": "string",
            "const": "docaisign-template"
          },
          "version": {
            "type": "integer",
            "const": 1
          },
          "name": {
            "type": "string"
          },
          "fileName": {
            "type": "string"
          },
          "pdf": {
            "type": "string",
            "contentEncoding": "base64"
          },
          "subject": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "expireDays": {
            "type": "integer"
          },
          "reminderDays": {
            "type": "integer"
          },
          "sequential": {
            "type": "boolean"
          },
          "allowPaper": {
            "type": "boolean"
          },
          "allowReassign": {
            "type": "boolean"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "recipients": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "slot": {
                  "type": "integer"
                },
                "name": {
                  "type": "string"
                },
                "email": {
                  "type": "string"
                },
                "role": {
                  "type": "string"
                },
                "routingOrder": {
                  "type": "integer"
                },
                "note": {
                  "type": "string"
                },
                "language": {
                  "type": "string"
                },
                "members": {
                  "type": "string"
                },
                "witnessFor": {
                  "type": "integer"
                }
              }
            }
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "recipient": {
                  "type": "integer"
                },
                "type": {
                  "type": "string"
                },
                "page": {
                  "type": "integer"
                },
                "x": {
                  "type": "number"
                },
                "y": {
                  "type": "number"
                },
                "w": {
                  "type": "number"
                },
                "h": {
                  "type": "number"
                },
                "required": {
                  "type": "boolean"
                },
                "label": {
                  "type": "string"
                },
                "options": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                },
                "validation": {
                  "type": "string"
                },
                "maxLength": {
                  "type": "integer"
                },
                "conditionKey": {
                  "type": "string"
                },
                "conditionValue": {
                  "type": "string"
                }
              }
            }
          },
          "note": {
            "type": "string"
          }
        }
      }
    }
  }
}
