{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tgpaycrypto-com/json-schema/tgpaycrypto-com-transfer-request-schema.json",
  "title": "TransferRequest",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tgpaycrypto-com-openapi.json#/components/schemas/TransferRequest",
  "type": "object",
  "required": [
    "asset",
    "amount",
    "spend_id"
  ],
  "properties": {
    "user_id": {
      "anyOf": [
        {
          "oneOf": [
            {
              "type": "integer",
              "maximum": 9223372036854775807,
              "minimum": 1
            },
            {
              "type": "string",
              "pattern": "^\\s*\\+?0*(?:[1-9][0-9]{0,17}|[1-8][0-9]{18}|9[0-1][0-9]{17}|92[0-1][0-9]{16}|922[0-2][0-9]{15}|9223[0-2][0-9]{14}|92233[0-6][0-9]{13}|922337[0-1][0-9]{12}|92233720[0-2][0-9]{10}|922337203[0-5][0-9]{9}|9223372036[0-7][0-9]{8}|92233720368[0-4][0-9]{7}|922337203685[0-3][0-9]{6}|9223372036854[0-6][0-9]{5}|92233720368547[0-6][0-9]{4}|922337203685477[0-4][0-9]{3}|9223372036854775[0-7][0-9]{2}|922337203685477580[0-6]|9223372036854775807)\\s*$"
            }
          ],
          "description": "Recipient's Telegram user ID."
        },
        {
          "type": "null"
        }
      ]
    },
    "asset": {
      "type": "string",
      "minLength": 2,
      "maxLength": 16
    },
    "amount": {
      "$ref": "#/$defs/AmountInput",
      "description": "Also subject to platform min/max USD bounds."
    },
    "spend_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "description": "Required idempotency key, unique per app."
    },
    "comment": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 1024,
          "description": "Shown to the recipient."
        },
        {
          "type": "null"
        }
      ]
    },
    "disable_send_notification": {
      "anyOf": [
        {
          "$ref": "#/$defs/BooleanInput",
          "description": "Suppresses the immediate recipient notification only. A later escrow claim still sends a notification.",
          "default": false
        },
        {
          "type": "null"
        }
      ]
    },
    "username": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 64,
          "description": "Leading @ optional, case-insensitive. Normalized username: a letter followed by 3..31 letters, digits or underscores. An unknown username creates pending escrow."
        },
        {
          "type": "null"
        }
      ]
    },
    "payload": {
      "anyOf": [
        {
          "$ref": "#/$defs/OperationPayload"
        },
        {
          "type": "null"
        }
      ]
    },
    "webhook_url": {
      "anyOf": [
        {
          "$ref": "#/$defs/OperationWebhookUrl"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "oneOf": [
    {
      "allOf": [
        {
          "required": [
            "user_id"
          ],
          "properties": {
            "user_id": {
              "not": {
                "type": "null"
              }
            }
          }
        }
      ],
      "properties": {
        "username": {
          "enum": [
            null,
            ""
          ]
        }
      }
    },
    {
      "allOf": [
        {
          "required": [
            "username"
          ],
          "properties": {
            "username": {
              "not": {
                "type": "null"
              }
            }
          }
        }
      ],
      "properties": {
        "user_id": {
          "type": "null"
        },
        "username": {
          "type": "string",
          "minLength": 1
        }
      }
    }
  ],
  "$defs": {
    "AmountInput": {
      "type": "string",
      "minLength": 1,
      "maxLength": 40,
      "description": "Positive amount as a decimal string (not a JSON number). Surrounding whitespace and exponent notation are accepted. Crypto rounds to asset precision, midpoint away from zero, and must remain positive; fiat requires exact positive cents. Values must fit the server decimal parser and scaling arithmetic.",
      "pattern": "^\\s*\\+?(?=[0-9.]*[1-9])(?:[0-9]+(?:\\.[0-9]*)?|\\.[0-9]+)(?:[eE][+-]?[0-9]+)?\\s*$"
    },
    "BooleanInput": {
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "integer",
          "enum": [
            0,
            1
          ]
        },
        {
          "type": "string",
          "pattern": "^\\s*(?:[Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee]|[01]|[Yy][Ee][Ss]|[Nn][Oo]|[Oo][Nn]|[Oo][Ff][Ff])\\s*$"
        }
      ]
    },
    "OperationPayload": {
      "type": "string",
      "maxLength": 4096,
      "description": "Your own data, echoed in the object and its webhooks. An empty string means none."
    },
    "OperationWebhookUrl": {
      "type": "string",
      "maxLength": 256,
      "description": "This operation's own webhook address — an absolute public HTTPS URL, no embedded credentials, surrounding spaces trimmed. Every update of the operation goes here instead of the app's webhook URL, regardless of the app's event selection. An empty string means the app's URL. Not returned in objects. With a spend_id it is part of the compared request."
    }
  }
}