# Retrieve beneficiary field rules

> Retrieve beneficiary field definitions and validation rules for a merchant, country, currency, entity type and payment method.

```yaml
openapi: 3.1.0
x-onerway-docs-version: original
x-onerway-spec-key: transfer/v3-beneficiaries/schema
info:
  title: Retrieve beneficiary field rules
  version: original
  description: Retrieve beneficiary field definitions and validation rules for a
    merchant, country, currency, entity type and payment method.
servers:
  - url: https://sandbox-transfer-api.onerway.com
    description: sandbox
  - url: https://transfer-api.onerway.com
    description: production
paths:
  /api/v3/beneficiary/schema:
    post:
      summary: Retrieve beneficiary field rules
      description: Retrieve beneficiary field definitions and validation rules for a
        merchant, country, currency, entity type and payment method.
      parameters:
        - name: ApiKey
          in: header
          required: true
          description: Account service API key assigned by Onerway, supplied in the
            request header. Use the key for the same environment as the request
            domain.
          schema:
            type: string
            description: Account service API key assigned by Onerway, supplied in the
              request header. Use the key for the same environment as the
              request domain.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                destinationCountry:
                  type: string
                  description: Recipient account country or region. See [country/region
                    enums](/transfer/api-reference/v3-enums#countryregion-enums).
                  x-onerway-constraints:
                    - kind: rule
                      text: "Maximum length: 12."
                targetCurrency:
                  type: string
                  description: Target currency. See [currency
                    enums](/transfer/api-reference/v3-enums#currency-enums).
                  x-onerway-constraints:
                    - kind: rule
                      text: "Maximum length: 128."
                paymentMethod:
                  type: string
                  description: Payment method. See [enum
                    values](/transfer/api-reference/v3-enums#paymentmethod-payment-methods).
                  enum:
                    - BANK_TRANSFER
                    - SWIFT
                    - E_WALLET
                    - CASH_PICKUP
                  x-enum-descriptions:
                    BANK_TRANSFER: Bank transfer
                    SWIFT: SWIFT transfer
                    E_WALLET: E-wallet
                    CASH_PICKUP: Cash pickup
                entityType:
                  type: string
                  description: Entity type. See [enum
                    values](/transfer/api-reference/v3-enums#entitytype-entity-types).
                  enum:
                    - INDIVIDUAL
                    - BUSINESS
                  x-enum-descriptions:
                    INDIVIDUAL: Individual
                    BUSINESS: Business
                walletProvider:
                  type: string
                  description: Wallet provider. See [wallet
                    providers](/transfer/api-reference/v3-enums#walletprovider-walletformat-wallet-providers-and-account-formats).
                  x-onerway-required: conditional
                  x-onerway-condition:
                    - Required when paymentMethod is E_WALLET.
                  x-onerway-constraints:
                    - kind: rule
                      text: Required when paymentMethod is E_WALLET.
                    - kind: consistency
                      text: Supply walletProvider and walletFormat as a pair valid for the merchant,
                        account country, currency and entity type.
                    - kind: rule
                      text: "Maximum length: 64."
                walletFormat:
                  type: string
                  description: Wallet account format for the selected walletProvider. See [wallet
                    account
                    formats](/transfer/api-reference/v3-enums#walletprovider-walletformat-wallet-providers-and-account-formats).
                  x-onerway-required: conditional
                  x-onerway-condition:
                    - Required when paymentMethod is E_WALLET.
                  x-onerway-constraints:
                    - kind: rule
                      text: Required when paymentMethod is E_WALLET.
                    - kind: rule
                      text: "Maximum length: 64."
                onBehalfOf:
                  type: string
                  description: Merchant number that the request applies to. Supply it only when
                    making a request on behalf of another merchant.
              required:
                - destinationCountry
                - targetCurrency
                - paymentMethod
                - entityType
            examples:
              default:
                summary: Request structure (replace with your merchant data)
                value:
                  destinationCountry: US
                  targetCurrency: USD
                  paymentMethod: BANK_TRANSFER
                  entityType: BUSINESS
              wallet:
                summary: E-wallet
                value:
                  destinationCountry: US
                  targetCurrency: USD
                  paymentMethod: E_WALLET
                  entityType: BUSINESS
                  walletProvider: PAYPAL
                  walletFormat: EMAIL
      responses:
        "200":
          description: Success example (selected fields, not a configuration snapshot)
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    properties:
                      respCode:
                        type: string
                        description: Response code; `20000` indicates successful request processing. All
                          other values are error codes.
                      respMsg:
                        type: string
                        description: Human-readable description of the response code.
                      data:
                        type: object
                        properties:
                          condition:
                            type: object
                            properties:
                              merchantNo:
                                type: string
                                description: Merchant number of the request initiator.
                              destinationCountry:
                                type: string
                                description: Recipient account country or region. See [country/region
                                  enums](/transfer/api-reference/v3-enums#countryregion-enums).
                              targetCurrency:
                                type: string
                                description: Target currency. See [currency
                                  enums](/transfer/api-reference/v3-enums#currency-enums).
                              paymentMethod:
                                type: string
                                description: Payment method. See [enum
                                  values](/transfer/api-reference/v3-enums#paymentmethod-payment-methods).
                                enum:
                                  - BANK_TRANSFER
                                  - SWIFT
                                  - E_WALLET
                                  - CASH_PICKUP
                                x-enum-descriptions:
                                  BANK_TRANSFER: Bank transfer
                                  SWIFT: SWIFT transfer
                                  E_WALLET: E-wallet
                                  CASH_PICKUP: Cash pickup
                              entityType:
                                type: string
                                description: Entity type. See [enum
                                  values](/transfer/api-reference/v3-enums#entitytype-entity-types).
                                enum:
                                  - INDIVIDUAL
                                  - BUSINESS
                                x-enum-descriptions:
                                  INDIVIDUAL: Individual
                                  BUSINESS: Business
                              walletProvider:
                                type: string
                                description: Wallet provider. See [wallet
                                  providers](/transfer/api-reference/v3-enums#walletprovider-walletformat-wallet-providers-and-account-formats).
                              walletFormat:
                                type: string
                                description: Wallet account format for the selected walletProvider. See [wallet
                                  account
                                  formats](/transfer/api-reference/v3-enums#walletprovider-walletformat-wallet-providers-and-account-formats).
                            description: Conditions used for this schema query
                          fields:
                            type: array
                            description: Field definitions for these conditions
                            items:
                              type: object
                              properties:
                                path:
                                  type: string
                                  description: Field path in the request to [create a
                                    beneficiary](/transfer/api-reference/endpoints/v3-beneficiaries-add).
                                required:
                                  type: string
                                  description: Whether the field is universally required. See [enum
                                    values](/transfer/api-reference/v3-enums#field-rules).
                                  enum:
                                    - MANDATORY
                                    - OPTIONAL
                                  x-enum-descriptions:
                                    MANDATORY: Required
                                    OPTIONAL: Not universally required; conditional rules still apply
                                type:
                                  type: string
                                  description: Field value type. See [enum
                                    values](/transfer/api-reference/v3-enums#field-rules).
                                  enum:
                                    - STRING
                                    - DATE
                                  x-enum-descriptions:
                                    STRING: String
                                    DATE: Date
                                description:
                                  type: string
                                  description: Field or option description
                                example:
                                  type: string
                                  description: Nullable example value; not a default
                                options:
                                  type: array
                                  description: Candidate values for this field. Omitted when no candidate list is
                                    supplied.
                                  items:
                                    type: object
                                    properties:
                                      value:
                                        type: string
                                        description: Value to send in the field identified by path.
                                      description:
                                        type: string
                                        description: Display description of the candidate value.
                                rules:
                                  type: array
                                  description: Field validation rules
                                  items:
                                    type: object
                                    properties:
                                      ruleType:
                                        type: string
                                        description: Validation rule type. See [enum
                                          values](/transfer/api-reference/v3-enums#field-rules).
                                        enum:
                                          - REQUIRED
                                          - LENGTH_RANGE
                                          - NUMBER_RANGE
                                          - REGEX
                                          - AMOUNT_RANGE
                                          - TIME_RANGE
                                          - CONDITION
                                          - UNKNOWN
                                        x-enum-descriptions:
                                          REQUIRED: Required-field rule
                                          LENGTH_RANGE: Length range
                                          NUMBER_RANGE: Numeric range
                                          REGEX: Regular expression
                                          AMOUNT_RANGE: Amount range
                                          TIME_RANGE: Time range
                                          CONDITION: Conditional or composite rule
                                          UNKNOWN: Unknown rule type; returned when the rule is configured as UNKNOWN
                                      params:
                                        type: object
                                        properties:
                                          min:
                                            type: number
                                            description: Lower bound (inclusive). Applies when ruleType is LENGTH_RANGE,
                                              NUMBER_RANGE or AMOUNT_RANGE and
                                              the range parameters are
                                              configured.
                                          max:
                                            type: number
                                            description: Upper bound (inclusive). Applies when ruleType is LENGTH_RANGE,
                                              NUMBER_RANGE or AMOUNT_RANGE and
                                              the range parameters are
                                              configured.
                                          startTime:
                                            type: string
                                            description: "Inclusive lower bound of the absolute time range. Returned when
                                              ruleType is TIME_RANGE and
                                              time-range parameters are
                                              configured; may be null if no
                                              absolute lower bound is
                                              configured. Time zone: Beijing
                                              time (UTC+8)."
                                          endTime:
                                            type: string
                                            description: "Inclusive upper bound of the absolute time range. Returned when
                                              ruleType is TIME_RANGE and
                                              time-range parameters are
                                              configured; may be null if no
                                              absolute upper bound is
                                              configured. Time zone: Beijing
                                              time (UTC+8)."
                                          pattern:
                                            type: string
                                            description: Regular expression to match. Returned when ruleType is REGEX and an
                                              expression is configured.
                                          rules:
                                            type: array
                                            description: Nested rules for the same field. Returned when ruleType is
                                              CONDITION and nested rules are
                                              configured. When the composite
                                              rule applies, all nested rules
                                              must pass. Each item has its own
                                              ruleType and params.
                                            items:
                                              type: object
                                              properties:
                                                ruleType:
                                                  type: string
                                                  description: Nested rule type. See [enum
                                                    values](/transfer/api-reference/v3-enums#field-rules).
                                                  enum:
                                                    - REQUIRED
                                                    - LENGTH_RANGE
                                                    - NUMBER_RANGE
                                                    - REGEX
                                                    - AMOUNT_RANGE
                                                    - TIME_RANGE
                                                    - CONDITION
                                                    - UNKNOWN
                                                  x-enum-descriptions:
                                                    REQUIRED: Required-field rule
                                                    LENGTH_RANGE: Length range
                                                    NUMBER_RANGE: Numeric range
                                                    REGEX: Regular expression
                                                    AMOUNT_RANGE: Amount range
                                                    TIME_RANGE: Time range
                                                    CONDITION: Conditional or composite rule
                                                    UNKNOWN: Unknown rule type; returned when the rule is configured as UNKNOWN
                                                params:
                                                  type: object
                                                  properties:
                                                    {}
                                                  description: Recursively uses this parameter structure; no fixed nesting depth
                                                    is specified
                                        description: Parameters for the current rule; see each field for the applicable
                                          rule types. Time parameters expose
                                          only absolute boundaries. Use the
                                          beneficiary validation endpoint to
                                          check age requirements and other
                                          relative date limits.
                                      message:
                                        type: string
                                        description: Readable error or rule message
                        description: Business data on success; do not consume as valid business data on
                          failure
                        x-onerway-constraints:
                          - kind: rule
                            text: The query fails if applicable routing or validation rules are not
                              configured. A failure does not mean that no fields
                              are required.
                      error:
                        type: object
                        properties:
                          type:
                            type: string
                            description: Error type.
                          code:
                            type: string
                            description: Endpoint error identifier.
                          declineCode:
                            type: string
                            description: Decline reason code; may be empty.
                          message:
                            type: string
                            description: Detailed error description
                          param:
                            type: string
                            description: Failed field or condition; may be empty when no field is identified
                          docUrl:
                            type: string
                            description: Link to error documentation; may be empty.
                          requestId:
                            type: string
                            description: Server-generated error trace identifier, req_ plus 32 hexadecimal
                              characters; not the merchant requestId
                          errorDetails:
                            type: array
                            description: Error details; see the variants below
                            items:
                              type: object
                              properties:
                                errorCode:
                                  type: string
                                  description: Business or validation detail code.
                                message:
                                  type: string
                                  description: Detail message
                        description: Structured failure information; not present for every failure path
                  - type: object
                    properties:
                      respCode:
                        type: string
                      respMsg:
                        type: string
                      error:
                        type: object
                        properties:
                          type:
                            type: string
                          code:
                            type: string
                          message:
                            type: string
                          param:
                            type: string
                          requestId:
                            type: string
                          errorDetails:
                            type: array
                        required:
                          - type
                          - code
                          - message
                          - param
                          - requestId
                          - errorDetails
                    required:
                      - respCode
                      - respMsg
                      - error
                  - type: object
                    properties:
                      respCode:
                        type: string
                      respMsg:
                        type: string
                      error:
                        type: object
                        properties:
                          type:
                            type: string
                          code:
                            type: string
                          message:
                            type: string
                          requestId:
                            type: string
                          errorDetails:
                            type: array
                          param:
                            type: string
                        required:
                          - type
                          - code
                          - message
                          - requestId
                          - errorDetails
                          - param
                    required:
                      - respCode
                      - respMsg
                      - error
              examples:
                "40004":
                  summary: The wallet configuration query succeeds, but no configuration matches
                    the supplied walletProvider and walletFormat.
                  description: The wallet provider and account format do not match an available
                    wallet configuration.
                  value:
                    respCode: "40004"
                    respMsg: Illegal parameter [walletProvider/walletFormat]
                    error:
                      type: validation_error
                      code: invalid_wallet_selection
                      message: walletProvider and walletFormat must match an available wallet
                        configuration
                      param: walletProvider
                      requestId: req_00000000000000000000000000000001
                      errorDetails:
                        []
                "50097":
                  summary: The requested country, currency and payment method do not form a
                    supported scenario.
                  description: The requested country, currency and payment method do not form a
                    supported scenario.
                  value:
                    respCode: "50097"
                    respMsg: payment country is not surpport this payment method
                    error:
                      type: business_error
                      code: invalid_schema_scene
                      message: destinationCountry, targetCurrency and paymentMethod do not form a
                        supported schema scene
                      requestId: req_00000000000000000000000000000001
                      errorDetails:
                        []
                      param: destinationCountry
                success:
                  summary: Success example (selected fields, not a configuration snapshot)
                  value:
                    respCode: "20000"
                    respMsg: Success
                    data:
                      condition:
                        merchantNo: "10000"
                        destinationCountry: US
                        targetCurrency: USD
                        paymentMethod: BANK_TRANSFER
                        entityType: BUSINESS
                      fields:
                        - path: account.countryCode
                          required: MANDATORY
                          type: STRING
                          description: account country
                          example: US
                          rules:
                            []
                        - path: account.currency
                          required: MANDATORY
                          type: STRING
                          description: account currency
                          example: USD
                          rules:
                            []
                        - path: business.companyName
                          required: OPTIONAL
                          type: STRING
                          description: business company name
                          rules:
                            - ruleType: LENGTH_RANGE
                              params:
                                max: 64
                              message: business.companyName length cannot exceed 64
                failure:
                  summary: The requested country, currency and payment method do not form a
                    supported scenario.
                  value:
                    respCode: "50097"
                    respMsg: payment country is not surpport this payment method
                    error:
                      type: business_error
                      code: invalid_schema_scene
                      message: destinationCountry, targetCurrency and paymentMethod do not form a
                        supported schema scene
                      requestId: req_00000000000000000000000000000001
                      errorDetails:
                        []
                      param: destinationCountry
```
