{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/grainfinance-co/json-schema/grainfinance-co-payout-proposal-response-schema.json",
  "title": "PayoutProposalResponse",
  "description": "A pending payout proposal, returned by `POST /v1/payouts` (review). Submit it via\n`POST /v1/payouts/{id}/submit` to execute the payout.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/grainfinance-co-payouts-api-openapi.yml#/components/schemas/PayoutProposalResponse",
  "properties": {
    "id": {
      "$ref": "#/$defs/UUID",
      "description": "The id of the payout proposal within the Grain platform."
    },
    "externalPayoutId": {
      "$ref": "#/$defs/ExternalPayoutId",
      "description": "The payout id, as identified within your system."
    },
    "currency": {
      "$ref": "#/$defs/CurrencyCode",
      "description": "The alpha-3 ISO 4217 currency code of the payout."
    },
    "amount": {
      "type": "number",
      "format": "double",
      "description": "The payout amount, denoted in `currency`."
    },
    "fee": {
      "type": "number",
      "format": "double",
      "description": "The fee applied to this payout, denoted in `currency`."
    },
    "totalAmount": {
      "type": "number",
      "format": "double",
      "description": "Total amount that will leave the wallet (`amount + fee`), denoted in `currency`."
    },
    "reason": {
      "$ref": "#/$defs/ComplianceReasonCode",
      "description": "The compliance reason categorising this payout, as a numeric code:\n\n1 - Intercompany Payment\n2 - Purchase of Good(s)\n3 - Purchase of Service(s)\n4 - Transferring to Own Accounts\n5 - Valid Vendor Purchases"
    },
    "description": {
      "type": [
        "string",
        "null"
      ],
      "description": "Free-form description supplied when initiating the payout."
    },
    "validUntilTs": {
      "type": "number",
      "format": "double",
      "description": "When the proposal expires if not submitted, as a Unix timestamp in seconds."
    },
    "payoutMethod": {
      "$ref": "#/$defs/DisplayPaymentMethod",
      "description": "The payment method that will be used to send the payout."
    },
    "vendorDetails": {
      "$ref": "#/$defs/PayoutVendorDetails",
      "description": "The vendor receiving the payout, including their bank account details."
    }
  },
  "required": [
    "id",
    "externalPayoutId",
    "currency",
    "amount",
    "fee",
    "totalAmount",
    "reason",
    "description",
    "validUntilTs",
    "payoutMethod",
    "vendorDetails"
  ],
  "type": "object",
  "additionalProperties": false,
  "$defs": {
    "ComplianceReasonCode": {
      "description": "The compliance reason categorising a payout, as a numeric code:\n\n1 - Intercompany Payment\n2 - Purchase of Good(s)\n3 - Purchase of Service(s)\n4 - Transferring to Own Accounts\n5 - Valid Vendor Purchases",
      "enum": [
        1,
        2,
        3,
        4,
        5
      ],
      "type": "number"
    },
    "CurrencyCode": {
      "type": "string",
      "description": "The alpha-3 ISO 4217 currency code of the related entity, in upper case.",
      "pattern": "^[A-Z]{3}$"
    },
    "DisplayPaymentMethod": {
      "enum": [
        "SWIFT",
        "SEPA",
        "WIRE",
        "ACH",
        "FPS",
        "CA ACSS",
        "NPP",
        "IBG",
        "BECS",
        "CCASS",
        "TEF",
        "UAEFTS",
        "SIC",
        "CERTIS",
        "DKSMC",
        "NICS",
        "SORBNET",
        "RIX",
        "SAMOS",
        "ZAHAV",
        "SARIE",
        "QPS"
      ],
      "type": "string"
    },
    "ExternalPayoutId": {
      "type": "string",
      "description": "Partner's own reference number for this payout.",
      "pattern": "^[A-Za-z0-9_.\\-]{1,64}$"
    },
    "ExternalVendorId": {
      "type": "string",
      "description": "Partner's own reference ID for the vendor.",
      "pattern": "^[A-Za-z0-9_.\\-]{1,64}$"
    },
    "PayoutVendorDetails": {
      "description": "The vendor receiving the payout, including their bank account details.",
      "properties": {
        "vendorId": {
          "$ref": "#/$defs/UUID",
          "description": "The id of the vendor within the Grain platform."
        },
        "vendorName": {
          "type": "string",
          "description": "The name of the vendor."
        },
        "externalVendorId": {
          "$ref": "#/$defs/ExternalVendorId",
          "description": "The vendor id, as identified within your system."
        },
        "bankDetails": {
          "$ref": "#/$defs/VendorBankDetails",
          "description": "Bank account details to which the payout will be sent."
        }
      },
      "required": [
        "vendorId",
        "vendorName",
        "externalVendorId",
        "bankDetails"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "UUID": {
      "type": "string",
      "format": "uuid",
      "pattern": "[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}"
    },
    "VendorBankDetails": {
      "description": "Bank account details of a vendor receiving a payout.",
      "properties": {
        "accountHolderName": {
          "type": "string",
          "description": "The full legal name of the account holder."
        },
        "accountNumber": {
          "type": "string",
          "description": "The account number."
        },
        "bankName": {
          "type": "string",
          "description": "The name of the bank holding the account."
        },
        "bankAddress": {
          "type": "string",
          "description": "The full address of the bank."
        },
        "bankCountry": {
          "type": "string",
          "description": "The alpha-2 ISO 3166 country code of the bank.",
          "pattern": "^[A-Za-z]{2}$"
        },
        "bankState": {
          "type": "string",
          "description": "The state/region of the bank's location, when applicable."
        },
        "iban": {
          "type": "string",
          "description": "The IBAN of the account, when applicable.",
          "pattern": "^[A-Z0-9]{15,34}$"
        },
        "bicSwift": {
          "type": "string",
          "description": "The SWIFT/BIC code of the bank, when applicable.",
          "pattern": "^[A-Z]{6}[A-Z0-9]{2}([A-Z0-9]{3})?$"
        },
        "routingCode": {
          "type": "string",
          "description": "Country-specific routing code (e.g. IFSC for India, CLABE for Mexico, Canadian transit), when applicable.\nFor US ACH and wire, see `achRoutingCode` / `wireRoutingCode` on wallet responses."
        },
        "bankCode": {
          "type": "string",
          "description": "Country-specific bank code, when applicable."
        },
        "branchCode": {
          "type": "string",
          "description": "Country-specific branch code, when applicable."
        },
        "sortCode": {
          "type": "string",
          "description": "UK sort code, when applicable. Six digits, no hyphens.",
          "pattern": "^\\d{6}$"
        },
        "bsbCode": {
          "type": "string",
          "description": "Australian BSB code, when applicable. Six digits, no hyphens.",
          "pattern": "^\\d{6}$"
        }
      },
      "required": [
        "accountHolderName",
        "accountNumber",
        "bankName",
        "bankAddress",
        "bankCountry"
      ],
      "type": "object",
      "additionalProperties": false
    }
  }
}