API

You can use the Hub GraphQL API to create flexible queries for the data you need to integrate with Snapshot.

There is a limit of 60 requests per minute with the API, to get higher limits please apply for an API Key by following this guide: API Keys

Hub GraphQL API - Explorer

You can run queries on Snapshot data using a GraphQL Explorer.

We have exposed an integrated development environment in the browser that includes docs, syntax highlighting, and validation errors. Click the link below to access the interface.

Endpoints

Production hub

https://hub.snapshot.org/graphql

Demo hub

https://testnet.hub.snapshot.org/graphql

Queries

Get a single space

Arguments

id string

Example

query {
  space(id: "yam.eth") {
    id
    name
    about
    network
    symbol
    members
  }
}

Try on GraphiQL

Get multiple spaces

Arguments

first number skip number where: - idstring - id_inarray orderBy string orderDirection asc or desc

Example

query {
  spaces(
    first: 20,
    skip: 0,
    orderBy: "created",
    orderDirection: asc
  ) {
    id
    name
    about
    network
    symbol
    strategies {
      name
      params
    }
    admins
    members
    filters {
      minScore
      onlyMembers
    }
    plugins
  }
}

Try on GraphiQL

Get a single proposal

Arguments

id string

Example

query {
  proposal(id:"QmWbpCtwdLzxuLKnMW4Vv4MPFd2pdPX71YBKPasfZxqLUS") {
    id
    title
    body
    choices
    start
    end
    snapshot
    state
    author
    created
    scores
    scores_by_strategy
    scores_total
    scores_updated
    plugins
    network
    strategies {
      name
      network
      params
    }
    space {
      id
      name
    }
  }
}

Try on GraphiQL

Get proposals

Arguments

first number skip number where: - idstring - id_inarray - space:string - space_in:array - author:string - author_in:array - network: string - network_in: array - state: array orderBy string orderDirection asc or desc

Example

query {
  proposals (
    first: 20,
    skip: 0,
    where: {
      space_in: ["yam.eth"],
      state: "closed"
    },
    orderBy: "created",
    orderDirection: desc
  ) {
    id
    title
    body
    choices
    start
    end
    snapshot
    state
    scores
    scores_by_strategy
    scores_total
    scores_updated
    author
    space {
      id
      name
    }
  }
}

Try on GraphiQL

Get a single vote

Choices are indexed 1-based. The first choice has index 1.

Arguments

id string

Example

query {
  vote (
    id: "QmeU7ct9Y4KLrh6F6mbT1eJNMkeQKMSnSujEfMCfbRLCMp"
  ) {
    id
    voter
    vp
    vp_by_strategy
    vp_state
    created
    proposal {
      id
    }
    choice
    space {
      id
    }
  }
}

Try on GraphiQL

Get votes

Choices are indexed 1-based. The first choice has index 1.

Arguments

first number skip number where: - idstring - id_inarray - space:string - space_in:array - voter:string - voter_in:array - proposal: string - proposal_in: array orderBy string orderDirection asc or desc

Example

query {
  votes (
    first: 1000
    skip: 0
    where: {
      proposal: "QmPvbwguLfcVryzBRrbY4Pb9bCtxURagdv1XjhtFLf3wHj"
    }
    orderBy: "created",
    orderDirection: desc
  ) {
    id
    voter
    vp
    vp_by_strategy
    vp_state
    created
    proposal {
      id
    }
    choice
    space {
      id
    }
  }
}

Try on GraphiQL

Get voting power

Arguments

voter string space string proposal string

Example

query {
  vp (
    voter: "0xeF8305E140ac520225DAf050e2f71d5fBcC543e7"
    space: "fabien.eth"
    proposal: "0x4903dd16990de740b7dc7effe1a0bc8bd49a510a04992bc30596c9a0d0f69455"
  ) {
    vp
    vp_by_strategy
    vp_state
  } 
}

Try on GraphiQL

Get follows

Arguments

first number skip number where: - idstring - id_inarray - space:string - space_in:array - follower:string - follower_in:array orderBy string orderDirection asc or desc

Example

query {
  follows(
    first: 10,
    where: {
      follower: "0xeF8305E140ac520225DAf050e2f71d5fBcC543e7"
    }
  ) {
    follower
    space {
      id
    }
    created
  }
}

Try on GraphiQL

Get users

Arguments

first number skip number where: - id:string - id_in:array orderBy string orderDirection asc or desc

Example

query {
  users(first: 10, where: { id_in: ["0xF78108c9BBaF466dd96BE41be728Fe3220b37119"] }) {
    id
    name
    about
    avatar
  }
}

Try on GraphiQL

Get roles

Arguments

first number skip number where: - address:string orderBy string orderDirection asc or desc

query {
  roles(where:{address:"0xE029Ef62e47E394BC852EFf633eB5aa4A223ECa6"}) {
    space
    permissions
  }
}

Try on GraphiQL

Aliases

TBD

Get messages

Messages are all the actions (votes, proposals, space settings etc..) that was confirmed on Snapshot, it also include the order on which these actions were confirmed with the field "mci". These messages can be used to replay the whole Snapshot hub API.

Arguments

first number skip number where: - timestampstring - spacearray - space_in:array - type:string - type_in:string orderBy string orderDirection asc or desc

Example

query {
  messages (
    first: 20
    where: { space: "ens.eth" }
    orderBy: "mci"
    orderDirection: desc
  ) {
    id
    address
    ipfs
    receipt
    type
    mci
  }
}

Try on GraphiQL

Last updated