> ## Documentation Index
> Fetch the complete documentation index at: https://tokenlayer-2a53bba4.mintlify.site/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:
    - **RobinSwap** 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)

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



## OpenAPI

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

          Thrust is a social trading platform where users can create, trade, and engage with tokens.

          This API provides comprehensive access to token operations, social features (posts, voting, clubs),
          blockchain transactions, and real-time interactions.

          ## Base URL
          All endpoints are accessed via: `${SUPABASE_URL}/functions/v1/{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: Thrust API Support
    url: https://onthrust.com
servers:
  - url: https://yppncslmsswqydhhgygz.supabase.co/functions/v1
    description: Production server
  - url: https://yppncslmsswqydhhgygz.supabase.co/functions/v1
    description: Staging server
security: []
tags:
  - name: Tokens
    description: Token creation, browsing, search, trading, and price operations
  - name: Posts
    description: Creating and retrieving posts and topics
  - name: Voting
    description: Voting on posts, polls, tokens, and livestreams
  - name: Notifications
    description: User notifications management
  - name: Clubs
    description: Club and group management
  - name: Feed
    description: Timeline and feed 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:
            - **RobinSwap** 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)

            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
          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
      required:
        - tokenId
        - 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
            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-devnet
        - base
        - base-sepolia
        - avalanche
        - bnb
        - bnb-testnet
        - unichain
        - unichain-testnet
        - abstract
        - polygon
        - zkSync
        - zkSync-testnet
      description: >-
        Blockchain identifier. Supported chains: solana-devnet, base,
        base-sepolia, avalanche, bnb, bnb-testnet, 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

````