> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rhinestone.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Start a withdrawal to a bank account

> Prepares the payout with the provider and opens it for one exact amount: the requested amount, or slightly less (one base unit at a time) when another open withdrawal holds it. Then send `order.payment` exactly. A source holding the token the provider takes, on its chain, pays the provider directly; any other source on a chain that takes deposits pays into the customer’s withdrawal account an amount quoted to deliver it (`SOURCE_NOT_SUPPORTED`, `NO_ROUTE` or `QUOTE_UNAVAILABLE` otherwise, holding nothing). Once the order exists, every error names it (`orderId`).



## OpenAPI

````yaml https://raw.githubusercontent.com/rhinestonewtf/openapi/refs/heads/main/deposit-service.json post /offramp/orders
openapi: 3.1.0
info:
  title: Deposit Service API
  version: 1.0.0
  description: >-
    Rhinestone Deposits API: accept deposits from any chain, asset or payment
    method, and settle them as one token on one chain.
servers:
  - url: https://v1.orchestrator.rhinestone.dev/deposit-processor
security: []
paths:
  /offramp/orders:
    post:
      tags:
        - Offramp
      summary: Start a withdrawal to a bank account
      description: >-
        Prepares the payout with the provider and opens it for one exact amount:
        the requested amount, or slightly less (one base unit at a time) when
        another open withdrawal holds it. Then send `order.payment` exactly. A
        source holding the token the provider takes, on its chain, pays the
        provider directly; any other source on a chain that takes deposits pays
        into the customer’s withdrawal account an amount quoted to deliver it
        (`SOURCE_NOT_SUPPORTED`, `NO_ROUTE` or `QUOTE_UNAVAILABLE` otherwise,
        holding nothing). Once the order exists, every error names it
        (`orderId`).
      parameters:
        - schema:
            type: string
            description: 'Integrator API key: the project’s orders'
          required: false
          description: 'Integrator API key: the project’s orders'
          name: x-api-key
          in: header
        - schema:
            type: string
            description: >-
              Customer bearer from `POST /compliance/sessions`, or a
              project-scoped platform bearer where the route permits tenant
              access
            example: Bearer eyJhbGciOi...
          required: false
          description: >-
            Customer bearer from `POST /compliance/sessions`, or a
            project-scoped platform bearer where the route permits tenant access
          name: authorization
          in: header
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOfframpOrder'
      responses:
        '201':
          description: The order, the payment to send, and the estimate
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OfframpOrderCreated'
        '400':
          description: Invalid request; AMOUNT_TOO_SMALL; or INVALID_BENEFICIARY
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OfframpError'
        '401':
          description: Missing or invalid credentials
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                    enum:
                      - VERIFICATION_REQUIRED
                      - PROVIDER_UNAVAILABLE
                      - PROVIDER_REJECTED
                      - PROVIDER_FORBIDDEN
                      - READ_ONLY_SESSION
                    description: >-
                      VERIFICATION_REQUIRED: the customer must resume hosted
                      verification for this currency, then retry.
                      PROVIDER_UNAVAILABLE (502): the provider did not answer;
                      retry. PROVIDER_REJECTED (502): the provider refused the
                      request; `providerError` says what, and retrying it
                      unchanged fails again. PROVIDER_FORBIDDEN (403): the
                      provider will not serve this customer. READ_ONLY_SESSION
                      (403): the customer bearer came from a `resumeOnly`
                      session, which can only read; mint a session without
                      `resumeOnly` to make changes
                  providerError:
                    $ref: '#/components/schemas/ProviderError'
                required:
                  - error
        '403':
          description: >-
            The bearer no longer matches its customer, an API key was sent
            (payout rails are per customer), READ_ONLY_SESSION: the bearer came
            from a `resumeOnly` session, or PROVIDER_FORBIDDEN: the provider
            refuses this customer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OfframpError'
        '404':
          description: Payouts are not enabled for this project
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OfframpError'
        '409':
          description: >-
            VERIFICATION_REQUIRED; UNKNOWN_METHOD: list the methods again;
            SOURCE_NOT_SUPPORTED; NO_ROUTE: nothing converts this source into
            the provider’s token for this amount; or TOO_MANY_OPEN_WITHDRAWALS
            from this address near this amount
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OfframpError'
        '500':
          description: >-
            Internal failure serving the request; or FUNDING_NOT_CONFIGURED: the
            order (`orderId`) holds its amount but serves no payment. Send
            nothing for it; open another to retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OfframpError'
        '502':
          description: >-
            PROVIDER_UNAVAILABLE: the provider did not answer;
            PROVIDER_REJECTED: it refused the request (`providerError`); or
            OUTCOME_UNKNOWN: it never confirmed the payout, so the order
            (`orderId`) keeps its amount and serves no payment. Send nothing for
            it; open another order to retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OfframpError'
        '503':
          description: >-
            Offramp is unavailable: no payout provider is configured,
            QUOTE_UNAVAILABLE (the amount to send could not be quoted), the
            customer’s withdrawal account could not be set up (`Retry-After`),
            or the customer or the project’s fee configuration could not be
            read; retry
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OfframpError'
      security:
        - complianceSessionBearer: []
components:
  schemas:
    CreateOfframpOrder:
      type: object
      properties:
        methodId:
          type: string
          format: uuid
          description: From GET /offramp/options
        beneficiary:
          $ref: '#/components/schemas/Beneficiary'
        amount:
          type: string
          pattern: ^\d+$
          description: >-
            In base units of the token the provider takes: what the payout is
            priced on and the provider receives, exactly. From `source.token`
            itself, the ERC-20 transfer’s value; from any other source,
            `order.payment.amount` is quoted from it
          example: '100000000'
        source:
          type: object
          properties:
            address:
              type: string
              pattern: ^0x[a-fA-F0-9]{40}$
              description: 'Sends the transfer: an EOA, or the smart account executing it'
              example: '0x742d35Cc6634C0532925a3b844Bc9e7595f5bE91'
            chain:
              type: string
              pattern: ^[a-z0-9]+:[a-zA-Z0-9]+$
              description: CAIP-2 chain identifier (e.g. "eip155:8453")
              example: eip155:8453
            token:
              type: string
              pattern: ^0x[a-fA-F0-9]{40}$
              description: Ethereum address (0x followed by 40 hex characters)
              example: '0x742d35Cc6634C0532925a3b844Bc9e7595f5bE91'
          required:
            - address
            - chain
            - token
          additionalProperties: false
          description: Where the crypto comes from
      required:
        - methodId
        - beneficiary
        - amount
        - source
      additionalProperties: false
    OfframpOrderCreated:
      type: object
      properties:
        order:
          $ref: '#/components/schemas/OfframpOrder'
        estimate:
          type: object
          properties:
            fiatAmount:
              type:
                - string
                - 'null'
              description: What the bank receives, after every fee
            currency:
              type: string
            totalFee:
              type:
                - string
                - 'null'
            rate:
              type:
                - string
                - 'null'
          required:
            - fiatAmount
            - currency
            - totalFee
            - rate
          additionalProperties: false
          description: Priced on the requested amount
      required:
        - order
        - estimate
      additionalProperties: false
    OfframpError:
      type: object
      properties:
        error:
          type: string
        code:
          type: string
          enum:
            - VERIFICATION_REQUIRED
            - PROVIDER_UNAVAILABLE
            - PROVIDER_REJECTED
            - PROVIDER_FORBIDDEN
            - READ_ONLY_SESSION
            - UNKNOWN_METHOD
            - AMOUNT_TOO_SMALL
            - INVALID_BENEFICIARY
            - SOURCE_NOT_SUPPORTED
            - NO_ROUTE
            - QUOTE_UNAVAILABLE
            - TOO_MANY_OPEN_WITHDRAWALS
            - OUTCOME_UNKNOWN
            - FUNDING_NOT_CONFIGURED
        providerError:
          $ref: '#/components/schemas/ProviderError'
        orderId:
          type: string
          format: uuid
          description: >-
            Set once the order exists, whatever failed after: read it at GET
            /offramp/orders/{id}
        fields:
          type: array
          items:
            type: string
          description: 'INVALID_BENEFICIARY: our beneficiary paths, e.g. `account.iban`'
        estimate:
          type: object
          properties:
            totalFee:
              type:
                - string
                - 'null'
            currency:
              type: string
          required:
            - totalFee
            - currency
          description: 'AMOUNT_TOO_SMALL: the fees that exceed the amount'
      required:
        - error
    ProviderError:
      type: object
      properties:
        provider:
          type: string
        status:
          type:
            - integer
            - 'null'
          description: >-
            The provider’s HTTP status; null when it answered outside its
            contract
        type:
          type:
            - string
            - 'null'
          description: The provider’s error category, e.g. `InvalidMessage`
        fields:
          type: array
          items:
            type: object
            properties:
              path:
                type:
                  - string
                  - 'null'
                description: >-
                  The provider’s request path, e.g.
                  `Form.BankDetails.AccountNumber`; null when it names no field
                  we send
              reason:
                type:
                  - string
                  - 'null'
                description: >-
                  e.g. `SchemaValidation`, `NotSupported`; null when
                  unrecognised
            required:
              - path
              - reason
            additionalProperties: false
          description: Request fields the provider refused
        reference:
          type:
            - string
            - 'null'
          description: 'The provider’s id for this failure: quote it to its support'
      required:
        - provider
        - status
        - type
        - fields
        - reference
      additionalProperties: false
      description: 'PROVIDER_REJECTED and PROVIDER_FORBIDDEN: what the provider refused'
    Beneficiary:
      type: object
      properties:
        holder:
          oneOf:
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - individual
                firstName:
                  type: string
                  minLength: 1
                  maxLength: 100
                lastName:
                  type: string
                  minLength: 1
                  maxLength: 100
              required:
                - type
                - firstName
                - lastName
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - business
                name:
                  type: string
                  minLength: 1
                  maxLength: 200
              required:
                - type
                - name
              additionalProperties: false
        address:
          type: object
          properties:
            line1:
              type: string
              minLength: 1
              maxLength: 200
            city:
              type: string
              minLength: 1
              maxLength: 100
            state:
              type: string
              minLength: 1
              maxLength: 100
            postalCode:
              type: string
              minLength: 1
              maxLength: 20
            country:
              type: string
              pattern: ^[A-Z]{2}$
          required:
            - line1
            - city
            - state
            - postalCode
            - country
          additionalProperties: false
          description: Required by US and SWIFT accounts
        account:
          oneOf:
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - us
                routingNumber:
                  type: string
                  pattern: ^\d{9}$
                accountNumber:
                  type: string
                  minLength: 1
                  maxLength: 34
                accountType:
                  type: string
                  enum:
                    - checking
                    - savings
              required:
                - type
                - routingNumber
                - accountNumber
                - accountType
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - iban
                iban:
                  type: string
                  minLength: 1
                  maxLength: 34
              required:
                - type
                - iban
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - swift
                swiftCode:
                  type: string
                  pattern: ^[A-Z0-9]{8}([A-Z0-9]{3})?$
                accountNumber:
                  type: string
                  minLength: 1
                  maxLength: 34
                accountType:
                  type: string
                  enum:
                    - checking
                    - savings
              required:
                - type
                - swiftCode
                - accountNumber
                - accountType
              additionalProperties: false
        reference:
          type: string
          minLength: 1
          maxLength: 140
          description: Shown on the bank statement; defaults to "Withdrawal"
      required:
        - holder
        - account
      additionalProperties: false
      description: >-
        The bank account to pay. Passed to the provider only: never stored or
        logged.
    OfframpOrder:
      type: object
      properties:
        id:
          type: string
          format: uuid
        provider:
          type: string
          enum:
            - noah
            - swapped
        status:
          type: string
          enum:
            - pending
            - processing
            - completed
            - failed
            - refunded
        terminal:
          type: boolean
          description: No stage will change again
        stages:
          type: object
          properties:
            receipt:
              $ref: '#/components/schemas/OnrampReceiptStage'
            conversion:
              $ref: '#/components/schemas/OnrampConversionStage'
            delivery:
              $ref: '#/components/schemas/OfframpPayoutStage'
            return:
              $ref: '#/components/schemas/OnrampReturnStage'
          required:
            - receipt
            - conversion
            - delivery
            - return
          additionalProperties: false
        rail:
          oneOf:
            - type: object
              properties:
                kind:
                  type: string
                  enum:
                    - fiat
                method:
                  type: string
              required:
                - kind
                - method
              additionalProperties: false
            - type: object
              properties:
                kind:
                  type: string
                  enum:
                    - exchange
                connection:
                  type: string
              required:
                - kind
                - connection
              additionalProperties: false
          description: '`provider_selected` / `unknown` when the provider did not say'
        fiat:
          type: object
          properties:
            charged:
              type:
                - object
                - 'null'
              properties:
                total:
                  type:
                    - string
                    - 'null'
                  description: The sale, fees included; null when not stated
                net:
                  type:
                    - string
                    - 'null'
                  description: What the bank receives, after fees
                currency:
                  type: string
              required:
                - total
                - net
                - currency
              additionalProperties: false
              description: The payout, in the currency the bank receives
            eur:
              type:
                - object
                - 'null'
              properties:
                total:
                  type:
                    - string
                    - 'null'
                  description: The sale, fees included; null when not stated
                net:
                  type:
                    - string
                    - 'null'
                  description: What the bank receives, after fees
              required:
                - total
                - net
              additionalProperties: false
            usd:
              type:
                - object
                - 'null'
              properties:
                total:
                  type:
                    - string
                    - 'null'
                  description: The sale, fees included; null when not stated
                net:
                  type:
                    - string
                    - 'null'
                  description: What the bank receives, after fees
              required:
                - total
                - net
              additionalProperties: false
          required:
            - charged
            - eur
            - usd
          additionalProperties: false
          description: >-
            What the bank receives, after fees; null until the provider states
            it
        crypto:
          type:
            - object
            - 'null'
          properties:
            asset:
              type: string
            network:
              type: string
            amount:
              type: string
          required:
            - asset
            - network
            - amount
          additionalProperties: false
        providerStatus:
          type: string
          description: >-
            The provider’s own status of its latest leg, else ours (`reserved`,
            `opened`, `refused`, `unknown`, `expired`); informational
        createdAt:
          type: string
          format: date-time
          description: When the provider says the order began
        updatedAt:
          type: string
          format: date-time
        sender:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
          description: >-
            The address the provider takes the crypto from: `source.address`, or
            the withdrawal account it pays into
          example: '0x742d35Cc6634C0532925a3b844Bc9e7595f5bE91'
        payment:
          anyOf:
            - $ref: '#/components/schemas/OfframpPayment'
            - type: 'null'
          description: >-
            Null until the provider’s rule exists: while it is being created, or
            when the rule was refused or its outcome is unknown; through a
            withdrawal account, also until its funding is configured. A `direct`
            payment is still served after `expiresAt`, until the order expires
            30 minutes later and reads `failed` (`expired`), not terminal: the
            provider may still match a late transfer. A `withdrawal_account`
            payment is null again once a transfer can no longer fund the order:
            one already did, the order moved past `pending`, or 30 minutes
            passed after `expiresAt`.
        expiresAt:
          type: string
          format: date-time
          description: Send the payment before this
      required:
        - id
        - provider
        - status
        - terminal
        - stages
        - rail
        - fiat
        - crypto
        - providerStatus
        - createdAt
        - updatedAt
        - sender
        - payment
        - expiresAt
      additionalProperties: false
    OnrampReceiptStage:
      oneOf:
        - type: object
          properties:
            status:
              type: string
              enum:
                - not_started
          required:
            - status
          additionalProperties: false
        - type: object
          properties:
            status:
              type: string
              enum:
                - pending
          required:
            - status
          additionalProperties: false
        - type: object
          properties:
            status:
              type: string
              enum:
                - on_hold
            reason:
              type: string
              enum:
                - kyc_required
                - rfi_open
                - review
          required:
            - status
            - reason
          additionalProperties: false
        - type: object
          properties:
            status:
              type: string
              enum:
                - processing
          required:
            - status
          additionalProperties: false
        - type: object
          properties:
            status:
              type: string
              enum:
                - completed
          required:
            - status
          additionalProperties: false
        - type: object
          properties:
            status:
              type: string
              enum:
                - failed
            reason:
              type: string
              enum:
                - cancelled
                - declined
                - expired
                - provider_error
          required:
            - status
            - reason
          additionalProperties: false
    OnrampConversionStage:
      oneOf:
        - type: object
          properties:
            status:
              type: string
              enum:
                - not_started
          required:
            - status
          additionalProperties: false
        - type: object
          properties:
            status:
              type: string
              enum:
                - processing
          required:
            - status
          additionalProperties: false
        - type: object
          properties:
            status:
              type: string
              enum:
                - on_hold
            reason:
              type: string
              enum:
                - rfi_open
                - review
          required:
            - status
            - reason
          additionalProperties: false
        - type: object
          properties:
            status:
              type: string
              enum:
                - completed
          required:
            - status
          additionalProperties: false
        - type: object
          properties:
            status:
              type: string
              enum:
                - failed
            reason:
              type: string
              enum:
                - sub_fee
                - provider_error
          required:
            - status
            - reason
          additionalProperties: false
    OfframpPayoutStage:
      oneOf:
        - type: object
          properties:
            status:
              type: string
              enum:
                - not_started
          required:
            - status
          additionalProperties: false
        - type: object
          properties:
            status:
              type: string
              enum:
                - pending
          required:
            - status
          additionalProperties: false
        - type: object
          properties:
            status:
              type: string
              enum:
                - on_hold
            reason:
              type: string
              enum:
                - rfi_open
                - review
          required:
            - status
            - reason
          additionalProperties: false
        - type: object
          properties:
            status:
              type: string
              enum:
                - processing
          required:
            - status
          additionalProperties: false
        - type: object
          properties:
            status:
              type: string
              enum:
                - submitted
          required:
            - status
          additionalProperties: false
          description: The provider sent the payment to the bank
        - type: object
          properties:
            status:
              type: string
              enum:
                - completed
          required:
            - status
          additionalProperties: false
          description: The bank accepted the payment
        - type: object
          properties:
            status:
              type: string
              enum:
                - failed
            reason:
              type: string
              enum:
                - sub_fee
                - provider_error
              description: '`sub_fee`: the fees took the whole amount'
          required:
            - status
            - reason
          additionalProperties: false
      description: The fiat payout to the bank
    OnrampReturnStage:
      oneOf:
        - type: object
          properties:
            status:
              type: string
              enum:
                - none
          required:
            - status
          additionalProperties: false
        - type: object
          properties:
            status:
              type: string
              enum:
                - pending
          required:
            - status
          additionalProperties: false
        - type: object
          properties:
            status:
              type: string
              enum:
                - processing
          required:
            - status
          additionalProperties: false
        - type: object
          properties:
            status:
              type: string
              enum:
                - completed
            outcome:
              type: string
              enum:
                - full_refund
                - adjustment
                - unresolved
          required:
            - status
            - outcome
          additionalProperties: false
        - type: object
          properties:
            status:
              type: string
              enum:
                - failed
          required:
            - status
          additionalProperties: false
    OfframpPayment:
      oneOf:
        - $ref: '#/components/schemas/OfframpDirectPayment'
        - $ref: '#/components/schemas/OfframpWithdrawalAccountPayment'
      discriminator:
        propertyName: kind
        mapping:
          direct: '#/components/schemas/OfframpDirectPayment'
          withdrawal_account: '#/components/schemas/OfframpWithdrawalAccountPayment'
      description: >-
        How to pay the order, by `kind`: `direct` from a source on the
        provider’s chain and token, `withdrawal_account` from any other
    OfframpDirectPayment:
      type: object
      properties:
        kind:
          type: string
          enum:
            - direct
        from:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
          description: 'The sender: an EOA, or the smart account executing the transfer'
          example: '0x742d35Cc6634C0532925a3b844Bc9e7595f5bE91'
        to:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
          description: Ethereum address (0x followed by 40 hex characters)
          example: '0x742d35Cc6634C0532925a3b844Bc9e7595f5bE91'
        chain:
          type: string
          description: CAIP-2
        token:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
          description: Ethereum address (0x followed by 40 hex characters)
          example: '0x742d35Cc6634C0532925a3b844Bc9e7595f5bE91'
        amount:
          type: string
          pattern: ^\d+$
          description: 'Exact, in base units of `token`: the value of the ERC-20 transfer'
          example: '100000000'
      required:
        - kind
        - from
        - to
        - chain
        - token
        - amount
      additionalProperties: false
      description: >-
        Send exactly `amount` of `token` on `chain` from `from` to `to`, as a
        direct ERC-20 transfer whose sender is `from` (an EOA, or the smart
        account executing it). A different amount or sender is not matched and
        stays with the provider until recovery.
    OfframpWithdrawalAccountPayment:
      type: object
      properties:
        kind:
          type: string
          enum:
            - withdrawal_account
        from:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
          description: >-
            `source.address`: an EOA, or the smart account executing the
            transfer
          example: '0x742d35Cc6634C0532925a3b844Bc9e7595f5bE91'
        to:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
          description: The customer’s withdrawal account
          example: '0x742d35Cc6634C0532925a3b844Bc9e7595f5bE91'
        chain:
          type: string
          description: 'CAIP-2: `source.chain`'
        token:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
          description: '`source.token`'
          example: '0x742d35Cc6634C0532925a3b844Bc9e7595f5bE91'
        amount:
          type: string
          pattern: ^\d+$
          description: >-
            Exact, in base units of `token`: the value of the transfer. Quoted
            to deliver the order’s amount of the provider’s token on the
            cheapest route, plus a margin for the fees the customer pays (or,
            for another asset, 1% for its price); may be a few base units higher
            when another open withdrawal from this source holds it
          example: '100000000'
      required:
        - kind
        - from
        - to
        - chain
        - token
        - amount
      additionalProperties: false
      description: >-
        Send exactly `amount` of `token` on `chain` from `from` to `to`, the
        customer’s withdrawal account, after the order opens and before
        `expiresAt`; we pay the provider from it, and what the payment does not
        spend stays there for an operator. A different amount or sender, or a
        transfer mined more than 30 minutes after `expiresAt`, is not matched:
        it stays on the account until an operator refunds it.
  securitySchemes:
    complianceSessionBearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Required 15-minute customer-scoped browser session from POST
        /compliance/sessions. Application keys are not accepted.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.