{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/grainfinance-co/json-schema/grainfinance-co-vendor-list-response-schema.json",
  "title": "VendorListResponse",
  "description": "A paginated list of vendors.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/grainfinance-co-vendors-api-openapi.yml#/components/schemas/VendorListResponse",
  "properties": {
    "vendors": {
      "items": {
        "$ref": "#/$defs/CustomerVendor"
      },
      "type": "array",
      "description": "A list of vendors, ordered by name."
    },
    "pagination": {
      "$ref": "#/$defs/PaginationResponse"
    }
  },
  "required": [
    "vendors",
    "pagination"
  ],
  "type": "object",
  "additionalProperties": false,
  "$defs": {
    "CountryCode": {
      "type": "string",
      "description": "The alpha-2 ISO 3166 country code of the entity's country.",
      "pattern": "^[A-Za-z]{2}$"
    },
    "CurrencyCode": {
      "type": "string",
      "description": "The alpha-3 ISO 4217 currency code of the related entity, in upper case.",
      "pattern": "^[A-Z]{3}$"
    },
    "CustomerVendor": {
      "description": "A Vendor represents a payee that payouts can be sent to. Returned by `POST /v1/vendors`,\n`GET /v1/vendors/{vendorId}`, and `GET /v1/vendors`.",
      "properties": {
        "vendorId": {
          "$ref": "#/$defs/UUID",
          "description": "The id of the vendor within the Grain platform."
        },
        "externalVendorId": {
          "$ref": "#/$defs/ExternalVendorId",
          "description": "The vendor id, as identified within your system."
        },
        "contact": {
          "$ref": "#/$defs/VendorContact",
          "description": "The contact details of the vendor."
        },
        "payoutMethods": {
          "items": {
            "$ref": "#/$defs/VendorPayoutMethod"
          },
          "type": "array",
          "description": "The payout methods registered for the vendor."
        },
        "createdAt": {
          "$ref": "#/$defs/IsoDateTime",
          "description": "When the vendor was created, as an ISO-8601 date-time in UTC."
        },
        "updatedAt": {
          "$ref": "#/$defs/IsoDateTime",
          "description": "When the vendor was last updated, as an ISO-8601 date-time in UTC."
        }
      },
      "required": [
        "vendorId",
        "externalVendorId",
        "contact",
        "payoutMethods",
        "createdAt",
        "updatedAt"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "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"
    },
    "ExternalVendorId": {
      "type": "string",
      "description": "Partner's own reference ID for the vendor.",
      "pattern": "^[A-Za-z0-9_.\\-]{1,64}$"
    },
    "IsoDateTime": {
      "type": "string",
      "format": "date-time",
      "description": "An ISO-8601 date-time string in UTC."
    },
    "Page": {
      "type": "number",
      "format": "double",
      "description": "The page indicating which set of items are returned",
      "minimum": 1
    },
    "PaginationResponse": {
      "description": "Pagination parameters of the returned results.",
      "properties": {
        "page": {
          "$ref": "#/$defs/Page"
        },
        "perPage": {
          "$ref": "#/$defs/PerPage"
        },
        "totalResults": {
          "type": "number",
          "format": "double",
          "description": "The total amount of results available"
        }
      },
      "required": [
        "page",
        "perPage",
        "totalResults"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "PerPage": {
      "type": "number",
      "format": "double",
      "description": "number of items in a page",
      "minimum": 1,
      "maximum": 100
    },
    "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}"
    },
    "VendorContact": {
      "description": "The contact details of the vendor. Conditional fields (`state`, `taxId`, `phoneNumber`,\n`companyRegisterNumber`) are returned only when they were provided.",
      "properties": {
        "fullName": {
          "type": "string",
          "description": "The full name of the vendor's contact person or business."
        },
        "country": {
          "$ref": "#/$defs/CountryCode",
          "description": "The alpha-2 ISO 3166 country code of the vendor."
        },
        "city": {
          "type": "string",
          "description": "The city of the vendor's address."
        },
        "email": {
          "type": "string",
          "description": "The email address of the vendor, when provided."
        },
        "streetName": {
          "type": "string",
          "description": "The street name of the vendor's address, when provided."
        },
        "buildingName": {
          "type": "string",
          "description": "The building name or number of the vendor's address, when provided."
        },
        "postalCode": {
          "type": "string",
          "description": "The postal code of the vendor's address, when provided."
        },
        "state": {
          "type": "string",
          "description": "The ISO state code of the vendor's address, when provided. Required for vendors in US, CA, NZ and AU."
        },
        "taxId": {
          "type": "string",
          "description": "The tax id of the vendor, when provided."
        },
        "phoneNumber": {
          "type": "string",
          "description": "The phone number of the vendor's contact, when provided."
        },
        "companyRegisterNumber": {
          "type": "string",
          "description": "The company register number of the vendor, when provided."
        }
      },
      "required": [
        "fullName",
        "country",
        "city"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "VendorPayoutMethod": {
      "description": "A payout method registered for the vendor — the bank account payouts in `currency` are sent to.\nBank account fields are corridor-specific: only the fields relevant to the method's currency,\ncountry, and type are returned.",
      "properties": {
        "type": {
          "$ref": "#/$defs/DisplayPaymentMethod",
          "description": "The payment method used to send payouts to this bank account."
        },
        "currency": {
          "$ref": "#/$defs/CurrencyCode",
          "description": "The alpha-3 ISO 4217 currency code of payouts sent with this method."
        },
        "bankName": {
          "type": "string",
          "description": "The name of the bank holding the account."
        },
        "bankCountry": {
          "$ref": "#/$defs/CountryCode",
          "description": "The alpha-2 ISO 3166 country code of the bank."
        },
        "bankState": {
          "type": "string",
          "description": "The ISO state code of the bank's location, when applicable."
        },
        "accountNumber": {
          "type": "string",
          "description": "The account number, 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, when applicable — the nine-digit ABA routing number for USD payouts."
        },
        "bankCode": {
          "type": "string",
          "description": "Country-specific bank code, when applicable — CAD (EFT), HKD (CCASS), SGD (IBG) and MXN (SPEI) payouts."
        },
        "branchCode": {
          "type": "string",
          "description": "Country-specific branch code, when applicable — CAD (EFT), HKD (CCASS), SGD (IBG) and MXN (SPEI) payouts."
        },
        "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}$"
        },
        "bankAddress": {
          "type": "string",
          "description": "The full address of the bank, when provided."
        }
      },
      "required": [
        "type",
        "currency",
        "bankName",
        "bankCountry"
      ],
      "type": "object",
      "additionalProperties": false
    }
  }
}