Skip to main content
Version: 1.0.0

GraphQL API Reference

You can use the Zeet GraphQL API to build integrations that extend and enhance Zeet features. This page will help you get started with using the GraphQL API.

You can use the links in the sidebar to learn more about how to use the schema:

  • Allowed operations: queries, mutations and subscriptions.
  • Schema-defined types: scalars, objects, enums, interfaces, unions, and input objects.

Getting Started

1. Installing GraphQL

First install GraphQL in your local development environment.

npm add graphql-request graphql

2. Generate your Zeet API Key

You can generate an API key for Zeet by going to https://zeet.co/account/api. You can also find this by going to Team Settings → API Keys. Once you are here, create a new API Key which you can use in your program as shown below.

3. Import package and setup endpoint

You are now ready to start sending API requests using GraphQL to Zeet! Let’s import the package in our file and set up our endpoint and authorization for Zeet.

import { GraphQLClient, gql } from 'graphql-request'

async function main () {

// define your HTTP endpoint
const endpoint = "https://anchor.zeet.co/graphql";

// create new GraphQLClient object
const graphQLClient = new GraphQLClient (endpoint, {
headers : {
authorization : 'Bearer ' + API_KEY,
},
});

}

4. Queries using GraphQL

You can test and make sure that your API actually works by sending a simple request to fetch you Zeet User ID.

.
.
// create a new request
const req = gql`
query {
currentUser {
id
}
}
`

// send the query as a request
const data = await graphQLClient.request(req);

// print the data received
console.log (JSON.stringify(data, undefined, 4));

5. Mutations using GraphQL

You can use Mutations to modify data in the data store. Note that Mutations always return some data. You can perform Mutations as easily as a query; when crafting your request, use the mutation keyword instead of query to specify a Mutation.

For example, if you wanted to attach a Custom Domain name to your repo, you could use the API to send a mutation like this:

mutation {
addRepoCustomDomain (input: {id: "my_repo_id", domain: "my_site.com"}) {
id
}
}

Or, if you wanted to copy over your envvars from one repo to another,

mutation {
copyEnvVars (
from: "my_repo_1",
to: "my_repo_2"
) {
id
}
}