{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/zsign-io/json-schema/zsign-io-agent-envelope-status-schema.json",
  "title": "AgentEnvelopeStatus",
  "description": "GET /api/v1/documents/{document_id} — sent envelope or unsent draft.\n\nDraft-only extras (`parsed_fields`, `recipients`, `sent`) stay unset on\nsent envelopes so `response_model_exclude_unset` keeps the historical\nwire shape. Drafts set them explicitly, including `session` /\n`completed_document_id` as null.",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/zsign-io-openapi.yml#/components/schemas/AgentEnvelopeStatus",
  "properties": {
    "document_id": {
      "type": "string",
      "format": "uuid",
      "title": "Document Id"
    },
    "name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Name"
    },
    "filename": {
      "type": "string",
      "title": "Filename"
    },
    "status": {
      "type": "string",
      "title": "Status"
    },
    "created_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Created At"
    },
    "session": {
      "anyOf": [
        {
          "$ref": "#/$defs/AgentEnvelopeSession"
        },
        {
          "type": "null"
        }
      ]
    },
    "completed_document_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Completed Document Id"
    },
    "metadata": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Metadata"
    },
    "documents": {
      "items": {
        "$ref": "#/$defs/EnvelopeDocumentOut"
      },
      "type": "array",
      "title": "Documents",
      "default": []
    },
    "parsed_fields": {
      "anyOf": [
        {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Parsed Fields"
    },
    "recipients": {
      "anyOf": [
        {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Recipients"
    },
    "sent": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Sent"
    }
  },
  "type": "object",
  "required": [
    "document_id",
    "filename",
    "status"
  ],
  "$defs": {
    "AgentEnvelopeChangeRequest": {
      "properties": {
        "reason": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Reason"
        },
        "comments": {
          "items": {
            "$ref": "#/$defs/AgentEnvelopeChangeRequestComment"
          },
          "type": "array",
          "title": "Comments"
        },
        "at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "At"
        }
      },
      "type": "object",
      "required": [
        "comments"
      ],
      "title": "AgentEnvelopeChangeRequest"
    },
    "AgentEnvelopeChangeRequestComment": {
      "properties": {
        "page": {
          "type": "integer",
          "title": "Page"
        },
        "field_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Field Id"
        },
        "field_label": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Field Label"
        },
        "x": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "X"
        },
        "y": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Y"
        },
        "width": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Width"
        },
        "height": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Height"
        },
        "anchor_text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Anchor Text"
        },
        "text": {
          "type": "string",
          "title": "Text"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "title": "Created At"
        }
      },
      "type": "object",
      "required": [
        "page",
        "text",
        "created_at"
      ],
      "title": "AgentEnvelopeChangeRequestComment"
    },
    "AgentEnvelopeRecipient": {
      "properties": {
        "recipient_id": {
          "type": "string",
          "format": "uuid",
          "title": "Recipient Id"
        },
        "name": {
          "type": "string",
          "title": "Name"
        },
        "email": {
          "type": "string",
          "title": "Email"
        },
        "status": {
          "type": "string",
          "title": "Status"
        },
        "signed_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Signed At"
        },
        "can_remind": {
          "type": "boolean",
          "title": "Can Remind"
        },
        "change_request": {
          "anyOf": [
            {
              "$ref": "#/$defs/AgentEnvelopeChangeRequest"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "type": "object",
      "required": [
        "recipient_id",
        "name",
        "email",
        "status",
        "can_remind"
      ],
      "title": "AgentEnvelopeRecipient"
    },
    "AgentEnvelopeSession": {
      "properties": {
        "session_id": {
          "type": "string",
          "format": "uuid",
          "title": "Session Id"
        },
        "status": {
          "type": "string",
          "title": "Status"
        },
        "expires_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Expires At"
        },
        "completed_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Completed At"
        },
        "revision_of": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ],
          "title": "Revision Of"
        },
        "recipients": {
          "items": {
            "$ref": "#/$defs/AgentEnvelopeRecipient"
          },
          "type": "array",
          "title": "Recipients"
        }
      },
      "type": "object",
      "required": [
        "session_id",
        "status",
        "recipients"
      ],
      "title": "AgentEnvelopeSession"
    },
    "EnvelopeDocumentOut": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id"
        },
        "name": {
          "type": "string",
          "title": "Name"
        },
        "filename": {
          "type": "string",
          "title": "Filename"
        },
        "page_start": {
          "type": "integer",
          "title": "Page Start"
        },
        "page_count": {
          "type": "integer",
          "title": "Page Count"
        },
        "position": {
          "type": "integer",
          "title": "Position"
        }
      },
      "type": "object",
      "required": [
        "id",
        "name",
        "filename",
        "page_start",
        "page_count",
        "position"
      ],
      "title": "EnvelopeDocumentOut",
      "description": "One document inside an envelope, as every wire payload lists it."
    }
  }
}