# Validate a transfer

> Validate transfer fields and current business conditions without executing the transfer creation flow.

```yaml
openapi: 3.1.0
x-onerway-docs-version: original
x-onerway-spec-key: transfer/v3-transactions/validate
info:
  title: Validate a transfer
  version: original
  description: Validate transfer fields and current business conditions without
    executing the transfer creation flow.
servers:
  - url: https://sandbox-transfer-api.onerway.com
    description: sandbox
  - url: https://transfer-api.onerway.com
    description: production
paths:
  /api/v3/txn/validate:
    post:
      summary: Validate a transfer
      description: Validate transfer fields and current business conditions without
        executing the transfer creation flow.
      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:
                requestId:
                  type: string
                  description: Merchant-generated business reference for the payout.
                  x-onerway-constraints:
                    - kind: rule
                      text: "Maximum length: 64."
                transactionInfo:
                  type: object
                  properties:
                    sourceAmount:
                      type: number
                      description: Source amount denominated in `sourceCurrency`.
                      x-onerway-required: conditional
                      x-onerway-condition:
                        - Required for chargeBearer=CRED
                      x-onerway-constraints:
                        - kind: rule
                          text: Must be greater than 0 when chargeBearer is CRED. The target amount is
                            calculated by the service; supplying both amounts
                            does not fix an exchange rate.
                    sourceCurrency:
                      type: string
                      description: Source currency. See [currency
                        enums](/transfer/api-reference/v3-enums#currency-enums).
                    targetAmount:
                      type: number
                      description: Target amount denominated in `targetCurrency`.
                      x-onerway-required: conditional
                      x-onerway-condition:
                        - Required for chargeBearer=DEBT
                      x-onerway-constraints:
                        - kind: rule
                          text: Must be greater than 0 when chargeBearer is DEBT. The source amount is
                            calculated by the service; supplying both amounts
                            does not fix an exchange rate.
                    targetCurrency:
                      type: string
                      description: Target currency. See [currency
                        enums](/transfer/api-reference/v3-enums#currency-enums).
                    destinationCountry:
                      type: string
                      description: Recipient account country or region. See [country/region
                        enums](/transfer/api-reference/v3-enums#countryregion-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
                    transactionPurpose:
                      type: string
                      description: Transaction purpose. See [enum
                        values](/transfer/api-reference/v3-enums#transactionpurpose-transaction-purposes).
                      enum:
                        - TRANSFER_TO_OWN_ACCOUNT
                        - LOAN_OR_CREDIT_REPAYMENT
                        - FREIGHT_CHARGES
                        - PROFESSIONAL_OR_BUSINESS_SERVICES
                        - OTHER
                      x-enum-descriptions:
                        TRANSFER_TO_OWN_ACCOUNT: Transfer to own account
                        LOAN_OR_CREDIT_REPAYMENT: Loan or credit repayment
                        FREIGHT_CHARGES: Freight charges
                        PROFESSIONAL_OR_BUSINESS_SERVICES: Professional or business services
                        OTHER: Other
                    reference:
                      type: string
                      description: Payment reference or remarks.
                      x-onerway-constraints:
                        - kind: rule
                          text: "The maximum length depends on the beneficiary address country: CA 19; VN
                            25; MX 30; SG/AU/IN 32; ID 35; NG 64; BR 106;
                            PH/MY/US/GB/JP/SA/KR/CN/EG 200; all other countries
                            140 characters."
                    chargeBearer:
                      type: string
                      description: Platform fee bearer. See [enum
                        values](/transfer/api-reference/v3-enums#chargebearer-platform-fee-bearers).
                      enum:
                        - DEBT
                        - CRED
                      x-enum-descriptions:
                        DEBT: Payer bears the platform fee
                        CRED: Beneficiary bears the platform fee
                    swiftFeeType:
                      type: string
                      description: SWIFT fee option; separate from the platform fee bearer. See [enum
                        values](/transfer/api-reference/v3-enums#swiftfeetype-swift-fee-options).
                      enum:
                        - OUR
                        - SHA
                      x-enum-descriptions:
                        OUR: Payer bears the SWIFT fees
                        SHA: Fees are shared
                      x-onerway-required: conditional
                      x-onerway-condition:
                        - Required when paymentMethod is SWIFT; omit for other
                          payment methods.
                      x-onerway-constraints:
                        - kind: rule
                          text: For SWIFT payments, specify OUR or SHA. Omit this field for other payment
                            methods.
                  required:
                    - sourceCurrency
                    - targetCurrency
                    - destinationCountry
                    - paymentMethod
                    - transactionPurpose
                    - reference
                    - chargeBearer
                  description: Amount, currencies and payment method
                beneficiary:
                  type: object
                  properties:
                    beneficiaryId:
                      type: integer
                      description: Onerway beneficiary ID (64-bit integer).
                  required:
                    - beneficiaryId
                  description: Beneficiary for this payment.
                onBehalfOf:
                  type: string
                  description: Merchant number that the request applies to. Supply it only when
                    making a request on behalf of another merchant.
              required:
                - requestId
                - transactionInfo
                - beneficiary
            examples:
              default:
                summary: Request structure (replace with your merchant data)
                value:
                  requestId: demo_transfer_001
                  transactionInfo:
                    sourceAmount: 100
                    sourceCurrency: USD
                    targetCurrency: USD
                    destinationCountry: US
                    paymentMethod: BANK_TRANSFER
                    transactionPurpose: TRANSFER_TO_OWN_ACCOUNT
                    chargeBearer: CRED
                  beneficiary:
                    beneficiaryId: 10001
      responses:
        "200":
          description: Success example
          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:
                          success:
                            type: boolean
                            description: true when validation succeeds
                          errors:
                            type: array
                            description: Empty on successful validation; failures use the top-level error
                            items:
                              type: object
                              properties:
                                {}
                        description: Business data on success; do not consume as valid business data on
                          failure
                        x-onerway-constraints:
                          - kind: rule
                            text: On success, data.success is true and data.errors is empty. Precheck
                              failures use the top-level error with a string
                              array in error.errorDetails. Validation does not
                              reserve funds, lock a rate or guarantee a later
                              transfer.
                      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: string
                        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
                          requestId:
                            type: string
                          errorDetails:
                            type: array
                            items:
                              type: string
                        required:
                          - type
                          - code
                          - message
                          - requestId
                          - errorDetails
                    required:
                      - respCode
                      - respMsg
                      - error
              examples:
                "90001":
                  summary: Changing sourceAmount to 0 for CRED.
                  description: Changing sourceAmount to 0 for CRED.
                  value:
                    respCode: "90001"
                    respMsg: Source amount needs to be greater than zero
                    error:
                      type: validation_error
                      code: payout_validate_failed
                      message: One or more request fields failed payout validation rules
                      requestId: req_00000000000000000000000000000001
                      errorDetails:
                        - Source amount needs to be greater than zero
                success:
                  summary: Success example
                  value:
                    respCode: "20000"
                    respMsg: Success
                    data:
                      success: true
                      errors:
                        []
                failure:
                  summary: Changing sourceAmount to 0 for CRED.
                  value:
                    respCode: "90001"
                    respMsg: Source amount needs to be greater than zero
                    error:
                      type: validation_error
                      code: payout_validate_failed
                      message: One or more request fields failed payout validation rules
                      requestId: req_00000000000000000000000000000001
                      errorDetails:
                        - Source amount needs to be greater than zero
```
