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

# Generate funding presign data

> Returns the Permit2 EIP-712 payload that the trader must sign for funding operations. `fundingMode` net option is supported for maker funding requests.

When `fundingMode` is `delegate`, the response instead contains two typed-data payloads: one for the trader to sign (a zero-amount authorization) and one for the funder to sign (carrying the actual delivery amount). Delegate mode supports both maker and taker, requires `funderAddress` and `recipientAddress`, and accepts exactly one contract trade ID per request.




## OpenAPI

````yaml openapi/stablefx.yaml post /v1/exchange/stablefx/signatures/funding/presign
openapi: 3.1.0
info:
  title: StableFX API
  description: >
    The StableFX API provides endpoints for trading stablecoins.


    ## Authentication

    All API requests require authentication using an API key.


    ## Base URL

    The base URL for all API endpoints is:
    `https://api.circle.com/v1/exchange/stablefx`
  version: 1.0.0
servers:
  - url: https://api.circle.com
    description: StableFX API server
security:
  - BearerAuth: []
tags:
  - name: Quotes
    description: Endpoints for creating and managing quotes
  - name: Trades
    description: Endpoints for creating and managing trades
  - name: Signatures
    description: Endpoints for retrieving presign typed data and registering signatures
  - name: Fees
    description: Endpoints for retrieving fees
  - name: Funding
    description: Endpoints for funding trades
  - name: Webhook Subscriptions
    description: Manage subscriptions to notifications
  - name: Settlement Advance
    description: Request, track, and repay settlement advances.
paths:
  /v1/exchange/stablefx/signatures/funding/presign:
    post:
      tags:
        - Signatures
      summary: Generate funding presign data
      description: >
        Returns the Permit2 EIP-712 payload that the trader must sign for
        funding operations. `fundingMode` net option is supported for maker
        funding requests.


        When `fundingMode` is `delegate`, the response instead contains two
        typed-data payloads: one for the trader to sign (a zero-amount
        authorization) and one for the funder to sign (carrying the actual
        delivery amount). Delegate mode supports both maker and taker, requires
        `funderAddress` and `recipientAddress`, and accepts exactly one contract
        trade ID per request.
      operationId: generateFundingPresignData
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FundingPresign'
      responses:
        '200':
          description: Funding presign data generated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FundingPresign-2'
      security:
        - BearerAuth: []
components:
  schemas:
    FundingPresign:
      type: object
      description: Request body for generating funding presign data
      required:
        - contractTradeIds
        - type
      properties:
        contractTradeIds:
          type: array
          description: >-
            List of contract trade IDs. Exactly one contract trade ID is
            supported when `fundingMode` is `delegate`.
          example:
            - '10'
            - '11'
            - '12'
          items:
            type: string
          minItems: 1
        type:
          $ref: '#/components/schemas/Type'
        fundingMode:
          allOf:
            - $ref: '#/components/schemas/FundingMode'
          description: >-
            Funding mode for the presign request. `net` is supported for maker
            funding requests only; `delegate` is supported for both maker and
            taker.
        funderAddress:
          type: string
          description: >-
            Address of the funder wallet that will deliver tokens on the
            trader's behalf. Required when `fundingMode` is `delegate`.
          example: '0x1234567890abcdef1234567890abcdef12345678'
        recipientAddress:
          type: string
          description: >-
            Address that receives the delivered tokens. Required when
            `fundingMode` is `delegate`.
          example: '0xabcdef1234567890abcdef1234567890abcdef12'
    FundingPresign-2:
      description: >-
        Response containing Permit2 EIP-712 typed data for funding operations.
        For `gross` and `net` funding modes, contains the trader's Permit2 typed
        data along with deliverables and receivables. For `delegate` funding
        mode, contains separate typed-data payloads for the trader and the
        funder. No discriminator is defined because the response body carries no
        `fundingMode` field; the variant is determined by the `fundingMode` sent
        in the request, and the two variants have mutually exclusive required
        properties.
      oneOf:
        - type: object
          title: TraderFundingPresign
          description: Presign data for `gross` and `net` funding modes.
          required:
            - typedData
            - deliverables
            - receivables
          properties:
            deliverables:
              type: array
              description: Aggregated assets that the trader needs to deliver.
              items:
                $ref: '#/components/schemas/CurrencyAmount'
            receivables:
              type: array
              description: >-
                Aggregated assets that the trader expects to receive after fee
                deduction.
              items:
                $ref: '#/components/schemas/CurrencyAmount'
            typedData:
              oneOf:
                - $ref: '#/components/schemas/SinglePermit2TypedData'
                - $ref: '#/components/schemas/BatchPermit2TypedData'
              discriminator:
                propertyName: primaryType
                mapping:
                  PermitWitnessTransferFrom:
                    $ref: '#/components/schemas/SinglePermit2TypedData'
                  PermitWitnessBatchTransferFrom:
                    $ref: '#/components/schemas/BatchPermit2TypedData'
        - type: object
          title: DelegateFundingPresign
          description: Presign data for `delegate` funding mode.
          required:
            - traderPermitTypedData
            - funderPermitTypedData
          properties:
            traderPermitTypedData:
              allOf:
                - $ref: '#/components/schemas/Permit2TypedData'
              description: >-
                The trader's delegate-funding authorization typed data. The
                trader signs this zero-amount Permit2 payload to authorize the
                funder to deliver on their behalf.
            funderPermitTypedData:
              allOf:
                - $ref: '#/components/schemas/FunderPermit2TypedData'
              description: >-
                The funder's delegate-funding typed data. The funder signs this
                Permit2 payload, which carries the actual delivery amount.
    Type:
      type: string
      description: The type of trader.
      enum:
        - maker
        - taker
    FundingMode:
      type: string
      description: >
        The funding mode for funding requests.

        - `gross`: the trader delivers the full amount for each trade.

        - `net`: the maker delivers the net difference across trades. Supported
        for maker funding requests only.

        - `delegate`: a funder wallet delivers tokens on the trader's behalf.
        The trader signs a zero-amount Permit2 authorization and the funder
        signs the Permit2 transfer carrying the delivery amount.
      enum:
        - gross
        - net
        - delegate
      default: gross
    CurrencyAmount:
      type: object
      description: Currency and amount details for a foreign exchange transaction
      required:
        - currency
      properties:
        currency:
          $ref: '#/components/schemas/Currency'
        amount:
          $ref: '#/components/schemas/Amount'
    SinglePermit2TypedData:
      type: object
      description: EIP-712 typed data structure for single Permit2 transfer
      required:
        - domain
        - types
        - primaryType
        - message
      properties:
        domain:
          $ref: '#/components/schemas/Permit2EIP712Domain'
        types:
          $ref: '#/components/schemas/SinglePermit2EIP712Types'
        primaryType:
          type: string
          description: The primary type for the EIP-712 signature
          example: PermitWitnessTransferFrom
        message:
          $ref: '#/components/schemas/Permit2SingleFundingMessage'
    BatchPermit2TypedData:
      type: object
      description: EIP-712 typed data structure for batch Permit2 transfer
      required:
        - domain
        - types
        - primaryType
        - message
      properties:
        domain:
          $ref: '#/components/schemas/Permit2EIP712Domain'
        types:
          $ref: '#/components/schemas/Permit2EIP712Types'
        primaryType:
          type: string
          description: The primary type for the EIP-712 signature
          example: PermitWitnessBatchTransferFrom
        message:
          $ref: '#/components/schemas/Permit2BatchFundingMessage'
    Permit2TypedData:
      type: object
      description: EIP-712 Permit2 typed-data envelope for trader signing.
      required:
        - types
        - primaryType
        - domain
        - message
      properties:
        types:
          type: object
          additionalProperties:
            type: array
            items:
              $ref: '#/components/schemas/EIP712TypeProperty'
        primaryType:
          type: string
          example: DelegateFundingAuthorizationPermitWitnessTransferFrom
        domain:
          $ref: '#/components/schemas/Permit2EIP712Domain'
        message:
          $ref: '#/components/schemas/DelegateFundingPermit2'
    FunderPermit2TypedData:
      type: object
      description: EIP-712 Permit2 typed-data envelope for funder signing.
      required:
        - types
        - primaryType
        - domain
        - message
      properties:
        types:
          type: object
          additionalProperties:
            type: array
            items:
              $ref: '#/components/schemas/EIP712TypeProperty'
        primaryType:
          type: string
          example: DelegateFundingPermitWitnessTransferFrom
        domain:
          $ref: '#/components/schemas/Permit2EIP712Domain'
        message:
          $ref: '#/components/schemas/DelegateFundingFunderPermit2'
    Currency:
      type: string
      description: Currency code
      enum:
        - USDC
        - EURC
    Amount:
      type: string
      pattern: ^\d+(?:\.\d{1,6})?$
      description: Amount of currency, formatted as a string with up to six decimal places.
      example: '100.00'
    Permit2EIP712Domain:
      type: object
      description: Permit2 EIP-712 domain separator
      required:
        - name
        - chainId
        - verifyingContract
      properties:
        name:
          type: string
          description: The name of the signing domain
          example: Permit2
        chainId:
          type: integer
          description: The chain ID of the network
          example: 11155111
        verifyingContract:
          type: string
          description: The address of the verifying contract
          example: '0xffd21ca8F0876DaFAD7de09404E0c1f868bbf1AE'
    SinglePermit2EIP712Types:
      type: object
      description: EIP-712 type definitions for single Permit2 transfer
      required:
        - EIP712Domain
        - TokenPermissions
        - SingleTradeWitness
        - PermitWitnessTransferFrom
      properties:
        EIP712Domain:
          type: array
          items:
            $ref: '#/components/schemas/EIP712TypeProperty'
          example:
            - name: name
              type: string
            - name: chainId
              type: uint256
            - name: verifyingContract
              type: address
        TokenPermissions:
          type: array
          items:
            $ref: '#/components/schemas/EIP712TypeProperty'
          example:
            - name: token
              type: address
            - name: amount
              type: uint256
        SingleTradeWitness:
          type: array
          items:
            $ref: '#/components/schemas/EIP712TypeProperty'
          example:
            - name: id
              type: uint256
        PermitWitnessTransferFrom:
          type: array
          items:
            $ref: '#/components/schemas/EIP712TypeProperty'
          example:
            - name: permitted
              type: TokenPermissions
            - name: spender
              type: address
            - name: nonce
              type: uint256
            - name: deadline
              type: uint256
            - name: witness
              type: SingleTradeWitness
    Permit2SingleFundingMessage:
      type: object
      description: The message data for Permit2 signature
      required:
        - permitted
        - spender
        - nonce
        - deadline
        - witness
      properties:
        permitted:
          $ref: '#/components/schemas/TokenPermissions'
        spender:
          type: string
          description: The spender contract address
          example: '0xffd21ca8F0876DaFAD7de09404E0c1f868bbf1AE'
        nonce:
          type: string
          description: The nonce for the permit, as a string representation of a uint256
          example: '42'
        deadline:
          type: string
          description: >-
            The deadline timestamp for the permit, as a string representation of
            a uint256
          example: '1735689600'
        witness:
          $ref: '#/components/schemas/SingleTradeWitness'
    Permit2EIP712Types:
      type: object
      description: Permit2 EIP-712 type definitions
      required:
        - EIP712Domain
        - TokenPermissions
        - BatchTradeWitness
        - PermitWitnessBatchTransferFrom
      properties:
        EIP712Domain:
          type: array
          items:
            $ref: '#/components/schemas/EIP712TypeProperty'
          example:
            - name: name
              type: string
            - name: chainId
              type: uint256
            - name: verifyingContract
              type: address
        TokenPermissions:
          type: array
          items:
            $ref: '#/components/schemas/EIP712TypeProperty'
          example:
            - name: token
              type: address
            - name: amount
              type: uint256
        BatchTradeWitness:
          type: array
          items:
            $ref: '#/components/schemas/EIP712TypeProperty'
          example:
            - name: ids
              type: uint256[]
        PermitWitnessBatchTransferFrom:
          type: array
          items:
            $ref: '#/components/schemas/EIP712TypeProperty'
          example:
            - name: permitted
              type: TokenPermissions[]
            - name: spender
              type: address
            - name: nonce
              type: uint256
            - name: deadline
              type: uint256
            - name: witness
              type: BatchTradeWitness
    Permit2BatchFundingMessage:
      type: object
      description: The message data for Permit2 batch signature
      required:
        - permitted
        - spender
        - nonce
        - deadline
        - witness
      properties:
        permitted:
          type: array
          description: Array of token permissions
          items:
            $ref: '#/components/schemas/TokenPermissions'
          example:
            - token: 0xTOKEN1
              amount: '1000'
            - token: 0xTOKEN2
              amount: '2000'
        spender:
          type: string
          description: The spender contract address
          example: '0xffd21ca8F0876DaFAD7de09404E0c1f868bbf1AE'
        nonce:
          type: string
          description: The nonce for the permit, as a string representation of a uint256
          example: '42'
        deadline:
          type: string
          description: >-
            The deadline timestamp for the permit, as a string representation of
            a uint256
          example: '1735689600'
        witness:
          $ref: '#/components/schemas/BatchTradeWitness'
    EIP712TypeProperty:
      type: object
      description: A single property definition in EIP-712 types
      required:
        - name
        - type
      properties:
        name:
          type: string
          description: The name of the property
        type:
          type: string
          description: The type of the property
    DelegateFundingPermit2:
      type: object
      description: >-
        Permit2 PermitWitnessTransferFrom payload with
        DelegateFundingAuthorization witness. The `permitted.amount` is always 0
        -- Permit2 is used as an authorization carrier, no tokens transfer from
        the trader.
      required:
        - permitted
        - spender
        - nonce
        - deadline
        - witness
      properties:
        permitted:
          $ref: '#/components/schemas/TokenPermissions'
        spender:
          type: string
          description: FxEscrow contract address.
          example: 0xFxEscrow000000000000000000000000000000000
        nonce:
          type: string
          description: Permit2 nonce, as a string representation of a uint256.
          example: '1234567890'
        deadline:
          type: string
          description: >-
            Permit2 deadline (unix timestamp), as a string representation of a
            uint256.
          example: '1782556800'
        witness:
          $ref: '#/components/schemas/DelegateFundingAuthorization'
    DelegateFundingFunderPermit2:
      type: object
      description: >-
        Permit2 PermitWitnessTransferFrom payload signed by the funder when
        delivering tokens on a trader's behalf. Unlike the trader's
        authorization payload, this permit carries the actual delivery amount in
        `permitted.amount`. The DelegateFundingWitness binds the funder's
        signature to a specific trade and recipient, and must agree with the
        trader's DelegateFundingAuthorization.
      required:
        - permitted
        - spender
        - nonce
        - deadline
        - witness
      properties:
        permitted:
          $ref: '#/components/schemas/TokenPermissions'
        spender:
          type: string
          description: FxEscrow contract address.
          example: 0xFxEscrow000000000000000000000000000000000
        nonce:
          type: string
          description: Permit2 nonce, as a string representation of a uint256.
          example: '1234567890'
        deadline:
          type: string
          description: >-
            Permit2 deadline (unix timestamp), as a string representation of a
            uint256.
          example: '1782556800'
        witness:
          $ref: '#/components/schemas/DelegateFundingWitness'
    TokenPermissions:
      type: object
      description: Token permissions for Permit2
      required:
        - token
        - amount
      properties:
        token:
          type: string
          description: The token contract address
          example: 0xTOKEN
        amount:
          type: string
          description: >-
            The amount of tokens permitted, as a string representation of a
            uint256.
          example: '1000'
    SingleTradeWitness:
      type: object
      description: Single trade witness data
      required:
        - id
      properties:
        id:
          type: string
          description: The trade ID
          example: '10'
    BatchTradeWitness:
      type: object
      description: Batch trade witness data with multiple IDs
      required:
        - ids
      properties:
        ids:
          type: array
          description: Array of trade IDs
          items:
            type: string
          example:
            - '10'
            - '11'
            - '12'
    DelegateFundingAuthorization:
      type: object
      description: >-
        DelegateFundingAuthorization witness binding the Permit2 authorization
        to a specific trade, funder, recipient, token, and amount.
      required:
        - id
        - funder
        - recipient
        - token
        - amount
      properties:
        id:
          type: string
          description: On-chain trade id (uint256).
          example: '987654321'
        funder:
          type: string
          description: >-
            Address of the funder wallet (Circle-controlled) authorized to
            deliver tokens on the trader's behalf.
          example: 0xLLCFunderPW...address
        recipient:
          type: string
          description: Address that receives the delivered tokens.
          example: 0xLLCEscrowPW...address
        token:
          type: string
          description: ERC-20 contract address of the token to be delivered.
          example: 0xMXNB...address
        amount:
          type: string
          description: >-
            Amount to be delivered by the funder, in token units (uint256, no
            decimals). Tokens use 6 decimal places, so 5000.00 MXNB is
            represented as "5000000000".
          example: '5000000000'
    DelegateFundingWitness:
      type: object
      description: >-
        DelegateFundingWitness signed by the funder when delivering tokens on a
        trader's behalf. Both the trader (via DelegateFundingAuthorization) and
        the funder independently commit to the same recipient, and the contract
        verifies agreement on-chain. The funder address is not part of the
        witness because Permit2 verifies the signer identity via the `owner`
        parameter.
      required:
        - id
        - recipient
      properties:
        id:
          type: string
          description: On-chain trade id (uint256).
          example: '987654321'
        recipient:
          type: string
          description: >-
            Address that receives the delivered tokens. Must match the recipient
            in the trader's DelegateFundingAuthorization.
          example: '0xabcdef1234567890abcdef1234567890abcdef12'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: PREFIX:ID:SECRET
      description: >-
        Circle's API Keys are formatted in the following structure
        "PREFIX:ID:SECRET". All three parts are requred to make a successful
        request.

````