Skip to main content

Queries

For queries, you just add the Authorization header on every HTTP request to https://graph.codex.io/graphql and it will authorize you.

List

Too see a reference of all the possible queries you can make, go to queries.

Example

Try it

import { Codex } from "@codex-data/sdk"

const sdk = new Codex("your-api-key")

const { getTokenPrices } = await sdk.query(gql`
  query {
    getTokenPrices(inputs: [{ address: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", networkId: 56 }]) {
      priceUsd
      timestamp
      address
    }
  }
`)
fetch("https://graph.codex.io/graphql", {
  method: "POST",
  headers: {
    "Authorization": apiKey,
  },
  body: JSON.stringify({ query: 'query { getTokenPrices(inputs: [{ address: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", networkId: 56 }]) { priceUsd timestamp address } }' }),
})