> ## 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.

# Prepare a gasless permit deposit

> Experimental. Builds the EIP-712 token-authorization payload the owner signs to authorize their deposit smart account to pull `amount` of `token` from their wallet — no on-chain transfer needed. Selects ERC-3009, ERC-2612, then Permit2; validates the route, session coverage, domain, balance, and allowance before the user is asked to sign. The server chooses replay and deadline fields; submit the signature with the same fields via POST /deposits/permit. EVM source chains only; cross-chain routes only (v1).



## OpenAPI

````yaml https://raw.githubusercontent.com/rhinestonewtf/openapi/refs/heads/main/deposit-service.json post /deposits/permit/prepare
openapi: 3.1.0
info:
  title: Deposit Service API
  version: 1.0.0
  description: >-
    Cross-chain deposit processing service with automatic token bridging and gas
    sponsorship
servers:
  - url: https://v1.orchestrator.rhinestone.dev/deposit-processor
security: []
paths:
  /deposits/permit/prepare:
    post:
      tags:
        - Processing
      summary: Prepare a gasless permit deposit
      description: >-
        Experimental. Builds the EIP-712 token-authorization payload the owner
        signs to authorize their deposit smart account to pull `amount` of
        `token` from their wallet — no on-chain transfer needed. Selects
        ERC-3009, ERC-2612, then Permit2; validates the route, session coverage,
        domain, balance, and allowance before the user is asked to sign. The
        server chooses replay and deadline fields; submit the signature with the
        same fields via POST /deposits/permit. EVM source chains only;
        cross-chain routes only (v1).
      parameters:
        - schema:
            type: string
            description: API key for authentication (omit when sending Authorization)
            example: your-api-key
          required: false
          description: API key for authentication (omit when sending Authorization)
          name: x-api-key
          in: header
        - schema:
            type: string
            description: >-
              Bearer platform token (e.g. forwarded by user-service). Takes
              precedence over `x-api-key` when both are present.
            example: Bearer eyJhbGciOi...
          required: false
          description: >-
            Bearer platform token (e.g. forwarded by user-service). Takes
            precedence over `x-api-key` when both are present.
          name: authorization
          in: header
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PermitDepositPrepareRequest'
      responses:
        '200':
          description: Typed data to sign, with the server-chosen nonce and deadline
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PermitDepositPrepareResponse'
        '400':
          description: >-
            Malformed request, unsupported source chain, same-chain route, or
            owner funding insufficient (code PERMIT-4)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing/invalid API key or expired platform bearer token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: >-
            API key lacks the deposits write scope, or permit deposits are
            disabled
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Account not found or not owned by the caller
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: >-
            Route cannot settle (whitelist violation, unsupported token route,
            or no session for the source chain)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    PermitDepositPrepareRequest:
      type: object
      properties:
        account:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
          description: Ethereum address (0x followed by 40 hex characters)
          example: '0x742d35Cc6634C0532925a3b844Bc9e7595f5bE91'
        sourceChain:
          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'
        amount:
          type: string
          pattern: ^\d+$
          description: Numeric string representing a bigint value
          example: '1000000000000000000'
        owner:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
          description: Ethereum address (0x followed by 40 hex characters)
          example: '0x742d35Cc6634C0532925a3b844Bc9e7595f5bE91'
        kind:
          type: string
          enum:
            - auto
            - erc3009
            - erc2612
            - permit2
          description: >-
            Authorization scheme preference. Auto selects ERC-3009, then
            ERC-2612, then Permit2.
          example: auto
      required:
        - account
        - sourceChain
        - token
        - amount
        - owner
    PermitDepositPrepareResponse:
      oneOf:
        - type: object
          properties:
            available:
              type: boolean
              enum:
                - true
            authorization:
              anyOf:
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - erc3009
                    typedData:
                      $ref: '#/components/schemas/PermitTypedData'
                    nonce:
                      type: string
                      pattern: ^0x[a-fA-F0-9]{64}$
                      description: ERC-3009 bytes32 authorization nonce
                      example: >-
                        0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
                    validAfter:
                      type: string
                      pattern: ^\d+$
                      description: Numeric string representing a bigint value
                      example: '1000000000000000000'
                    validBefore:
                      type: string
                      pattern: ^\d+$
                      description: Numeric string representing a bigint value
                      example: '1000000000000000000'
                  required:
                    - kind
                    - typedData
                    - nonce
                    - validAfter
                    - validBefore
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - erc2612
                        - permit2
                    typedData:
                      $ref: '#/components/schemas/PermitTypedData'
                    nonce:
                      type: string
                      pattern: ^\d+$
                      description: Numeric string representing a bigint value
                      example: '1000000000000000000'
                    deadline:
                      type: string
                      pattern: ^\d+$
                      description: Numeric string representing a bigint value
                      example: '1000000000000000000'
                  required:
                    - kind
                    - typedData
                    - nonce
                    - deadline
          required:
            - available
            - authorization
        - type: object
          properties:
            available:
              type: boolean
              enum:
                - false
            reason:
              type: string
              enum:
                - permit2-approval-required
                - unsupported-token
                - unsupported-owner
            approval:
              type: object
              properties:
                token:
                  type: string
                  pattern: ^0x[a-fA-F0-9]{40}$
                  description: Ethereum address (0x followed by 40 hex characters)
                  example: '0x742d35Cc6634C0532925a3b844Bc9e7595f5bE91'
                spender:
                  type: string
                  pattern: ^0x[a-fA-F0-9]{40}$
                  description: Ethereum address (0x followed by 40 hex characters)
                  example: '0x742d35Cc6634C0532925a3b844Bc9e7595f5bE91'
                minimumAmount:
                  type: string
                  pattern: ^\d+$
                  description: Numeric string representing a bigint value
                  example: '1000000000000000000'
              required:
                - token
                - spender
                - minimumAmount
          required:
            - available
            - reason
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
        details:
          type: array
          items:
            type: object
            properties:
              message:
                type: string
              path:
                type: array
                items:
                  anyOf:
                    - type: string
                    - type: number
              code:
                type: string
            required:
              - message
      required:
        - error
    PermitTypedData:
      type: object
      properties:
        domain: {}
        types: {}
        primaryType:
          type: string
        message: {}
      required:
        - primaryType

````