LI.FI Token API

The Token API from LI.FI — 1 operation(s) for token.

OpenAPI Specification

lifi-token-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: LI.FI Earn advanced Token API
  description: Enterprise DeFi yield discovery and tracking API
  version: 0.1.0
  contact: {}
servers:
- url: https://earn.li.fi
  description: Production
security:
- x-lifi-api-key: []
tags:
- name: Token
paths:
  /v1/token:
    get:
      parameters:
      - example: POL
        name: chain
        description: Id or key of the chain that contains the token
        schema:
          type: string
        in: query
        required: true
      - example: DAI
        name: token
        description: Address or symbol of the token on the requested chain
        schema:
          type: string
        in: query
        required: true
      - name: x-lifi-api-key
        description: Authentication header, register in the LI.FI Partner Portal (https://portal.li.fi/ ) to get your API Key.
        schema:
          type: string
        in: header
      responses:
        '200':
          $ref: '#/components/responses/TokenResponse'
        '400':
          $ref: '#/components/responses/InvalidChainResponse'
        '404':
          $ref: '#/components/responses/NoTokenFound'
      summary: Fetch information about a Token
      description: 'This endpoint can be used to get more information about a token by its address or symbol and its chain.

        If you want to learn more about how to use this endpoint please have a look at our [guide](/api-reference/fetch-information-about-a-token).'
      tags:
      - Token
components:
  responses:
    NoTokenFound:
      description: No token found for the given address and chain
    TokenResponse:
      content:
        application/json:
          schema:
            type: array
            items:
              $ref: '#/components/schemas/Token'
          examples:
            ExampleTokenResponse:
              value:
                address: '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063'
                symbol: DAI
                decimals: 18
                chainId: 137
                name: (PoS) Dai Stablecoin
                coinKey: DAI
                priceUSD: '1'
                logoURI: https://static.debank.com/image/matic_token/logo_url/0x8f3cf7ad23cd3cadbd9735aff958023239c6a063/549c4205dbb199f1b8b03af783f35e71.png
      description: ''
    InvalidChainResponse:
      description: User passed an invalid chain id or abbreviation
  schemas:
    Token:
      title: Root Type for Token
      description: Representation of a Token
      required:
      - address
      - chainId
      - decimals
      - name
      - symbol
      type: object
      properties:
        address:
          description: Address of the token
          type: string
        decimals:
          format: number
          description: Number of decimals the token uses
          type: number
        symbol:
          description: Symbol of the token
          type: string
        chainId:
          format: number
          description: Id of the token's chain
          type: number
        coinKey:
          description: Identifier for the token
          type: string
        name:
          description: Name of the token
          type: string
        logoURI:
          description: Logo of the token
          type: string
        priceUSD:
          description: Token price in USD
          type: string
      example:
        address: '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063'
        symbol: DAI
        decimals: 18
        chainId: 137
        name: (PoS) Dai Stablecoin
        coinKey: DAI
        priceUSD: '1'
        logoURI: https://static.debank.com/image/matic_token/logo_url/0x8f3cf7ad23cd3cadbd9735aff958023239c6a063/549c4205dbb199f1b8b03af783f35e71.png
  securitySchemes:
    x-lifi-api-key:
      type: apiKey
      in: header
      name: x-lifi-api-key