GraphQL API

Ver.iD provides a GraphQL API for reading platform data and managing your organization. The public schema and GraphQL explorer are available at graphql.ver.id.

Create API credentials

Sign in to Ver.iD Studio, open Clients, select GraphQL, and click Add GraphQL client.

Give the client a name and select a role:

  • Auditor provides read access.
  • Owner also allows changes to organization resources.

Use Auditor unless your integration requires write access.

After creating the client, open its configuration and copy the following values:

  • OAuth Token URI
  • OAuth Client Identifier
  • OAuth Client Secret

Keep the client secret in your backend. Do not include it in browser or mobile application code.

Authentication

Exchange the client identifier and secret for a signed JWT access token:

curl --request POST https://api.oauth.ver.id/token/grant \
  --user "${VERID_CLIENT_ID}:${VERID_CLIENT_SECRET}" \
  --header "Content-Type: application/x-www-form-urlencoded" \
  --data "grant_type=client_credentials"

The response contains an access_token. Send this token with every GraphQL request:

curl --request POST https://graphql.ver.id \
  --header "Authorization: Bearer ${VERID_ACCESS_TOKEN}" \
  --header "Content-Type: application/json" \
  --data '{"query":"query { findManyAttributes(input: { pagination: { first: 5 } }) { edges { node { uuid name } } } }"}'

TypeScript client

Our official @ver-id/graphql-client handles authentication and GraphQL requests automatically.

yarn add @ver-id/graphql-client
import {
  createVeridGraphQLClient,
  getAttribute,
} from '@ver-id/graphql-client';

const client = createVeridGraphQLClient({
  endpoint: 'https://graphql.ver.id',
  authorizationServer: 'https://api.oauth.ver.id/',
  clientId: process.env.VERID_CLIENT_ID!,
  clientSecret: process.env.VERID_CLIENT_SECRET!,
});

const attribute = await getAttribute(client, '<ATTRIBUTE_UUID>');

The client uses Apollo Client and provides generated types and helper functions. You can also use Apollo Client, urql, or another GraphQL client by requesting the JWT yourself and adding it to the authorization header.

On this page