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

# Uniswap pool fees

> Returns the swap fees a pool has earned over each timeframe, split by token, with their USD value. Each swap pays its fee in the token the trader sold, so `token_a_fees` and `token_b_fees` are the amounts collected in each token. USD values are at the time of each swap. A value is `null` when it is not known exactly, for example for pools whose fee changes from swap to swap. Covers swaps from the last 24 hours.

```bash theme={null}
curl "https://staging-api.struct.to/v1/uniswap/pools/{pool}/fees?fields=short" \
  -H "X-API-Key: YOUR_API_KEY"
```


## OpenAPI

````yaml onchain-openapi.json GET /uniswap/pools/{pool}/fees
openapi: 3.1.0
info:
  title: Struct On-chain API
  description: >-
    RESTful API for token market data, discovery, holders, audits, and trader
    analytics across supported chains. Pass `fields=short` or header
    `x-field-names: short` for abbreviated keys. HTTP defaults to `long`. Token
    candlesticks, token trades and wallet batch trades also support
    `fields=array` for typed positional rows.
  version: 1.0.0
servers:
  - url: https://staging-api.struct.to/v1
    description: Staging
security:
  - ApiKey: []
paths:
  /uniswap/pools/{pool}/fees:
    get:
      tags:
        - Uniswap
      summary: Uniswap pool fees
      description: >-
        Returns the swap fees a pool has earned over each timeframe, split by
        token, with their USD value. Each swap pays its fee in the token the
        trader sold, so `token_a_fees` and `token_b_fees` are the amounts
        collected in each token. USD values are at the time of each swap. A
        value is `null` when it is not known exactly, for example for pools
        whose fee changes from swap to swap. Covers swaps from the last 24
        hours.
      operationId: get_uniswap_pool_fees
      parameters:
        - name: chain
          in: query
          description: Chain name. Required unless `chain_id` is provided.
          required: false
          schema:
            type: string
        - name: chain_id
          in: query
          description: Chain id. Required unless `chain` is provided. Use `-1` for Solana.
          required: false
          schema:
            type: integer
            format: int64
        - name: pool
          in: path
          description: >-
            Pool identifier: a Uniswap V2 or V3 pool address, or a 32-byte V4
            pool id.
          required: true
          schema:
            type: string
        - name: timeframes
          in: query
          description: >-
            Comma-separated timeframes (1-6 of: 1m, 5m, 30m, 1h, 6h, 24h).
            Default: 5m,1h,6h,24h.
          required: false
          schema:
            type: string
        - name: x-field-names
          in: header
          required: false
          description: >-
            Select long (full) or short (abbreviated) field names. HTTP defaults
            to `long`. Takes precedence over `fields`. See [Response
            Format](/api-reference/response-format#long-and-short-field-names).
          schema:
            type: string
            enum:
              - long
              - short
            default: long
          example: short
        - name: fields
          in: query
          required: false
          description: >-
            Same as `x-field-names`. Use `long` or `short`. HTTP defaults to
            `long`. Ignored when the header is set. `field_names` is accepted as
            an alias.
          schema:
            type: string
            enum:
              - long
              - short
            default: long
          example: short
      responses:
        '200':
          description: Pool fees by timeframe
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PoolFeesResponse'
        '400':
          description: >-
            Validation error — invalid chain, invalid `pool`, or
            invalid/too-many `timeframes`.
components:
  schemas:
    PoolFeesResponse:
      type: object
      description: Swap fees a pool earned, by timeframe.
      required:
        - pool_id
        - metrics
      properties:
        pool_id:
          type: string
          description: The pool, as requested.
        token_a:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/PoolFeesToken'
              description: The pool's first token. `null` when the pool is unknown.
        token_b:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/PoolFeesToken'
              description: The pool's second token. `null` when the pool is unknown.
        metrics:
          type: object
          description: >-
            Fees for each requested timeframe, keyed by timeframe (`1m`, `5m`,
            `30m`, `1h`, `6h`, `24h`).
          additionalProperties:
            $ref: '#/components/schemas/PoolFeesWindow'
          propertyNames:
            type: string
    PoolFeesToken:
      type: object
      description: One of the pool's two tokens.
      required:
        - address
      properties:
        address:
          type: string
          description: Token address.
        symbol:
          type:
            - string
            - 'null'
          description: Token symbol, when known.
        decimals:
          type:
            - integer
            - 'null'
          format: int32
          description: Token decimals, when known.
          minimum: 0
    PoolFeesWindow:
      type: object
      description: |-
        Fees for one timeframe. A value is `null` when it cannot be stated
        exactly, for example when the pool's fee rate is not known.
      required:
        - swaps
      properties:
        token_a_fees:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Decimal'
              description: Fees paid in token A, in whole tokens.
        token_a_fees_raw:
          type:
            - string
            - 'null'
          description: >-
            Fees paid in token A, in the token's smallest unit, as an integer
            string.
        token_a_fees_usd:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Decimal'
              description: USD value of the token A fees, at the time of each swap.
        token_b_fees:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Decimal'
              description: Fees paid in token B, in whole tokens.
        token_b_fees_raw:
          type:
            - string
            - 'null'
          description: >-
            Fees paid in token B, in the token's smallest unit, as an integer
            string.
        token_b_fees_usd:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Decimal'
              description: USD value of the token B fees, at the time of each swap.
        total_fees_usd:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Decimal'
              description: 'USD value of all fees in the timeframe: token A plus token B.'
        volume_usd:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Decimal'
              description: >-
                USD value traded through the pool in the timeframe, at the time
                of each swap.
        swaps:
          type: integer
          format: int64
          description: Number of swaps in the timeframe.
          minimum: 0
    Decimal:
      type: number
      format: double
      description: Floating-point number serialized as JSON number.
      examples:
        - 4.108801574e-7
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: Secret API key (`sk_*`) or JWT public key (`pk_jwt_*`).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.