Middesk provides an optional GraphQL API for accessing business verification and identity data. It enables you to query the business identity, associated people, addresses, and other related compliance and risk insights through a flexible GraphQL interface. Unlike traditional REST APIs, which often use multiple endpoints for different resources and operations, GraphQL centralizes all interactions through a single endpoint. Interaction with the API is via GraphQL queries and mutations. The queries provide an interface to return only the fields requested.
Use of the GraphQL API is optional and contains a subset of all available functionality. It can offer some benefits, but use the traditional REST API if it better suits your use case.
The GraphQL endpoint at Middesk is: https://api.middesk.com/graphql
Apollo Studio hosts the public schema reference.
Send your API credentials in the Authorization header as a Bearer Token.
Example request:
Use a GraphQL client to introspect and explore the full schema. Use an API key to interact with the API on Apollo Studio, which also shows the latest version of the schema. Middesk’s webhook behavior matches the REST API webhook design.
ID scalar! are non-nullable in the schema.The API returns lists as “connections” (for example, people, names, addresses, businesses). Connections support cursor-based pagination via:
first / after for forward paginationlast / before for backward paginationEach connection includes:
edges { cursor node { ... } }nodes { ... } (convenience)pageInfo { hasNextPage hasPreviousPage startCursor endCursor }To keep responses predictable, paginate within these limits:
If you request more than the limit, results may be clamped.
Forward pagination example:
This pattern is already supported across connections.
To create a new business, use a mutation:
The mutation creates a new business and returns its id, name, and status. Use the errors field to check for any issues creating the business. If a business fails to create, the mutation returns null with errors present.
A common use case after creating a business is to add additional orders. Use the createOrder mutation for this purpose.
Middesk’s GraphQL API follows the standard GraphQL error format, returning errors within an errors array in the response. Each error object includes a message describing what went wrong.
Always check for the errors array before assuming success—GraphQL queries can partially succeed with a 200 HTTP status, returning some data while including errors for failed fields. Monitor HTTP status codes for server errors (5xx). Use strongly-typed GraphQL clients when possible to catch validation errors at development time, and always validate required fields to avoid runtime null value errors.
System-level errors indicate that the GraphQL request could not be executed normally. These errors appear in a top level errors array.
For business logic or validation failures within a mutation, the API does not use the top level errors array. Instead, each mutation returns a result payload that may contain errors within an errors field describing the specific failures.
The following example demonstrates the differences between using Middesk’s REST API and its GraphQL API.
Retrieving a business
Sending a GET request tohttps://api.middesk.com/v1/businesses/{id} retrieves the business for the given identifier (id).
The returned response consists of the entire business payload with all attributes.
While simple to use, the payload contains more data than may be needed, depending on the use case. Interacting with the API necessitates navigating a large payload to find relevant information.
Retrieving a business
Send a POST request to https://api.middesk.com/graphql with the following GraphQL query to retrieve a business.
Via curl:
The response includes only the requested attributes.
Another example
The GraphQL API supports fetching only the data needed. For example, a user can check only the name and address verification outcomes of a business by using the following GraphQL query:
The response includes only the requested attributes.
The GraphQL API allows users to fine-tune their usage of Middesk’s product.