{
  "openapi": "3.1.0",
  "jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
  "info": {
    "title": "NextSign API",
    "version": "2026-05-01-beta",
    "summary": "Beta machine-readable contract for the documented NextSign API surface.",
    "description": "This OpenAPI document reflects the published docs on docs.nextsign.dk. It is intentionally conservative: older v2 endpoints can return application-level error payloads in successful HTTP responses, so consumers should validate both the HTTP status code and the response body.",
    "contact": {
      "url": "https://docs.nextsign.dk/docs"
    }
  },
  "externalDocs": {
    "description": "Human-readable documentation",
    "url": "https://docs.nextsign.dk/docs"
  },
  "servers": [
    {
      "url": "https://www.nextsign.dk",
      "description": "Primary host for documented v2 endpoints"
    },
    {
      "url": "https://api.nextsign.dk",
      "description": "Primary host for documented v3 file endpoints"
    }
  ],
  "tags": [
    {
      "name": "Forms",
      "description": "Retrieve form metadata, inspect tags, and submit forms to create signing cases."
    },
    {
      "name": "Cases",
      "description": "Create, list, inspect, update, and delete signing cases."
    },
    {
      "name": "Documents",
      "description": "Submit library documents to create signing cases, and upload, retrieve, and convert files used in signing workflows."
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API Key",
        "description": "Use your NextSign API key as the bearer token."
      }
    },
    "schemas": {
      "Notice": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          },
          "using": {}
        },
        "required": [
          "message"
        ],
        "additionalProperties": true
      },
      "ErrorObject": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer"
          },
          "message": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "error": {}
        },
        "required": [
          "message"
        ],
        "additionalProperties": true
      },
      "ErrorValue": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "$ref": "#/components/schemas/ErrorObject"
          }
        ]
      },
      "ErrorListEnvelope": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ErrorValue"
            }
          },
          "notices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Notice"
            }
          }
        },
        "required": [
          "errors"
        ],
        "additionalProperties": true
      },
      "MessageEnvelope": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          }
        },
        "required": [
          "message"
        ],
        "additionalProperties": true
      },
      "StatusPayload": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "additionalProperties": true
      },
      "TagDefinition": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          },
          "value": {
            "type": [
              "string",
              "number",
              "boolean",
              "null"
            ]
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "tag",
          "type"
        ],
        "additionalProperties": true
      },
      "TagInput": {
        "type": "object",
        "properties": {
          "tag": {
            "type": "string"
          },
          "value": {},
          "type": {
            "type": "string"
          },
          "format": {
            "type": "string"
          }
        },
        "required": [
          "tag",
          "value",
          "type"
        ],
        "additionalProperties": true
      },
      "ReminderSettings": {
        "type": "object",
        "properties": {
          "send": {
            "type": "boolean"
          },
          "amount": {
            "type": "integer"
          },
          "daysBetween": {
            "type": "integer"
          }
        },
        "additionalProperties": true
      },
      "DeletionSettings": {
        "type": "object",
        "properties": {
          "autoDelete": {
            "type": "boolean"
          },
          "days": {
            "type": "integer"
          }
        },
        "additionalProperties": true
      },
      "AvailabilitySettings": {
        "type": "object",
        "properties": {
          "unlimited": {
            "type": "boolean"
          },
          "days": {
            "type": "integer"
          },
          "expiration": {
            "type": "string",
            "format": "date-time"
          },
          "isExpired": {
            "type": "boolean"
          }
        },
        "additionalProperties": true
      },
      "CaseState": {
        "type": "string",
        "enum": [
          "draft",
          "open",
          "completed",
          "denied",
          "cancelled"
        ],
        "description": "Canonical case lifecycle state. `draft` means not yet open for signing, `open` means active, `completed` means finished, `denied` means rejected during signing, and `cancelled` means cancelled."
      },
      "CaseSettings": {
        "type": "object",
        "properties": {
          "reminders": {
            "$ref": "#/components/schemas/ReminderSettings"
          },
          "deletion": {
            "$ref": "#/components/schemas/DeletionSettings"
          },
          "availability": {
            "$ref": "#/components/schemas/AvailabilitySettings"
          },
          "template": {
            "type": "integer"
          },
          "lang": {
            "type": "string"
          },
          "allowAPI": {
            "type": "boolean"
          },
          "allowRecipientsViewOthers": {
            "type": "boolean"
          },
          "allowedRoles": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": true
      },
      "RecipientInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "signing": {
            "type": "boolean"
          },
          "needsCpr": {
            "type": "boolean"
          },
          "signingSchema": {
            "type": "string"
          },
          "redirectUrl": {
            "type": "string"
          },
          "addPhone": {
            "type": "boolean"
          },
          "phone": {
            "type": "string"
          },
          "order": {
            "type": "integer"
          },
          "group": {
            "type": "integer"
          },
          "position": {
            "type": "string"
          },
          "message": {}
        },
        "required": [
          "name",
          "email",
          "signing"
        ],
        "additionalProperties": true
      },
      "RecipientResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/RecipientInput"
          },
          {
            "type": "object",
            "properties": {
              "_id": {
                "type": "string"
              },
              "uid": {
                "type": "string"
              },
              "signed": {
                "type": "string"
              },
              "signingToken": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "url": {
                "type": "string",
                "format": "uri"
              }
            },
            "additionalProperties": true
          }
        ]
      },
      "CaseDocumentInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "file": {
            "type": "string"
          },
          "fileIsBlob": {
            "type": "boolean"
          },
          "signObligated": {
            "type": "boolean"
          },
          "documentMustBeRead": {
            "type": "boolean"
          },
          "mergeTags": {
            "type": "boolean",
            "description": "Case Create only. Set to false to leave this .docx out of the template-tag merge when the request also sends tags. Defaults to true."
          },
          "signatories": {
            "type": "array",
            "items": {}
          }
        },
        "required": [
          "name",
          "file"
        ],
        "additionalProperties": true
      },
      "CaseDocumentResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/CaseDocumentInput"
          },
          {
            "type": "object",
            "properties": {
              "_id": {
                "type": "string"
              },
              "document_id": {
                "type": "string"
              }
            },
            "additionalProperties": true
          }
        ]
      },
      "CaseSummary": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "referenceId": {
            "type": "string"
          },
          "folder": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "state": {
            "$ref": "#/components/schemas/CaseState"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "_id",
          "title"
        ],
        "additionalProperties": true
      },
      "CaseDetails": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "referenceId": {
            "type": "string"
          },
          "folder": {
            "type": "string"
          },
          "folderId": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "state": {
            "$ref": "#/components/schemas/CaseState"
          },
          "status": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "settings": {
            "$ref": "#/components/schemas/CaseSettings"
          },
          "signingSchemas": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "recipients": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecipientResponse"
            }
          },
          "documents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CaseDocumentResponse"
            }
          }
        },
        "required": [
          "_id",
          "title"
        ],
        "additionalProperties": true
      },
      "CaseListResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string"
          },
          "cases": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CaseSummary"
            }
          }
        },
        "required": [
          "status",
          "cases"
        ],
        "additionalProperties": true
      },
      "CaseLookupResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string"
          },
          "case": {
            "$ref": "#/components/schemas/CaseDetails"
          }
        },
        "required": [
          "status",
          "case"
        ],
        "additionalProperties": true
      },
      "CasesMultipleResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string"
          },
          "cases": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CaseSummary"
            }
          }
        },
        "required": [
          "status",
          "cases"
        ],
        "additionalProperties": true
      },
      "CaseCreateRequest": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          },
          "referenceId": {
            "type": "string"
          },
          "folder": {
            "type": "string"
          },
          "autoSend": {
            "type": "boolean"
          },
          "customMessage": {
            "type": "boolean"
          },
          "message": {
            "type": "string"
          },
          "user_email": {
            "type": "string",
            "format": "email"
          },
          "emailtemplate": {
            "type": "string"
          },
          "settings": {
            "$ref": "#/components/schemas/CaseSettings"
          },
          "signingSchemas": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "recipients": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecipientInput"
            }
          },
          "documents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CaseDocumentInput"
            }
          },
          "tags": {
            "type": "array",
            "description": "Values filled into {tag} placeholders in .docx documents. When present, every .docx in documents is rendered with these values unless it sets mergeTags: false.",
            "items": {
              "$ref": "#/components/schemas/TagInput"
            }
          }
        },
        "required": [
          "title",
          "settings",
          "recipients",
          "documents"
        ],
        "additionalProperties": true
      },
      "CaseCreateResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "_id": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "referenceId": {
                "type": "string"
              },
              "folder": {
                "type": "string"
              },
              "folderId": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "state": {
                "$ref": "#/components/schemas/CaseState"
              },
              "user_email": {
                "type": "string",
                "format": "email"
              },
              "user_company": {
                "type": "string"
              },
              "nextSignKey": {
                "type": "string"
              },
              "signingSchemas": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "settings": {
                "$ref": "#/components/schemas/CaseSettings"
              },
              "recipients": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/RecipientResponse"
                }
              },
              "documents": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CaseDocumentResponse"
                }
              },
              "createdAt": {
                "type": "string",
                "format": "date-time"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time"
              }
            },
            "additionalProperties": true
          },
          "notices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Notice"
            }
          }
        },
        "required": [
          "data",
          "notices"
        ],
        "additionalProperties": true
      },
      "RecipientPatch": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "phone": {
            "type": "string"
          },
          "needsCpr": {
            "type": "boolean"
          },
          "cpr": {
            "type": "string"
          },
          "clearCpr": {
            "type": "boolean"
          },
          "signing": {
            "type": "boolean"
          },
          "signed": {
            "type": "string"
          },
          "signingSchema": {
            "type": "string"
          },
          "redirectUrl": {
            "type": "string"
          },
          "order": {
            "type": "integer"
          },
          "group": {
            "type": "integer"
          },
          "position": {
            "type": "string"
          },
          "message": {},
          "template": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "eboks": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "CaseUpdateRequest": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          },
          "referenceId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "open",
              "completed",
              "denied",
              "cancelled",
              "pending",
              "signed"
            ],
            "description": "Public lifecycle update value. `pending` is accepted as an alias for `open`, and `signed` is accepted as an alias for `completed`."
          },
          "state": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CaseState"
              }
            ],
            "description": "Canonical lifecycle value. Use `draft`, `open`, `completed`, `denied`, or `cancelled`."
          },
          "completedReason": {
            "type": "string"
          },
          "completed": {
            "type": "object",
            "properties": {
              "reason": {
                "type": "string"
              },
              "date": {
                "type": "string",
                "format": "date-time"
              }
            },
            "additionalProperties": true
          },
          "settings": {
            "$ref": "#/components/schemas/CaseSettings"
          },
          "signingSchemas": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Replace the case-level signing methods. Rejected after any recipient has signed."
          },
          "recipient": {
            "allOf": [
              {
                "$ref": "#/components/schemas/RecipientPatch"
              }
            ],
            "description": "Patch one existing recipient. Rejected after any recipient has signed."
          },
          "recipients": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecipientInput"
            },
            "description": "Append new recipients to the case. Rejected after any recipient has signed."
          },
          "addDocuments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CaseDocumentInput"
            },
            "description": "Append new documents to the case. Rejected after any recipient has signed."
          }
        },
        "additionalProperties": true
      },
      "CaseUpdateResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "status": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ErrorValue"
            }
          },
          "notices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Notice"
            }
          },
          "newDocuments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CaseDocumentResponse"
            }
          },
          "case": {
            "$ref": "#/components/schemas/CaseDetails"
          }
        },
        "required": [
          "success",
          "status",
          "case"
        ],
        "additionalProperties": true
      },
      "CaseDeleteResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string"
          },
          "return": {
            "type": "object",
            "properties": {
              "acknowledged": {
                "type": "boolean"
              },
              "deletedCount": {
                "type": "integer"
              }
            },
            "additionalProperties": true
          }
        },
        "required": [
          "status",
          "return"
        ],
        "additionalProperties": true
      },
      "FormSummary": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string"
          },
          "companyId": {
            "type": "string"
          },
          "folder": {
            "type": "string"
          },
          "active": {
            "type": "boolean"
          },
          "title": {
            "type": "string"
          },
          "settings": {
            "$ref": "#/components/schemas/CaseSettings"
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagDefinition"
            }
          },
          "recipients": {
            "type": "array",
            "items": {}
          },
          "documents": {
            "type": "array",
            "items": {}
          }
        },
        "required": [
          "_id",
          "title"
        ],
        "additionalProperties": true
      },
      "FormSubmitRequest": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          },
          "customMessage": {
            "type": "boolean"
          },
          "message": {
            "type": "string"
          },
          "user_name": {
            "type": "string"
          },
          "user_email": {
            "type": "string",
            "format": "email"
          },
          "state": {
            "type": "string",
            "enum": [
              "draft",
              "open"
            ],
            "description": "State for the created case. Omit (or `open`) to create and send a normal case. `draft` creates the case as a draft that is not sent (no signing invitations, no signing URLs in the response)."
          },
          "autoSend": {
            "type": "boolean",
            "description": "Whether to send the case to its recipients. Defaults to true, except when `state` is `draft` (defaults to false). Pass explicitly to override."
          },
          "signingSchemas": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "settings": {
            "$ref": "#/components/schemas/CaseSettings"
          },
          "folder": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagInput"
            }
          },
          "recipients": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecipientInput"
            }
          }
        },
        "required": [
          "tags",
          "recipients"
        ],
        "additionalProperties": true
      },
      "FormSubmitResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "contract": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CaseSummary"
              },
              {
                "$ref": "#/components/schemas/CaseCreateResponse"
              }
            ]
          }
        },
        "required": [
          "status",
          "message",
          "contract"
        ],
        "additionalProperties": true,
        "description": "The published docs show a case summary object, while some legacy runtime paths may return a nested case-create style payload."
      },
      "DocumentUploadResponse": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "url",
          "type"
        ],
        "additionalProperties": true
      },
      "DocumentRetrieveRequest": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "url"
        ],
        "additionalProperties": false
      },
      "DocumentRetrieveResponse": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "signedUrl": {
            "type": "string",
            "format": "uri"
          },
          "type": {
            "type": "string"
          },
          "cached": {
            "type": "boolean"
          }
        },
        "required": [
          "key",
          "signedUrl"
        ],
        "additionalProperties": true
      },
      "DocumentConvertRequest": {
        "type": "object",
        "properties": {
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagInput"
            }
          },
          "documents": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "file": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "file",
                "name"
              ],
              "additionalProperties": true
            }
          }
        },
        "required": [
          "documents"
        ],
        "additionalProperties": true
      },
      "DocumentConvertResponse": {
        "type": "object",
        "properties": {
          "status": {
            "$ref": "#/components/schemas/StatusPayload"
          },
          "documents": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "file": {
                  "type": "string",
                  "format": "uri"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "file",
                "name"
              ],
              "additionalProperties": true
            }
          }
        },
        "required": [
          "status",
          "documents"
        ],
        "additionalProperties": true
      }
    },
    "parameters": {
      "CompanyId": {
        "name": "company",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        },
        "description": "Your company identifier."
      },
      "FormId": {
        "name": "form_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        },
        "description": "Unique identifier of the form."
      },
      "CaseId": {
        "name": "case_id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        },
        "description": "Unique identifier of the case."
      },
      "CaseIds": {
        "name": "case_ids",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        },
        "description": "Comma-separated list of case IDs."
      }
    }
  },
  "paths": {
    "/api/v2/{company}/forms/{form_id}/get": {
      "get": {
        "tags": [
          "Forms"
        ],
        "operationId": "getForm",
        "summary": "Get a form by ID",
        "description": "Retrieve a single form and inspect its settings, recipients, tags, and attached documents.",
        "externalDocs": {
          "url": "https://docs.nextsign.dk/docs/forms-get"
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/CompanyId"
          },
          {
            "$ref": "#/components/parameters/FormId"
          }
        ],
        "responses": {
          "200": {
            "description": "Form response or legacy validation envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/FormSummary"
                    },
                    {
                      "$ref": "#/components/schemas/ErrorListEnvelope"
                    }
                  ]
                },
                "examples": {
                  "success": {
                    "value": {
                      "_id": "65f493fb52bb6d8baa5d16af",
                      "companyId": "6576e19662ec13c4faa7de7b",
                      "folder": "Default",
                      "active": true,
                      "title": "Example Form",
                      "settings": {
                        "deletion": {
                          "autoDelete": true,
                          "days": 30
                        },
                        "availability": {
                          "unlimited": false,
                          "days": 10,
                          "isExpired": false
                        },
                        "reminders": {
                          "send": true,
                          "amount": 2,
                          "daysBetween": 3
                        },
                        "allowAPI": true
                      },
                      "tags": [],
                      "recipients": [],
                      "documents": []
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorListEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/{company}/forms/{form_id}/tags/get": {
      "get": {
        "tags": [
          "Forms"
        ],
        "operationId": "getFormTags",
        "summary": "Get form tags",
        "description": "Retrieve the tags a form expects so you can construct a valid submit payload.",
        "externalDocs": {
          "url": "https://docs.nextsign.dk/docs/forms-tags"
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/CompanyId"
          },
          {
            "$ref": "#/components/parameters/FormId"
          }
        ],
        "responses": {
          "200": {
            "description": "Array of tags or legacy validation envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TagDefinition"
                      }
                    },
                    {
                      "$ref": "#/components/schemas/ErrorListEnvelope"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/{company}/forms/{form_id}/submit": {
      "post": {
        "tags": [
          "Forms"
        ],
        "operationId": "submitForm",
        "summary": "Submit a form",
        "description": "Submit a form with tag values and recipients. A successful submission creates a case from the form configuration.",
        "externalDocs": {
          "url": "https://docs.nextsign.dk/docs/forms-submit"
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/CompanyId"
          },
          {
            "$ref": "#/components/parameters/FormId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FormSubmitRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Submission response or legacy validation envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/FormSubmitResponse"
                    },
                    {
                      "$ref": "#/components/schemas/ErrorListEnvelope"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorListEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorListEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/{company}/cases/get": {
      "get": {
        "tags": [
          "Cases"
        ],
        "operationId": "listCases",
        "summary": "List cases",
        "description": "List cases for a company. You can filter by status, folder, and paginate the result set.",
        "externalDocs": {
          "url": "https://docs.nextsign.dk/docs/cases"
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/CompanyId"
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "signed",
                "denied",
                "pending"
              ]
            },
            "description": "Filter by signing status."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 100
            },
            "description": "Maximum number of cases to return."
          },
          {
            "name": "index",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0
            },
            "description": "Zero-based page index used together with `limit`."
          },
          {
            "name": "folder",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Filter by folder name."
          }
        ],
        "responses": {
          "200": {
            "description": "Case list or legacy validation envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/CaseListResponse"
                    },
                    {
                      "$ref": "#/components/schemas/ErrorListEnvelope"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "No matching cases.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/{company}/cases/{case_ids}/get": {
      "get": {
        "tags": [
          "Cases"
        ],
        "operationId": "getMultipleCases",
        "summary": "Get multiple cases",
        "description": "Fetch multiple specific cases in a single request by passing a comma-separated list of case IDs.",
        "externalDocs": {
          "url": "https://docs.nextsign.dk/docs/cases-get-multiple"
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/CompanyId"
          },
          {
            "$ref": "#/components/parameters/CaseIds"
          }
        ],
        "responses": {
          "200": {
            "description": "Matching cases.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CasesMultipleResponse"
                }
              }
            }
          },
          "404": {
            "description": "No matching cases.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/{company}/case/{case_id}/get": {
      "get": {
        "tags": [
          "Cases"
        ],
        "operationId": "getCase",
        "summary": "Get a case by ID",
        "description": "Fetch a single case by its unique identifier.",
        "externalDocs": {
          "url": "https://docs.nextsign.dk/docs/case"
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/CompanyId"
          },
          {
            "$ref": "#/components/parameters/CaseId"
          }
        ],
        "responses": {
          "200": {
            "description": "Case response or legacy validation envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/CaseLookupResponse"
                    },
                    {
                      "$ref": "#/components/schemas/ErrorListEnvelope"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Case not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/{company}/case/create": {
      "post": {
        "tags": [
          "Cases"
        ],
        "operationId": "createCase",
        "summary": "Create a case",
        "description": "Create a case with recipients, settings, and documents for signing.",
        "externalDocs": {
          "url": "https://docs.nextsign.dk/docs/case-create"
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/CompanyId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CaseCreateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Created case or validation envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/CaseCreateResponse"
                    },
                    {
                      "$ref": "#/components/schemas/ErrorListEnvelope"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorListEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorListEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/{company}/case/{case_id}/update": {
      "patch": {
        "tags": [
          "Cases"
        ],
        "operationId": "updateCase",
        "summary": "Update a case",
        "description": "Update an existing case after creation. You can change the lifecycle status, merge settings, replace signing schemas, patch one recipient, and append recipients or documents. This route updates the stored lifecycle directly and does not trigger separate cancellation side effects such as recipient email notifications. Once any recipient has signed, contract-shape changes such as signing schemas, recipient changes, recipient additions, and document additions are rejected.",
        "externalDocs": {
          "url": "https://docs.nextsign.dk/docs/case-update"
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/CompanyId"
          },
          {
            "$ref": "#/components/parameters/CaseId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CaseUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated case.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaseUpdateResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorListEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Case or recipient not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorListEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/{company}/case/{case_id}/delete": {
      "get": {
        "tags": [
          "Cases"
        ],
        "operationId": "deleteCase",
        "summary": "Delete a case",
        "description": "Delete a case by its unique identifier.",
        "externalDocs": {
          "url": "https://docs.nextsign.dk/docs/case-delete"
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/CompanyId"
          },
          {
            "$ref": "#/components/parameters/CaseId"
          }
        ],
        "responses": {
          "200": {
            "description": "Deletion response or legacy validation envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/CaseDeleteResponse"
                    },
                    {
                      "$ref": "#/components/schemas/ErrorListEnvelope"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Case not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v3/company/{company}/file/upload": {
      "post": {
        "tags": [
          "Documents"
        ],
        "operationId": "uploadDocument",
        "summary": "Upload a document",
        "description": "Upload a file before case creation. Supports both multipart form data and JSON base64 payloads.",
        "externalDocs": {
          "url": "https://docs.nextsign.dk/docs/documents-upload"
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/CompanyId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "name": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string"
                  }
                },
                "required": [
                  "file"
                ],
                "additionalProperties": false
              }
            },
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string"
                  }
                },
                "required": [
                  "file",
                  "name"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Upload response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentUploadResponse"
                }
              }
            }
          },
          "400": {
            "description": "Upload error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v3/company/{company}/file/view-presigned-url": {
      "post": {
        "tags": [
          "Documents"
        ],
        "operationId": "getDocumentPresignedUrl",
        "summary": "Retrieve a pre-signed document URL",
        "description": "Generate a pre-signed URL for a case document stored in NextSign object storage.",
        "externalDocs": {
          "url": "https://docs.nextsign.dk/docs/documents"
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/CompanyId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentRetrieveRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Generated pre-signed URL.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentRetrieveResponse"
                }
              }
            }
          },
          "400": {
            "description": "Missing URL.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/document/convert": {
      "post": {
        "tags": [
          "Documents"
        ],
        "operationId": "convertDocument",
        "summary": "Convert documents",
        "description": "Convert DOCX documents to PDF and replace tags before sending or previewing a document.",
        "externalDocs": {
          "url": "https://docs.nextsign.dk/docs/documents-convert"
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentConvertRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Converted documents.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentConvertResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorListEnvelope"
                }
              }
            }
          }
        }
      }
    }
  }
}