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

# Get token price quote

> 
    Get a price quote for buying or selling tokens. Automatically uses the appropriate protocol:
    - **Token Layer BondingCurve** for non-graduated tokens
    - **UniswapV3** for graduated tokens

    Supports flexible quoting:
    - Specify amount in tokens or USDC
    - Buy or sell direction
    - Handles new token initial fee ($5 minimum)

    **Fee Structure:**
    - Quotes automatically include anti-sniping fees for the first 6 seconds (equivalent in blocks)
    - Anti-sniping fees start at 80% and decrease linearly to 1% over the first 6 seconds worth of blocks
    - This applies to initial purchases and all early trading activity
    - All returned quotes reflect the true cost including applicable fees

    Returns input/output amounts, protocol used, and graduation status.
  



## OpenAPI

````yaml post /token-price
openapi: 3.0.3
info:
  title: Token Layer API
  version: 1.0.0
  description: |2-

          Token Layer is an omnichain token trading platform where users can create and trade tokens across multiple chains.

          This API provides comprehensive access to token operations, trading, earnings,
          blockchain transactions, and portfolio management.

          ## Base URL
          All endpoints are accessed via: `https://api.tokenlayer.network/{endpoint}`

          ## Authentication
          Most endpoints require authentication using an JWT token or API key passed as a Bearer token in the Authorization header.

          ## Rate Limiting
          API calls are rate limited per user. Please implement appropriate backoff strategies.
        
  contact:
    name: Token Layer API Support
    url: https://app.tokenlayer.network
servers:
  - url: https://api.tokenlayer.network/functions/v1
    description: Production server
  - url: https://api.tokenlayer.network/functions/v1
    description: Staging server
security: []
tags:
  - name: Tokens
    description: Token creation, browsing, search, trading, and price operations
  - name: Transactions
    description: Blockchain transactions (send, tip, ownership checks)
paths:
  /token-price:
    post:
      tags:
        - Tokens
      summary: Get token price quote
      description: |2-

            Get a price quote for buying or selling tokens. Automatically uses the appropriate protocol:
            - **Token Layer BondingCurve** for non-graduated tokens
            - **UniswapV3** for graduated tokens

            Supports flexible quoting:
            - Specify amount in tokens or USDC
            - Buy or sell direction
            - Handles new token initial fee ($5 minimum)

            **Fee Structure:**
            - Quotes automatically include anti-sniping fees for the first 6 seconds (equivalent in blocks)
            - Anti-sniping fees start at 80% and decrease linearly to 1% over the first 6 seconds worth of blocks
            - This applies to initial purchases and all early trading activity
            - All returned quotes reflect the true cost including applicable fees

            Returns input/output amounts, protocol used, and graduation status.
          
      operationId: tokenPrice
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TokenPriceRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenPriceResponse'
        '400':
          description: Bad request - Invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized - Invalid or missing authentication
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found - Resource does not exist
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - BearerAuth: []
components:
  schemas:
    TokenPriceRequest:
      type: object
      properties:
        tokenId:
          type: string
          format: uuid
          description: Token UUID (optional for new pool quotes - use poolTypeId instead)
          example: 550e8400-e29b-41d4-a716-446655440000
        chainSlug:
          $ref: '#/components/schemas/ChainSlug'
        amount:
          type: number
          minimum: 0
          exclusiveMinimum: true
          default: 1
          description: Amount to quote (interpretation depends on direction and inputToken)
          example: 100
        direction:
          type: string
          enum:
            - buy
            - sell
          default: sell
          description: Trade direction
          example: buy
        inputToken:
          type: string
          enum:
            - token
            - usdc
          default: token
          description: Whether amount represents tokens or USDC
          example: usdc
        poolType:
          type: string
          enum:
            - meme
            - startup-preseed
            - test
          description: >-
            Pool type for new pool quotes. Use this instead of tokenId for
            tokens that don't exist yet. Defaults to "meme".
          example: meme
      required:
        - chainSlug
    TokenPriceResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        data:
          type: object
          properties:
            tokenId:
              type: string
              format: uuid
            tokenSymbol:
              type: string
            tokenName:
              type: string
            chainSlug:
              $ref: '#/components/schemas/ChainSlug'
            direction:
              type: string
              enum:
                - buy
                - sell
            inputToken:
              type: string
              enum:
                - token
                - usdc
            inputAmount:
              type: number
            outputAmount:
              type: number
            inputTokenSymbol:
              type: string
            outputTokenSymbol:
              type: string
            protocol:
              type: string
              enum:
                - RobinSwap
                - UniswapV3
            isGraduated:
              type: boolean
            initFee:
              type: number
              description: >-
                Initial deployment fee for new tokens (only present for
                non-graduated tokens)
              example: 5
            timestamp:
              type: string
              format: date-time
          required:
            - tokenId
            - tokenSymbol
            - tokenName
            - chainSlug
            - direction
            - inputToken
            - inputAmount
            - outputAmount
            - inputTokenSymbol
            - outputTokenSymbol
            - protocol
            - isGraduated
            - timestamp
      required:
        - success
        - data
    Error:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: string
      required:
        - success
        - error
      description: Error response
    ChainSlug:
      type: string
      enum:
        - solana
        - solana-devnet
        - arbitrum
        - base
        - base-sepolia
        - avalanche
        - op-bnb
        - bnb
        - bnb-testnet
        - ethereum
        - monad
        - unichain
        - unichain-testnet
        - abstract
        - polygon
        - zksync
        - zksync-testnet
      description: >-
        Blockchain identifier. Supported chains: solana, solana-devnet,
        arbitrum, base, base-sepolia, avalanche, op-bnb, bnb, bnb-testnet,
        ethereum, monad, unichain, unichain-testnet, abstract, polygon, zksync,
        zksync-testnet
      example: base-sepolia
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT token or API key

````