{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/bynn-com/json-schema/bynn-com-bynn-v1-entities-auto-doc-invitation-schema.json",
  "title": "Bynn_V1_Entities_AutoDocInvitation",
  "description": "Bynn_V1_Entities_AutoDocInvitation model",
  "x-generated": "2026-11-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/bynn-com-openapi.json#/components/schemas/Bynn_V1_Entities_AutoDocInvitation",
  "type": "object",
  "properties": {
    "token": {
      "type": "string",
      "description": "Invitation token (adi_xxx). Use this to look up or cancel the invitation."
    },
    "workflowToken": {
      "type": "string",
      "description": "Workflow token the invitation will start (wf_xxx)."
    },
    "channel": {
      "type": "string",
      "enum": [
        "email",
        "sms"
      ],
      "description": "Delivery channel."
    },
    "recipient": {
      "type": "string",
      "description": "Email address or phone number the invitation is sent to."
    },
    "reference": {
      "type": "string",
      "description": "Customer-defined identifier echoed back from the create request. Useful for cross-referencing this invitation against your own system."
    },
    "locale": {
      "type": "string",
      "description": "Language tag the email/SMS was rendered in. Null when no locale was specified at create time."
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "sent",
        "delivered",
        "opened",
        "started",
        "failed",
        "completed",
        "rejected"
      ],
      "description": "Lifecycle status of the invitation. Mirrors dossier terminal state once a submission is linked: started=visitor opened the link and a dossier was created; completed=dossier was approved/completed; rejected=dossier was rejected."
    },
    "dossierToken": {
      "type": "string",
      "description": "Token of the dossier this invitation produced, once the recipient has started the workflow. Null until then."
    },
    "deliveryAttempts": {
      "type": "integer",
      "format": "int32",
      "description": "Number of times this invitation has been successfully sent (initial send + each resend). Capped at 10."
    },
    "errorMessage": {
      "type": "string",
      "description": "Failure reason (only populated when status=failed)."
    },
    "expiresAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the invitation link stops working."
    },
    "sentAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the invitation was dispatched to the channel provider. Null until status flips to sent."
    },
    "startedAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the recipient first started the workflow (a dossier was created). Null until status flips to started."
    },
    "completedAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the linked dossier was approved/completed. Null until status flips to completed."
    },
    "rejectedAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the linked dossier was rejected. Null until status flips to rejected."
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the invitation record was created."
    }
  },
  "required": [
    "token",
    "workflowToken",
    "channel",
    "recipient",
    "reference",
    "locale",
    "status",
    "dossierToken",
    "deliveryAttempts",
    "errorMessage",
    "expiresAt",
    "sentAt",
    "startedAt",
    "completedAt",
    "rejectedAt",
    "createdAt"
  ]
}