{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tgpaycrypto-com/json-schema/tgpaycrypto-com-withdrawal-schema.json",
  "title": "Withdrawal",
  "description": "The payout object — an on-chain withdrawal from the app balance (withdraw, getWithdrawals, and the kind=withdrawal variant of transfer webhooks). Same envelope shape as Transfer plus chain fields; distinguish it by kind=withdrawal.",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tgpaycrypto-com-openapi.json#/components/schemas/Withdrawal",
  "type": "object",
  "properties": {
    "kind": {
      "type": "string",
      "const": "withdrawal"
    },
    "transfer_id": {
      "type": "integer",
      "description": "Numeric withdrawal id; a separate id namespace from user transfers. Use kind and hash to distinguish."
    },
    "hash": {
      "type": "string",
      "format": "uuid"
    },
    "user_id": {
      "type": "null"
    },
    "recipient_username": {
      "type": "null"
    },
    "asset": {
      "type": "string"
    },
    "amount": {
      "$ref": "#/$defs/Amount"
    },
    "amount_minor": {
      "$ref": "#/$defs/AmountMinor"
    },
    "fee_minor": {
      "allOf": [
        {
          "$ref": "#/$defs/AmountMinor"
        }
      ],
      "description": "The network fee charged on top of the amount, in minor units."
    },
    "spend_id": {
      "type": "string"
    },
    "comment": {
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "processing",
        "completed",
        "failed"
      ],
      "description": "processing = held, delayed or broadcast; completed = confirmed on chain; failed = the hold (amount + fee) came back to the app balance."
    },
    "created_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "completed_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "expires_at": {
      "type": "null"
    },
    "invite_url": {
      "type": "null"
    },
    "network": {
      "type": "string"
    },
    "address": {
      "type": "string"
    },
    "memo": {
      "type": [
        "string",
        "null"
      ]
    },
    "txid": {
      "type": [
        "string",
        "null"
      ],
      "description": "Null until the transaction is broadcast."
    },
    "withdrawal_id": {
      "type": "string",
      "format": "uuid"
    },
    "withdrawal_status": {
      "type": "string",
      "enum": [
        "pending",
        "delayed",
        "broadcast",
        "confirmed",
        "failed",
        "rejected",
        "cancelled"
      ],
      "description": "The detailed withdrawal state."
    },
    "error": {
      "type": [
        "string",
        "null"
      ],
      "description": "Failure detail when status=failed; null otherwise."
    },
    "payload": {
      "type": "string",
      "description": "Present only when the withdrawal was created with payload."
    }
  },
  "required": [
    "kind",
    "transfer_id",
    "hash",
    "user_id",
    "recipient_username",
    "asset",
    "amount",
    "amount_minor",
    "fee_minor",
    "spend_id",
    "comment",
    "status",
    "created_at",
    "completed_at",
    "expires_at",
    "invite_url",
    "network",
    "address",
    "memo",
    "txid",
    "withdrawal_id",
    "withdrawal_status",
    "error"
  ],
  "$defs": {
    "Amount": {
      "type": "string",
      "description": "Non-negative fixed-point decimal string in whole-coin (or fiat) units, including zero balances and fees. Never a JSON number.",
      "pattern": "^[0-9]+(?:\\.[0-9]+)?$"
    },
    "AmountMinor": {
      "type": "string",
      "description": "The integer minor-unit amount as a string (wei-scale values overflow the JS Number type).",
      "pattern": "^[0-9]+$"
    }
  }
}