Admin API Overview

Overview

Twingate provides an Admin API to Enterprise tier customers. If you're interested in accessing the Twingate Admin API and you are not a current Enterprise tier customer, please contact us.

Our Admin API is GraphQL-based and currently provides the ability to:

  • Create, read, update, and delete all Remote networks
  • Create, read, update, delete, and generate tokens for all Connectors
  • Create, read, update, and delete all Resources
  • Create, read, update, and delete all Groups
  • Read and update the trust status of all Devices
  • Read all Users

API schema documentation is part of the GraphQL API endpoint and is always up to date. See the next section on how to access the Admin API.

Getting started

In order to access the GraphQL endpoint for your Twingate network, you first need to generate an API token in the Admin console. You can find this in the Settings > API section.

Once you have your API token available, our Admin API GraphQL endpoint is available at the following address:

  • https://<YOUR NETWORK>.twingate.com/api/graphql/
  • You will also need to set a custom HTTP header, X-API-KEY with the value of your API key.

Example query

If you're new to using GraphQL, this example query requests the first 10 Remote Networks in your account, returning the ID and name of each Remote Network along with pagination information if there are more results. Additional information can be returned for each RemoteNetworkEdge node; consult the GraphQL schema for more information.

{
  remoteNetworks(after: null, first:10) {
    edges {
      node {
        id
        name
      }
    }
    pageInfo {
      startCursor
      hasNextPage
    }
  }
}

GraphQL clients

If you're looking for a query GUI, GraphiQL is very easy to use. You can get started quickly on Mac with Homebrew:

brew install --cask graphiql

If you're using Python, we'd recommend the gql library, which allows you to get started with just a few lines of code and a query string.

Terraform Provider

Twingate's Terraform provider uses the Twingate API to automatically provision Twingate constructs such as Connectors and Resources, and may be useful if you'd like to manage your organization's infrastructure as code. Please see the documentation for more details.


Did this page help you?