{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Withdraw Request",
  "description": "Withdraw funds from the authenticated client's account through a payment agent",
  "type": "object",
  "properties": {
    "headers": {
      "type": "object",
      "properties": {
        "Deriv-App-ID": {
          "type": "string",
          "description": "Application identifier"
        },
        "Authorization": {
          "type": "string",
          "description": "Bearer token for authentication",
          "example": "Bearer YOUR_AUTH_TOKEN"
        },
        "Content-Type": {
          "type": "string",
          "enum": ["application/json"],
          "description": "Content type"
        }
      },
      "required": ["Deriv-App-ID", "Authorization", "Content-Type"]
    },
    "body": {
      "type": "object",
      "properties": {
        "data": {
          "type": "object",
          "description": "Withdrawal parameters.",
          "properties": {
            "agent_id": {
              "type": "integer",
              "description": "Unique identifier of the payment agent to withdraw through, as returned by the list endpoint.",
              "example": 42
            },
            "amount": {
              "type": "string",
              "description": "Amount to withdraw as a decimal string. Must satisfy the agent's `withdrawal_minimum` and `withdrawal_maximum` limits for the currency.",
              "example": "50.00"
            },
            "currency": {
              "type": "string",
              "description": "ISO 4217 currency code for the withdrawal. Must be supported by the target payment agent.",
              "example": "USD"
            },
            "verification_code": {
              "type": "string",
              "pattern": "^[0-9]{6}$",
              "description": "6-digit one-time verification code obtained from the withdrawal verification code endpoint.",
              "example": "123456"
            },
            "request_id": {
              "type": "string",
              "pattern": "^[\\w\\-]{1,128}$",
              "description": "Optional, 1-128 characters (letters, digits, underscore, hyphen). If provided, the withdrawal status can be retrieved via the withdrawal status endpoint. Without it, status tracking is unavailable for this withdrawal. Must be unique — reusing a previous `request_id` returns `RequestIDUsed`.",
              "example": "7842b85d-6979-4f9f-a0c7-cf2e8d122739"
            },
            "notes": {
              "type": "string",
              "description": "Optional free-text notes for this transaction.",
              "example": "Withdrawal request"
            }
          },
          "required": ["agent_id", "amount", "currency", "verification_code"]
        }
      },
      "required": ["data"]
    }
  },
  "required": ["headers", "body"]
}
