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

# Create Trade

> Creates a user's trade transaction; supports both Jito and non-Jito routing based on parameters.



## OpenAPI

````yaml POST /trade/create
openapi: 3.0.1
info:
  title: Vanish Core API
  description: API endpoints for the Vanish Core service.
  license:
    name: MIT
  version: 2.0.0
servers:
  - url: https://core-api-dev.vanish.trade
security:
  - ApiKeyAuth: []
paths:
  /trade/create:
    post:
      description: >-
        Creates a user's trade transaction; supports both Jito and non-Jito
        routing based on parameters.
      requestBody:
        description: Details of the trade request.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTradeRequest'
        required: true
      responses:
        '200':
          description: Successful trade transaction data response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateTradeResponse'
        '401':
          description: >-
            Unauthorized. The request is missing a valid API key or the
            signature is invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/responses/UnauthorizedError'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    CreateTradeRequest:
      required:
        - user_address
        - source_token_address
        - target_token_address
        - amount
        - swap_transaction
        - loan_wallet_address
        - loan_additional_sol
        - timestamp
        - user_signature
        - split_repay
        - jito_tip_amount
        - one_time_wallet
      type: object
      properties:
        user_address:
          description: The wallet address of the user making the trade.
          type: string
        source_token_address:
          description: The address of the token being traded (source token).
          type: string
        target_token_address:
          description: The address of the token the user wants to receive (target token).
          type: string
        amount:
          description: >-
            The amount of the source token to be traded, expressed in the
            smallest unit (e.g., lamports for SOL). Can be provided as a string
            or a number
          oneOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              format: int64
        jito_tip_amount:
          description: >-
            The amount of Jito tip, expressed in the smallest unit (e.g.,
            lamports for SOL). Can be provided as a string or a number
          oneOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              format: int64
        swap_transaction:
          description: >-
            Serialized or encoded swap transaction data. The transaction must be
            provided unsigned.
          type: string
        loan_additional_sol:
          description: >-
            Additional SOL (in lamports) required to support the loan/trade
            operation, typically used for ATA creation and account
            initialization. Recommended value: 12000000 lamports (actual
            requirement may be lower depending on existing accounts), with any
            unused amount refunded. Can be provided as a string or a number
          oneOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              format: int64
        timestamp:
          description: >-
            Unix timestamp of when the trade was initiated (in milliseconds).
            Can be provided as a string or a number
          oneOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              format: int64
        user_signature:
          description: >-
            A digital signature of 'By signing, I hereby agree to Vanish's Terms
            of Service and agree to be bound by them
            (docs.vanish.trade/legal/TOS)


            Details:
            trade:{source_token_address}:{target_token_address}:{amount}:{loan_additional_sol}:{timestamp}:{jito_tip_amount}',
            signed by the user's wallet.
          type: string
        split_repay:
          description: >-
            Number of trading accounts used to distribute the purchased tokens.
            Lower values: reduce transaction size, increase likelihood of
            single-transaction routing, improve compatibility with
            prefer_non_jito.


            Example: If amount_out is <0.5% of token supply, split_repay = 1 is
            typically sufficient.
          type: integer
          format: uint8
          maximum: 10
        prefer_non_jito:
          $ref: '#/components/schemas/PreferNonJito'
          description: >-
            When provided, prioritizes single-transaction (non-Jito) routing
            where possible. Uses the supplied priority fee fields to increase
            inclusion probability.


            Works best with lower split_repay values, since smaller transactions
            are more likely to fit in a single transaction without requiring
            Jito bundling.
        one_time_wallet:
          description: >-
            The wallet address for the swap transaction, returned by the
            /trade/one-time-wallet endpoint.
          type: string
    CreateTradeResponse:
      required:
        - tx_id
      type: object
      properties:
        tx_id:
          description: Transaction ID of the (possibly bundled) trade.
          type: string
        jito_bundle_id:
          description: If routed via Jito bundle, its bundle ID; otherwise null.
          type: string
          nullable: true
        transaction:
          description: >-
            Serialized single‐tx trade body for non‐Jito route; null if Jito
            bundle used.
          type: string
          nullable: true
    Error:
      type: string
    PreferNonJito:
      type: object
      properties:
        compute_unit_price:
          oneOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              format: int64
          description: Optional fee per compute unit to set priority fee.
        compute_unit_limit:
          oneOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              format: int32
          description: Optional compute unit limit.
        custom_tip_address:
          type: string
          description: Optional Pubkey to receive the custom tip.
        custom_tip_amount:
          oneOf:
            - type: string
              pattern: ^[0-9]+$
            - type: integer
              format: int64
          description: Optional tip amount (in lamports) to send to the custom_tip_address.
  responses:
    UnauthorizedError:
      description: API key is missing or invalid
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````