Logo
NeoArc Studio

How to Document a GraphQL API

Step-by-step guide to creating GraphQL API documentation with servers, auth schemes, custom scalars, operations (queries, mutations, subscriptions), and embedded examples.

Goal

Create full documentation for a GraphQL API, including server configuration, authentication schemes, custom scalar definitions, operations (queries, mutations, subscriptions) with arguments and return types, and example queries that appear in the published documentation site.

Step 1: Create a GraphQL API Definition

Step 2: Configure Servers

Step 3: Set Up Authentication Schemes

GraphQL API definitions support the same authentication scheme types as REST APIs, configured via the Security accordion.

Auth Scheme TypeKey Configuration Fields
HTTP (Bearer/Basic)Scheme type (bearer, basic, digest), bearer format (e.g. JWT), description
API KeyKey name, location (header, query, cookie), description
OAuth2Flow type (authorization code, client credentials, password, implicit), URLs, scopes
OpenID ConnectDiscovery URL (.well-known/openid-configuration), description
Mutual TLSDescription of certificate requirements

Step 4: Define Custom Scalars

If your GraphQL schema uses custom scalar types beyond the built-in String, Int, Float, Boolean, and ID types, define them here.

Step 5: Add Operations

Operations are the core of GraphQL API documentation. Each operation is a separate file within the API definition directory.

Operation TypePurposeExample
QueryRead data from the APIgetProduct, listOrders, searchCustomers
MutationCreate, update, or delete datacreateOrder, updateProduct, deleteCustomer
SubscriptionReceive real-time updates via WebSocketonOrderCreated, onStockUpdated

Step 6: Configure Arguments and Return Types

Step 7: Add Example Queries

Step 8: Embed in Documentation