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

# Native prices

> Returns the latest USD price of each chain's gas asset.

Returns the latest USD price of each chain's gas asset: SOL on `solana`, ETH on `base` and `robinhood`, BNB on `bsc`. `chains` limits results to specific chains; omit it to include every chain.

## Response

`nativePrices` lists one row per chain with a known price, in the order of the [chain table](https://docs.metastreams.io/concepts/chains.md#supported-chains). A chain with no price yet has no row, and a missing row does not mean a price of zero. `arc` never has a row, because its gas asset is USDC.

`price` is the price of one whole unit of `asset`, so `price.native` is always `"1"`. `observedAt` is when the price source reported the rate. New `asset` values can be added, so keep unrecognized values rather than discarding them.

The [`chain.nativePrices`](https://docs.metastreams.io/reference/streams/native-prices) stream sends each new price.

## Errors

| Code | When |
| - | - |
| `UNSUPPORTED_CHAIN` | A `chains` value is not a supported slug |
| `VALIDATION_ERROR` | An unknown parameter |

```bash cURL theme={null}
curl "https://api.metastreams.io/v1/native-prices?chains=solana,bsc" \
  -H "Authorization: Bearer $API_KEY"
```

```typescript TypeScript theme={null}
const url = new URL("https://api.metastreams.io/v1/native-prices");
url.searchParams.set("chains", "solana,bsc");

const response = await fetch(url, {
  headers: { Authorization: `Bearer ${process.env.API_KEY}` },
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const { nativePrices } = await response.json();
```

```rust Rust theme={null}
use serde_json::Value;

let response: Value = reqwest::Client::new()
    .get("https://api.metastreams.io/v1/native-prices")
    .query(&[("chains", "solana,bsc")])
    .bearer_auth(std::env::var("API_KEY")?)
    .send()
    .await?
    .error_for_status()?
    .json()
    .await?;
let native_prices = &response["nativePrices"];
```

```json Native prices theme={null}
{
  "nativePrices": [
    {
      "chain": "solana",
      "asset": "SOL",
      "price": { "native": "1", "usd": "178.42" },
      "observedAt": 1789632015120
    },
    {
      "chain": "bsc",
      "asset": "BNB",
      "price": { "native": "1", "usd": "612.35" },
      "observedAt": 1789632014870
    }
  ]
}
```


## OpenAPI

````yaml specs/openapi.json GET /v1/native-prices
openapi: 3.1.0
info:
  title: Metastreams API
  description: >-
    The Metastreams market-data API. Amounts are decimal strings, timestamps are
    Unix milliseconds, and every field name is camelCase.
  license:
    name: Proprietary
    identifier: Proprietary
  version: 1.0.0
servers:
  - url: https://{host}
    variables:
      host:
        default: api.metastreams.io
        description: API host.
security:
  - bearerKey: []
paths:
  /v1/native-prices:
    get:
      tags:
        - prices
      summary: 'The newest USD price of each chain''s gas asset: SOL, ETH or BNB.'
      description: >-
        `chains` narrows the scope. Without it, the read covers every spot
        chain.

        `chain.nativePrices` streams each new price.
      operationId: native_prices
      parameters:
        - name: chains
          in: query
          description: >-
            Chains to scope to, CSV of the chain slugs. Absent means every spot
            chain.
          required: false
          schema:
            type: string
          example: solana,base
      responses:
        '200':
          description: >-
            The newest price of each chain in scope. A chain with no price yet
            has no row, which is not a zero.
          headers:
            X-Credits-Cost:
              schema:
                type: integer
              description: >-
                Credits charged for this request. Zero on any non-2xx. Sent on a
                metered tier only.
            X-Credits-Remaining:
              schema:
                type: integer
              description: Credit balance after this request. Sent on a metered tier only.
            X-RateLimit-Remaining:
              schema:
                type: integer
              description: >-
                Requests left in the bucket this request spent from. Not sent
                with a 401.
            X-Request-ID:
              schema:
                type: string
              description: >-
                This request's trace ID. Echoed from the request, or generated
                when it sent none.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UiNativePrices'
        '400':
          description: Unsupported chain, or a malformed parameter.
          headers:
            X-Credits-Cost:
              schema:
                type: integer
              description: >-
                Credits charged for this request. Zero on any non-2xx. Sent on a
                metered tier only.
            X-Credits-Remaining:
              schema:
                type: integer
              description: Credit balance after this request. Sent on a metered tier only.
            X-RateLimit-Remaining:
              schema:
                type: integer
              description: >-
                Requests left in the bucket this request spent from. Not sent
                with a 401.
            X-Request-ID:
              schema:
                type: string
              description: >-
                This request's trace ID. Echoed from the request, or generated
                when it sent none.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '401':
          description: >-
            Missing or invalid credential: an API key, or a session token a key
            minted.
          headers:
            X-Credits-Cost:
              schema:
                type: integer
              description: >-
                Credits charged for this request. Zero on any non-2xx. Sent on a
                metered tier only.
            X-Credits-Remaining:
              schema:
                type: integer
              description: Credit balance after this request. Sent on a metered tier only.
            X-RateLimit-Remaining:
              schema:
                type: integer
              description: >-
                Requests left in the bucket this request spent from. Not sent
                with a 401.
            X-Request-ID:
              schema:
                type: string
              description: >-
                This request's trace ID. Echoed from the request, or generated
                when it sent none.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '402':
          description: >-
            The organization's credits this billing period reach its plan's
            limit.
          headers:
            X-Credits-Cost:
              schema:
                type: integer
              description: >-
                Credits charged for this request. Zero on any non-2xx. Sent on a
                metered tier only.
            X-Credits-Remaining:
              schema:
                type: integer
              description: Credit balance after this request. Sent on a metered tier only.
            X-RateLimit-Remaining:
              schema:
                type: integer
              description: >-
                Requests left in the bucket this request spent from. Not sent
                with a 401.
            X-Request-ID:
              schema:
                type: string
              description: >-
                This request's trace ID. Echoed from the request, or generated
                when it sent none.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '403':
          description: >-
            A key whose plan excludes this endpoint gets `FORBIDDEN`. A session
            token from an

            origin it does not name gets `ORIGIN_NOT_ALLOWED`.
          headers:
            X-Credits-Cost:
              schema:
                type: integer
              description: >-
                Credits charged for this request. Zero on any non-2xx. Sent on a
                metered tier only.
            X-Credits-Remaining:
              schema:
                type: integer
              description: Credit balance after this request. Sent on a metered tier only.
            X-RateLimit-Remaining:
              schema:
                type: integer
              description: >-
                Requests left in the bucket this request spent from. Not sent
                with a 401.
            X-Request-ID:
              schema:
                type: string
              description: >-
                This request's trace ID. Echoed from the request, or generated
                when it sent none.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '429':
          description: Rate limit exceeded.
          headers:
            Retry-After:
              schema:
                type: integer
              description: Seconds to wait before retrying.
            X-Credits-Cost:
              schema:
                type: integer
              description: >-
                Credits charged for this request. Zero on any non-2xx. Sent on a
                metered tier only.
            X-Credits-Remaining:
              schema:
                type: integer
              description: Credit balance after this request. Sent on a metered tier only.
            X-RateLimit-Remaining:
              schema:
                type: integer
              description: >-
                Requests left in the bucket this request spent from. Not sent
                with a 401.
            X-Request-ID:
              schema:
                type: string
              description: >-
                This request's trace ID. Echoed from the request, or generated
                when it sent none.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '500':
          description: Unexpected server failure.
          headers:
            X-Credits-Cost:
              schema:
                type: integer
              description: >-
                Credits charged for this request. Zero on any non-2xx. Sent on a
                metered tier only.
            X-Credits-Remaining:
              schema:
                type: integer
              description: Credit balance after this request. Sent on a metered tier only.
            X-RateLimit-Remaining:
              schema:
                type: integer
              description: >-
                Requests left in the bucket this request spent from. Not sent
                with a 401.
            X-Request-ID:
              schema:
                type: string
              description: >-
                This request's trace ID. Echoed from the request, or generated
                when it sent none.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '503':
          description: Dependency down or maintenance.
          headers:
            X-Credits-Cost:
              schema:
                type: integer
              description: >-
                Credits charged for this request. Zero on any non-2xx. Sent on a
                metered tier only.
            X-Credits-Remaining:
              schema:
                type: integer
              description: Credit balance after this request. Sent on a metered tier only.
            X-RateLimit-Remaining:
              schema:
                type: integer
              description: >-
                Requests left in the bucket this request spent from. Not sent
                with a 401.
            X-Request-ID:
              schema:
                type: string
              description: >-
                This request's trace ID. Echoed from the request, or generated
                when it sent none.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
components:
  schemas:
    UiNativePrices:
      type: object
      description: The latest price of each chain's gas asset.
      required:
        - nativePrices
      properties:
        nativePrices:
          type: array
          items:
            $ref: '#/components/schemas/UiNativePrice'
          description: One row per chain with a known price, in `SpotChain` order.
    ErrorEnvelope:
      type: object
      description: The complete error response body — every error is exactly this.
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
          description: The error.
    UiNativePrice:
      type: object
      description: One chain's gas asset, priced in USD.
      required:
        - chain
        - asset
        - price
        - observedAt
      properties:
        asset:
          type: string
          description: >-
            The chain's gas asset. This is an open enumeration: keep a value you
            do not recognize.
          examples:
            - SOL
            - ETH
            - BNB
        chain:
          $ref: '#/components/schemas/SpotChain'
          description: Chain whose gas asset this prices.
        observedAt:
          $ref: '#/components/schemas/UnixMilliseconds'
          description: The instant the price source reports the rate was true.
        price:
          $ref: '#/components/schemas/UiMoney'
          description: One whole unit of `asset`; `native` is always 1.
    ErrorDetail:
      type: object
      description: The `error` object inside the envelope.
      required:
        - code
        - message
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
          description: >-
            Stable, machine-readable. Clients switch on this, never on
            `message`.
        details:
          description: Optional; shape is fixed per code.
        message:
          type: string
          description: |-
            Human-readable, written for the integrating developer:
            `[What happened]. [What to do next — if actionable].`
    SpotChain:
      type: string
      description: >-
        Chain slug. One spelling per chain, in paths and bodies alike. Only a
        chain with spot data is published.
      enum:
        - solana
        - base
        - bsc
        - robinhood
        - arc
    UnixMilliseconds:
      type: integer
      format: int64
      description: An instant, as milliseconds since the Unix epoch.
    UiMoney:
      type: object
      description: >-
        A chain-denominated value with its USD equivalent. The enclosing object
        carries the

        `chain` that names `native`'s unit.
      required:
        - native
      properties:
        native:
          $ref: '#/components/schemas/Decimal'
          description: Value in the owning chain's gas asset.
        usd:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Decimal'
              description: Value in USD; `null` when the native asset is unpriced.
          description: Value in USD; `null` when the native asset is unpriced.
    ErrorCode:
      type: string
      description: |-
        Every wire error code the API can return.

        Append-only: a new code is non-breaking, since clients fall back on the
        HTTP status for one they do not recognize, and a published code is never
        renamed or removed.
      enum:
        - UNAUTHORIZED
        - FORBIDDEN
        - VALIDATION_ERROR
        - UNSUPPORTED_CHAIN
        - NOT_FOUND
        - RATE_LIMITED
        - CREDITS_EXHAUSTED
        - INTERNAL_ERROR
        - SERVICE_UNAVAILABLE
        - RANGE_TOO_LARGE
        - INVALID_CREDENTIALS
        - ORIGIN_NOT_ALLOWED
        - NOT_ORG_MEMBER
        - MEMBERSHIP_INACTIVE
        - EMAIL_NOT_VERIFIED
        - EMAIL_TAKEN
        - ALREADY_MEMBER
        - INVITATION_ALREADY_SENT
        - INVITATION_ALREADY_ACCEPTED
        - LAST_ADMIN
        - CANNOT_REMOVE_SELF
        - KEY_LIMIT_REACHED
        - TOKEN_EXPIRED
        - PAYLOAD_TOO_LARGE
        - UNSUPPORTED_MEDIA_TYPE
        - IMAGE_TOO_LARGE
    Decimal:
      type: string
      format: decimal
      description: An exact decimal, as a string.
      example: '123.456789'
  securitySchemes:
    bearerKey:
      type: http
      scheme: bearer
      description: >-
        Send an API key, or a session token a key minted, as `Authorization:
        Bearer <credential>`. A browser opening `/v1/stream` offers its session
        token in `Sec-WebSocket-Protocol` instead.

````

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