API Reference
The icy developer API is currently served solely through a GraphQL endpoint. GraphQL is a very intuitive language but if you're a complete beginner, feel free to check out the GraphQL docs.

Fragments

Our API makes heavy use of Fragments. Types such as Contract are interfaces that are implemented by types like ERC721Contract. Some queries might return the interface rather than the specific type and if you expect some or all of the results to be a certain type, you can use a fragment to grab fields specific for that type. Take the contracts query for example. It returns a Contract some of those results could be ERC721Contracts.
query {
contracts(first: 10) {
edges {
node {
address # common field on all Contract types
... on ERC721Contract {
# Anything here will only be grabbed if this type matches ERC721Contract
symbol
name
}
}
}
}
}

Pagination

We use Relay-style pagination. Every time you encounter a type that is suffixed in Connection (e.g. ContractConnection) it means that this type is paginated.
Each Connection will have two fields: edges and pageInfo.
edges is an object that wraps the node , or underlying value, and a cursor, which you can use to fetch more data.
pageInfo is represented by a consistent type: PageInfo
type PageInfo {
hasNextPage: Boolean!
hasPreviousPage: Boolean!
startCursor: String
endCursor: String
}
Here's an example using the contracts query:
query {
contracts(first: 10) {
edges {
node {
address
}
}
pageInfo {
endCursor
}
}
}
This query will return 10 Contracts and also an endCursor which we can use to fetch the next 10:
query {
contracts(first: 10, after: "YXJyYXljb25uZWN0aW9uOjk") {
edges {
node {
address
}
}
pageInfo {
endCursor
}
}
}

Nested queries

GraphQL makes querying nested data super easy. There's no limit to how deep you can go. For example, you could theoretically query the contract of a given token, and then query the token again from that contract:
query {
token(tokenId: "1", contractAddress: "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d") {
contract {
token(tokenId:"1") {
contract {
token(tokenId:"1") {
...
}
}
}
}
}
}
This is very contrived but shows how easily you can nest data. For a more real-world example, let's look at a query that returns the owners of all the BAYC tokens as well as every other token that their wallet has:
query {
contract(address: "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d") {
tokens {
edges {
node {
... on ERC721Token {
owner {
tokens {
edges {
node {
contract {
address
}
}
}
}
}
}
}
}
}
}
}