{
  "openapi": "3.1.0",
  "info": {
    "title": "JustDocs API",
    "version": "1",
    "description": "Start documents from a workspace's templates, send them for signature, collect details through intake links, and follow what happens.\n\nAuthenticate with a workspace key (Teams & Platform plan) as `Authorization: Bearer <key>`. Keys carry permissions (`read`, `documents`, `send`), may be limited to recipient domains and a daily number of sends, expire, and can be revoked.\n\nAn agent key's sends, and those of a key made to need approval, wait for an owner or admin to approve them (`202`, with an `approval`); a pending approval expires after 7 days.\n\nNothing in the API signs for anyone, and no response carries a recipient's signing link: recipients sign from the private link JustDocs emails them.\n\nThe same commands are tools on the MCP server at https://tryjustdocs.com/mcp (Streamable HTTP, agent keys), named as each operationId here.",
    "contact": {
      "name": "JustDocs support",
      "email": "support@tryjustdocs.com",
      "url": "https://tryjustdocs.com/for/developers"
    },
    "termsOfService": "https://tryjustdocs.com/tos"
  },
  "servers": [
    {
      "url": "https://tryjustdocs.com/api/v1"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "tags": [
    {
      "name": "Templates"
    },
    {
      "name": "Documents"
    },
    {
      "name": "Signing requests"
    },
    {
      "name": "Intake links"
    },
    {
      "name": "Approvals"
    }
  ],
  "paths": {
    "/templates": {
      "get": {
        "operationId": "list_templates",
        "tags": [
          "Templates"
        ],
        "summary": "List templates",
        "description": "100 at a time, newest first. Needs the `read` permission.",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "The `next_cursor` of the previous page."
          }
        ],
        "responses": {
          "200": {
            "description": "A page of templates.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "templates": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TemplateSummary"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "No key, or a key that is unknown, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the permission, or the plan doesn't include the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 120 calls a minute through this key, or its daily send limit reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/templates/{id}": {
      "get": {
        "operationId": "get_template",
        "tags": [
          "Templates"
        ],
        "summary": "Get a template",
        "description": "With its fill-ins and the intake form that answers them, so you know what to supply. Needs the `read` permission.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The template.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Template"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a key that is unknown, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the permission, or the plan doesn't include the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in the key's workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 120 calls a minute through this key, or its daily send limit reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/documents": {
      "post": {
        "operationId": "start_document",
        "tags": [
          "Documents"
        ],
        "summary": "Start a document from a template",
        "description": "Fills it with values or form answers. Needs the `documents` permission.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{8,100}$"
            },
            "description": "Makes a retried call safe: the same key returns the first result instead of creating or sending again."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartDocument"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new document.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Document"
                }
              }
            }
          },
          "400": {
            "description": "The input is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a key that is unknown, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the permission, or the plan doesn't include the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in the key's workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The request is in a state that doesn't allow this, or the Idempotency-Key was used for something else.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 120 calls a minute through this key, or its daily send limit reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/documents/{id}": {
      "get": {
        "operationId": "get_document",
        "tags": [
          "Documents"
        ],
        "summary": "Get a document",
        "description": "Needs the `read` permission.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The document.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Document"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a key that is unknown, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the permission, or the plan doesn't include the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in the key's workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 120 calls a minute through this key, or its daily send limit reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/signing-requests": {
      "post": {
        "operationId": "create_signing_request",
        "tags": [
          "Signing requests"
        ],
        "summary": "Create a signing request, and optionally send it",
        "description": "Needs the `send` permission.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{8,100}$"
            },
            "description": "Makes a retried call safe: the same key returns the first result instead of creating or sending again."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSigningRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created (and sent, with `send: true`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SigningRequest"
                }
              }
            }
          },
          "202": {
            "description": "Created; the send waits for a person's approval.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SigningRequest"
                }
              }
            }
          },
          "400": {
            "description": "The input is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a key that is unknown, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the permission, or the plan doesn't include the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in the key's workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The request is in a state that doesn't allow this, or the Idempotency-Key was used for something else.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 120 calls a minute through this key, or its daily send limit reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "list_signing_requests",
        "tags": [
          "Signing requests"
        ],
        "summary": "List signing requests",
        "description": "Newest first. Needs the `read` permission.",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "The `next_cursor` of the previous page."
          }
        ],
        "responses": {
          "200": {
            "description": "A page of signing requests.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "signing_requests": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SigningRequestSummary"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "No key, or a key that is unknown, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the permission, or the plan doesn't include the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 120 calls a minute through this key, or its daily send limit reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/signing-requests/{id}": {
      "get": {
        "operationId": "get_signing_request",
        "tags": [
          "Signing requests"
        ],
        "summary": "Get a signing request",
        "description": "With each recipient's status and the latest approval. Needs the `read` permission.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The signing request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SigningRequest"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a key that is unknown, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the permission, or the plan doesn't include the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in the key's workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 120 calls a minute through this key, or its daily send limit reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/signing-requests/{id}/send": {
      "post": {
        "operationId": "send_signing_request",
        "tags": [
          "Signing requests"
        ],
        "summary": "Send a draft signing request",
        "description": "Needs the `send` permission.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{8,100}$"
            },
            "description": "Makes a retried call safe: the same key returns the first result instead of creating or sending again."
          }
        ],
        "responses": {
          "200": {
            "description": "Sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SigningRequest"
                }
              }
            }
          },
          "202": {
            "description": "The send waits for a person's approval.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SigningRequest"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a key that is unknown, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the permission, or the plan doesn't include the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in the key's workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The request is in a state that doesn't allow this, or the Idempotency-Key was used for something else.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 120 calls a minute through this key, or its daily send limit reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/signing-requests/{id}/void": {
      "post": {
        "operationId": "void_signing_request",
        "tags": [
          "Signing requests"
        ],
        "summary": "Void a sent signing request",
        "description": "Needs the `send` permission.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "reason": {
                    "type": "string",
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Voided.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SigningRequest"
                }
              }
            }
          },
          "400": {
            "description": "The input is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a key that is unknown, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the permission, or the plan doesn't include the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in the key's workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The request is in a state that doesn't allow this, or the Idempotency-Key was used for something else.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 120 calls a minute through this key, or its daily send limit reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/intake-requests": {
      "post": {
        "operationId": "create_intake_request",
        "tags": [
          "Intake links"
        ],
        "summary": "Send an intake link",
        "description": "Needs the `send` permission.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{8,100}$"
            },
            "description": "Makes a retried call safe: the same key returns the first result instead of creating or sending again."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateIntakeRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created and emailed to the respondent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntakeRequest"
                }
              }
            }
          },
          "202": {
            "description": "Waits for a person's approval.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "const": "awaiting_approval"
                    },
                    "approval": {
                      "$ref": "#/components/schemas/Approval"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The input is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a key that is unknown, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the permission, or the plan doesn't include the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in the key's workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The request is in a state that doesn't allow this, or the Idempotency-Key was used for something else.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 120 calls a minute through this key, or its daily send limit reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/intake-requests/{id}": {
      "get": {
        "operationId": "get_intake_request",
        "tags": [
          "Intake links"
        ],
        "summary": "Get an intake link",
        "description": "With the answers, once submitted. Needs the `read` permission.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The intake link.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntakeRequest"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a key that is unknown, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the permission, or the plan doesn't include the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in the key's workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 120 calls a minute through this key, or its daily send limit reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/approvals/{id}": {
      "get": {
        "operationId": "get_approval",
        "tags": [
          "Approvals"
        ],
        "summary": "Get an approval this key asked for",
        "description": "Needs the `read` permission.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The approval.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Approval"
                }
              }
            }
          },
          "401": {
            "description": "No key, or a key that is unknown, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the permission, or the plan doesn't include the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found in the key's workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 120 calls a minute through this key, or its daily send limit reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "A workspace API or agent key, made by an owner or admin on the team's API page."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "message"
        ],
        "properties": {
          "message": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {}
          }
        }
      },
      "TemplateSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "written",
              "pdf"
            ]
          },
          "draft_revision": {
            "type": "integer"
          },
          "team_access": {
            "type": "string"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "FillIn": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "value": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "Document": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "source_type": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "draft_revision": {
            "type": "integer"
          },
          "fill_ins": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FillIn"
            }
          },
          "team_access": {
            "type": "string"
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "Template": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Document"
          },
          {
            "type": "object",
            "properties": {
              "form": {
                "type": [
                  "object",
                  "null"
                ],
                "description": "The intake form whose answers fill the template, if it has fill-ins."
              }
            }
          }
        ]
      },
      "StartDocument": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "template_id"
        ],
        "description": "Give `merge_values` or `answers`, not both.",
        "properties": {
          "template_id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "merge_values": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "maxLength": 2000
            },
            "description": "Fill-in values by key."
          },
          "answers": {
            "type": "object",
            "description": "Answers to the template's intake form, by question key."
          }
        }
      },
      "CreateSigningRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "documents",
          "recipients"
        ],
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "message": {
            "type": "string",
            "maxLength": 2000
          },
          "routing": {
            "type": "string",
            "enum": [
              "sequential",
              "parallel"
            ],
            "default": "sequential"
          },
          "expires_in_days": {
            "type": "integer",
            "minimum": 1,
            "maximum": 365,
            "default": 30
          },
          "documents": {
            "type": "array",
            "minItems": 1,
            "maxItems": 10,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "document_id"
              ],
              "properties": {
                "document_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "draft_revision": {
                  "type": "integer",
                  "minimum": 1,
                  "description": "Defaults to the current revision."
                }
              }
            }
          },
          "recipients": {
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "role_key",
                "name",
                "email"
              ],
              "properties": {
                "role_key": {
                  "type": "string",
                  "pattern": "^[a-z0-9][a-z0-9-]{0,39}$",
                  "description": "The role this person signs as, matching the documents' roles."
                },
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "email": {
                  "type": "string",
                  "format": "email",
                  "maxLength": 255
                },
                "routing_order": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 20
                }
              }
            }
          },
          "send": {
            "type": "boolean",
            "default": false,
            "description": "Send at once instead of leaving a draft."
          }
        }
      },
      "Approval": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "signing.send",
              "intake.create"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "approved",
              "declined",
              "expired",
              "failed"
            ]
          },
          "title": {
            "type": "string"
          },
          "addresses": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "credential": {
            "type": [
              "string",
              "null"
            ]
          },
          "signing_request_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "intake_request_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "decided_by": {
            "type": [
              "string",
              "null"
            ]
          },
          "decided_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "result": {
            "type": [
              "string",
              "null"
            ]
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SigningRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "sent",
              "completed",
              "declined",
              "voided",
              "expired"
            ]
          },
          "routing": {
            "type": "string",
            "enum": [
              "sequential",
              "parallel"
            ]
          },
          "message": {
            "type": [
              "string",
              "null"
            ]
          },
          "sender": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "email": {
                "type": "string"
              }
            }
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "sent_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "documents": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "document_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "title": {
                  "type": "string"
                },
                "completed_copy": {
                  "type": "boolean"
                }
              }
            }
          },
          "recipients": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "role": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "email": {
                  "type": "string"
                },
                "routing_order": {
                  "type": "integer"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "pending",
                    "notified",
                    "viewed",
                    "signed",
                    "declined"
                  ]
                },
                "signed_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                },
                "declined_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                },
                "delivery": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The latest email delivery status."
                }
              }
            }
          },
          "approval": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Approval"
              },
              {
                "type": "null"
              }
            ],
            "description": "The latest approval, when the request was sent through an agent key or a key that needs approval."
          }
        }
      },
      "SigningRequestSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "sent_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "completed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "recipients_total": {
            "type": "integer"
          },
          "recipients_signed": {
            "type": "integer"
          }
        }
      },
      "CreateIntakeRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "documents",
          "respondent"
        ],
        "description": "An intake link: a named person without an account answers a form, and their answers fill the documents.",
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "message": {
            "type": "string",
            "maxLength": 2000
          },
          "documents": {
            "type": "array",
            "minItems": 1,
            "maxItems": 10,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "document_id",
                "draft_revision"
              ],
              "properties": {
                "document_id": {
                  "type": "string",
                  "format": "uuid"
                },
                "draft_revision": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          },
          "respondent": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "name",
              "email"
            ],
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "email": {
                "type": "string",
                "format": "email",
                "maxLength": 255
              }
            }
          },
          "expires_in_days": {
            "type": "integer",
            "minimum": 1,
            "maximum": 60,
            "default": 14
          },
          "after": {
            "type": "string",
            "enum": [
              "review",
              "sign"
            ],
            "default": "review",
            "description": "After they answer: the sender reviews first, or the respondent goes straight on to sign (give `signing`)."
          },
          "signing": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "respondent_role"
            ],
            "properties": {
              "respondent_role": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9-]{0,39}$"
              },
              "recipients": {
                "type": "array",
                "maxItems": 19,
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "role_key",
                    "name",
                    "email"
                  ],
                  "properties": {
                    "role_key": {
                      "type": "string",
                      "pattern": "^[a-z0-9][a-z0-9-]{0,39}$",
                      "description": "The role this person signs as, matching the documents' roles."
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "email": {
                      "type": "string",
                      "format": "email",
                      "maxLength": 255
                    }
                  }
                }
              },
              "routing": {
                "type": "string",
                "enum": [
                  "sequential",
                  "parallel"
                ],
                "default": "sequential"
              },
              "expires_in_days": {
                "type": "integer",
                "minimum": 1,
                "maximum": 365,
                "default": 30
              }
            }
          }
        }
      },
      "IntakeRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "message": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "submitted",
              "voided",
              "expired"
            ]
          },
          "after": {
            "type": "string",
            "enum": [
              "review",
              "sign"
            ]
          },
          "respondent": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "email": {
                "type": "string"
              }
            }
          },
          "document_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "signing_request_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "submitted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "answers": {
            "type": [
              "object",
              "null"
            ]
          }
        }
      }
    }
  }
}