{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/zsign-io/json-schema/zsign-io-session-response-schema.json",
  "title": "SessionResponse",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/zsign-io-openapi.yml#/components/schemas/SessionResponse",
  "properties": {
    "session_id": {
      "type": "string",
      "format": "uuid",
      "title": "Session Id"
    },
    "revision_of": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Revision Of"
    },
    "superseded_by": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Superseded By"
    },
    "revision_draft_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Revision Draft Id"
    },
    "status": {
      "$ref": "#/$defs/SessionStatus"
    },
    "document_id": {
      "type": "string",
      "format": "uuid",
      "title": "Document Id"
    },
    "document_type": {
      "$ref": "#/$defs/DocumentType"
    },
    "expires_at": {
      "type": "string",
      "format": "date-time",
      "title": "Expires At"
    },
    "recipients": {
      "items": {
        "$ref": "#/$defs/RecipientResponse"
      },
      "type": "array",
      "title": "Recipients"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
    },
    "progress": {
      "anyOf": [
        {
          "$ref": "#/$defs/SessionProgress"
        },
        {
          "type": "null"
        }
      ]
    },
    "void_reason": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Void Reason"
    },
    "voided_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Voided At"
    },
    "document_name": {
      "type": "string",
      "title": "Document Name"
    },
    "documents": {
      "items": {
        "$ref": "#/$defs/EnvelopeDocumentOut"
      },
      "type": "array",
      "title": "Documents",
      "default": []
    },
    "activity": {
      "items": {
        "$ref": "#/$defs/EnvelopeActivityEvent"
      },
      "type": "array",
      "title": "Activity",
      "default": []
    }
  },
  "type": "object",
  "required": [
    "session_id",
    "status",
    "document_id",
    "document_type",
    "expires_at",
    "recipients",
    "created_at",
    "document_name"
  ],
  "$defs": {
    "ChangeRequestCommentOut": {
      "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": "ChangeRequestCommentOut"
    },
    "ChangeRequestOut": {
      "properties": {
        "reason": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Reason"
        },
        "comments": {
          "items": {
            "$ref": "#/$defs/ChangeRequestCommentOut"
          },
          "type": "array",
          "title": "Comments"
        },
        "at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "At"
        }
      },
      "type": "object",
      "required": [
        "comments"
      ],
      "title": "ChangeRequestOut"
    },
    "DocumentType": {
      "type": "string",
      "enum": [
        "template",
        "one_off"
      ],
      "title": "DocumentType"
    },
    "EnvelopeActivityEvent": {
      "properties": {
        "occurred_at": {
          "type": "string",
          "format": "date-time",
          "title": "Occurred At"
        },
        "event_type": {
          "type": "string",
          "enum": [
            "sent",
            "reminded",
            "viewed",
            "signed",
            "voided",
            "declined",
            "changes_requested",
            "recipient_email_corrected"
          ],
          "title": "Event Type"
        },
        "actor_email": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Actor Email"
        },
        "actor_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Actor Name"
        },
        "recipient_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ],
          "title": "Recipient Id"
        },
        "detail": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Detail"
        }
      },
      "type": "object",
      "required": [
        "occurred_at",
        "event_type"
      ],
      "title": "EnvelopeActivityEvent",
      "description": "One owner-facing activity row for a live or finished envelope.\n\n`occurred_at` is copied from a stored column or audit row. Callers must\nnot invent one. `detail` is a short fact already on that row (a void\nreason, an old→new email, who asked for a reminder). It is omitted when\nnothing extra was recorded."
    },
    "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."
    },
    "RecipientResponse": {
      "properties": {
        "recipient_id": {
          "type": "string",
          "format": "uuid",
          "title": "Recipient Id"
        },
        "name": {
          "type": "string",
          "title": "Name"
        },
        "email": {
          "type": "string",
          "title": "Email"
        },
        "role": {
          "type": "string",
          "title": "Role"
        },
        "signing_order": {
          "type": "integer",
          "title": "Signing Order"
        },
        "status": {
          "$ref": "#/$defs/RecipientStatus"
        },
        "signing_url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Signing Url"
        },
        "signed_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Signed At"
        },
        "viewed_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Viewed At"
        },
        "can_remind": {
          "type": "boolean",
          "title": "Can Remind",
          "default": false
        },
        "change_request": {
          "anyOf": [
            {
              "$ref": "#/$defs/ChangeRequestOut"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "type": "object",
      "required": [
        "recipient_id",
        "name",
        "email",
        "role",
        "signing_order",
        "status"
      ],
      "title": "RecipientResponse"
    },
    "RecipientStatus": {
      "type": "string",
      "enum": [
        "pending",
        "completed"
      ],
      "title": "RecipientStatus"
    },
    "SessionProgress": {
      "properties": {
        "completed": {
          "type": "integer",
          "title": "Completed"
        },
        "total": {
          "type": "integer",
          "title": "Total"
        },
        "percentage": {
          "type": "integer",
          "title": "Percentage"
        }
      },
      "type": "object",
      "required": [
        "completed",
        "total",
        "percentage"
      ],
      "title": "SessionProgress"
    },
    "SessionStatus": {
      "type": "string",
      "enum": [
        "pending",
        "in_progress",
        "completed",
        "voided",
        "declined",
        "expired",
        "cancelled",
        "deleted"
      ],
      "title": "SessionStatus"
    }
  }
}