{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.twilio.com/docs/schemas/twilio/verification.json",
  "title": "Twilio Verification",
  "description": "Represents a verification request sent through the Twilio Verify API, including the channel used, delivery status, and code attempt history.",
  "type": "object",
  "properties": {
    "sid": {
      "type": "string",
      "pattern": "^VE[0-9a-fA-F]{32}$",
      "description": "Unique 34-character identifier for the verification"
    },
    "service_sid": {
      "type": "string",
      "pattern": "^VA[0-9a-fA-F]{32}$",
      "description": "SID of the Verify service"
    },
    "account_sid": {
      "type": "string",
      "pattern": "^AC[0-9a-fA-F]{32}$",
      "description": "SID of the Twilio account"
    },
    "to": {
      "type": "string",
      "description": "Phone number or email address being verified"
    },
    "channel": {
      "type": "string",
      "enum": ["sms", "call", "email", "whatsapp", "sna"],
      "description": "Delivery channel used for the verification code"
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "approved",
        "canceled",
        "max_attempts_reached",
        "deleted",
        "failed",
        "expired"
      ],
      "description": "Current status of the verification"
    },
    "valid": {
      "type": "boolean",
      "description": "Whether the verification was successfully validated"
    },
    "lookup": {
      "type": ["object", "null"],
      "description": "Phone number lookup data if enabled on the service",
      "properties": {
        "carrier": {
          "type": ["object", "null"],
          "properties": {
            "type": {
              "type": "string",
              "description": "Line type (mobile, landline, voip, etc.)"
            },
            "name": {
              "type": "string",
              "description": "Carrier name"
            },
            "mobile_country_code": {
              "type": "string"
            },
            "mobile_network_code": {
              "type": "string"
            },
            "error_code": {
              "type": ["integer", "null"]
            }
          }
        }
      }
    },
    "amount": {
      "type": ["string", "null"],
      "description": "Amount for PSD2 verification"
    },
    "payee": {
      "type": ["string", "null"],
      "description": "Payee for PSD2 verification"
    },
    "send_code_attempts": {
      "type": "array",
      "description": "List of code delivery attempts",
      "items": {
        "type": "object",
        "properties": {
          "attempt_sid": {
            "type": "string",
            "description": "Unique identifier for the attempt"
          },
          "channel": {
            "type": "string",
            "description": "Channel used for this attempt"
          },
          "time": {
            "type": "string",
            "format": "date-time",
            "description": "When the attempt was made"
          }
        }
      }
    },
    "date_created": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 timestamp when the verification was created"
    },
    "date_updated": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 timestamp when the verification was last updated"
    },
    "url": {
      "type": "string",
      "format": "uri",
      "description": "Absolute URL of this verification resource"
    }
  },
  "required": ["sid", "service_sid", "account_sid", "to", "channel", "status"]
}
