LogoLogo
PlatformReference
  • Welcome to Rollup
  • An Introduction to OpenID Connect (OIDC)
  • The Rollup Identity Graph
  • Getting Started
    • Create an Application
    • Setup Auth Flow
    • API Access
  • Guides
    • Storing Tokens
    • Session Management
    • Using Scopes
      • Requesting Email
      • Requesting Connected Accounts
      • Requesting Smart Contract Wallets
    • Third Party Auth Tools
      • Setup with Auth0
      • Setup with Supabase
      • Setup with NextAuth.js
  • Platform
    • Console
      • Dashboard
      • OAuth
      • Blockchain
      • Designer
      • Custom Domain
      • Users
      • KYC
      • Messaging
      • Audience Builder
      • Teams & Contact
      • Billing
    • Passport
    • Galaxy
  • Advanced
    • Tokens
    • Pop Up Auth Flow
    • Create Custom Claims
    • Migration Guide
  • Reference
    • Galaxy API
    • Passport API
    • Scopes
  • Troubleshooting
    • FAQ
  • Roadmap
  • Contributing
  • Login to Console
Powered by GitBook
On this page
  • Setup Guide
  • Definitions
  • API Playground

Was this helpful?

Edit on GitHub
Export as PDF
  1. Reference

Galaxy API

GraphQL API Docs

PreviousMigration GuideNextPassport API

Last updated 1 year ago

Was this helpful?

Access to Galaxy is served up by a GraphQL (GQL) API at

To prevent abuse, the service limits requests for each application to 10 per minute.

Setup Guide

There are several ways you can consume GQL APIs and we've documented how below. If you are interested in a deeper understanding of GraphQL you can visit the

For these examples we are using Javascript but you would be able to achieve similar results with your preferred language.

Option 1: Simple Fetch Client

A simple fetch client is the fastest way to consume a GQL API if you are not using GQL anywhere else in your application since this method requires no new dependencies.

Here is a simple example of using fetch with Galaxy.

const query = `query getProfile() {
  profile {
    displayName
    pfp
  }
}`

const { profile } = fetch("https://galaxy.rollup.id/graphql", {
  method: "post",
  headers: {
    "Authorization": `Bearer ${jwt}`,
    "X-GALAXY-KEY": "...",
  },
  body: JSON.stringify({ query }),
})
  .then(r => r.json())
  .catch(err => {
    console.error(err) // something went wrong
    return { profile: null }
  })

In this example we are calling the Galaxy "profile" resolver and asking it to return two fields.

Here is the same operation but with two resolvers this time:

const query = `query getProfile() {
  profile {
    displayName
    pfp
  }
  gallery {
    contract
    tokenId
  }
}

const { profile } = fetch("https://galaxy.rollup.id/graphql", {
  method: "post",
  headers: {
    "Authorization": "Bearer ${jwt}",
    "X-GALAXY-KEY": "...",
  },
  body: JSON.stringify({ query }),
})
  .then(r => r.json())
  .then(data => {
    return {
      ...data.profile,
      gallery
   }
  })
  .catch(err => {
    console.error(err) // something went wrong
    return { profile: null }
  })

In this example get two responses. One from "profile" and one from "gallery. Then we merge the response into one profile object. And here is one more example operation with variables:

const query = `query getProfileFromAlias($provider, $alias) {
  profile: profileFromAlias(provider: $provider, alias: $alias) {
    displayName
    pfp
  }
}

const { profile } = fetch("https://galaxy.rollup.id/graphql", {
  method: "post",
  headers: {
    "X-GALAXY-KEY": "...",
  },
  body: JSON.stringify({
    query,
    variables: {
      provider: "eth",
      alias: "vitalik.eth"
    }
  }),
})
  .then(r => r.json())
  .catch(err => {
    console.error(err) // something went wrong
    return { profile: null }
  })

Option 2: GraphQL Clients

GraphQL Request helps reduce the overhead of making GQL API calls with a simple fetch. Let's demonstrate the same examples in Option 1 with this library.

First we setup a client:

const client = new GraphQLClient(endpoint, {
  headers: {
    Authorization: 'Bearer ${jwt}',
    'X-GALAXY-KEY': '...',
  },
})

Then we can do the single operation request:

const query = `query getProfile() {
  profile {
    displayName
    pfp
  }
}

const { profile } = client.request(query)

Just like in Option 1, in this example we are calling the Galaxy "profile" resolver and asking it to return two fields.

Let's do the same but with two resolvers this time:

const query = `query getProfile() {
  profile {
    displayName
    pfp
  }
  gallery {
    contract
    tokenId
  }
}

const { profile } = client.request(query).then(data => {
  return {
    ...data.profile,
    gallery
  }
})

Again, just like in Option 1, in this example get two responses. One from "profile" and one from "gallery. Then we merge the response into one profile object. And finally, one more example operation with variables:

const query = `query getProfileFromAlias($provider, $alias) {
  profile: profileFromAlias(provider: $provider, alias: $alias) {
    displayName
    pfp
  }
}

const { profile } = client.request(query, {
  provider: "eth",
  alias: "vitalik.eth"
})

As you can see, with a GraphQL client lines the overhead of making API calls is greatly reduced.

Option 3: GraphQL Generator

This option is best if you already have GraphQL well integrated into your application and are looking to extend your GQL client.

With this approach you can then reference your operations directly from your client. For example:

const { profile } = await myGeneratedClient.getProfileFromAddress({
  addressURN,
})

Definitions

X-Galaxy-Key Header

Authorization Header

API Playground

Our recommended approach is to use a general purpose GQL Client. One such client we recommend for Javascript is

A popular tool for generating client is the With the generator you can reference the Galaxy API schema at http://galaxy.rollup.id in your and ahead of time too.

This is the API Key that can be found in the dashboard of your App and is required to authenticate into the Galaxy API.

This is where you provide the JWT received from your user sessions after the .

To see the entire API definition you can explore the entire Galaxy API at the .

https://galaxy.rollup.id
GraphQL documentation portal.
graphql-request.
GraphQL Code Generator.
codegen configuration
write your operation documents
Console
token exchange during user login
GQL playground