Skip to content

The ETS API

Learn how to rapidly query the ETS tag graph

The ETS API is a GraphQL interface built on The Graph protocol that indexes and provides structured access to all ETS protocol data. It enables developers to efficiently query historical and real-time data from ETS smart contracts across supported networks.

API Endpoints

The links below provide ETS API endpoints as well as playgrounds for testing queries for different networks:

NetworkURL
Arbitrum Sepoliahttps://api.studio.thegraph.com/query/87165/ets-arbitrum-sepolia/version/latest
Base Sepoliahttps://api.studio.thegraph.com/query/87165/ets-base-sepolia/version/latest
localhosthttp://localhost:8000/subgraphs/name/ets-local

Usage (GraphQL Clients)

Fetch
import { getSubgraphEndpoint } from "@ethereum-tag-service/subgraph-endpoints";
 
// Arbitrum Sepolia testnet
const endpoint = getSubgraphEndpoint(421614);
 
const graphqlQuery = {
query: `
  query tags(
    $first: Int!,
    $skip: Int!,
    $orderBy: Tag_orderBy!,
    $orderDirection: OrderDirection
  ) {
    tags(
      first: $first
      skip: $skip
      orderBy: $orderBy
      orderDirection: $orderDirection
    ) {
      id
      display
      machineName
      timestamp
      creator {
        id
      }
      owner {
        id
      }
    }
  }
`,
variables: {
  first: 5,
  skip: 0,
  orderBy: "timestamp",
  orderDirection: "desc",
},
};
 
const response = await fetch(endpoint, {
method: "POST",
headers: {
  "Content-Type": "application/json",
},
body: JSON.stringify(graphqlQuery),
});
 
const { data } = await response.json();
console.log(data);

Developing the API

If you're interested in developing the ETS API, check out the ETS API repository for more information.