Build API Docs with Apidog
  1. GraphQL Documentation
Build API Docs with Apidog
  • Overview
  • REST API Documentations
    • Basics
      • API-Design First Approach
      • Specify an endpoint
      • Components
      • Common parameters
      • Global parameters
      • Schemas
        • Overview
        • Create a new schema
        • Build a schema
        • Generate Schemas from JSON etc.
    • Advanced features
      • Custom endpoint fields
      • Endpoint status
      • Appearance of parameter lists
      • Endpoint unique idenfication
    • Example: Pet Store
      • Get user info
      • Find pet by ID
      • Add a new pet to the store
      • Update an existing pet
      • Deletes a pet
      • Finds Pets by status
  • SOAP API Documentations
    • How to Use Apidog to Write SOAP API Documentation
    • Example: WebService
      • WebService: Number To Words
      • SOAP: Add integers
      • SOAP/WSDL: Ebay
    • Example: Mastercard
      • Purchase Request
      • Submit a purchase request
  • GraphQL Documentation
    • How to Write GraphQL API Documentation Using Apidog
    • Example: Github
      • Introduction to GraphQL
      • Queries
      • Public schema
  • WebSocket Documentations
    • How to Use Apidog to Write WebSocket API Documentation
    • Example: Coinbase
      • Overview
      • Channel
  • SSE API Documentations
    • Example: Anthropic
      • Streaming Messages
      • Messages
  • gRPC API Documentations
    • How to Use Apidog for gRPC API Documentation and Testing
    • Example: Proto Documentation
      • Protocol Documentation
  1. GraphQL Documentation

How to Write GraphQL API Documentation Using Apidog

GraphQL is a query language and server-side runtime for APIs that enables clients to request exactly the data they need, no more, no less . Unlike traditional REST APIs, GraphQL allows developers to declare nested data requirements in a single request, improving efficiency and flexibility. It uses a type system to define data structures and supports real-time updates, making it ideal for modern applications.

Writing GraphQL Documentation in Apidog#

Apidog simplifies GraphQL documentation through its intuitive Markdown-based workflow. Here's how to get started:
1.
Create a New GraphQL Request:
Navigate to your project in Apidog, click "New Markdown" to create a GraphQL doc.
2.
Document Using Markdown:
Write your GraphQL schema, queries, and mutations directly in Markdown. For example:
3.
Add Descriptions and Examples:
Use comments to explain fields, parameters, and response structures. This ensures clarity for developers consuming the API.
You can see some examples from Github GraphQL API.
Introduction to GraphQL
Queries
Public schema

Testing GraphQL APIs with Apidog#

1. Creating a New GraphQL Request#

To create a new GraphQL request in a project, click on "Body" → "GraphQL" in sequence.

2. Requesting GraphQL#

Enter your query in the Query box on the "Run" tab. You can also click the manual Fetch Schema button in the input box to enable the "code completion" feature for Query expressions, assisting in entering Query statements.
Query statements support using GraphQL variables for requesting. For specific usage, please refer to the GraphQL syntax.
Apidog visualizes the response data and supports dynamic variables for environment-specific testing. You can also mock responses based on your schema to simulate edge cases.
Previous
Submit a purchase request
Next
Example: Github
Built with