API Structure

Learn how the Sprinto Developer API is structured using GraphQL, including queries, mutations, arguments, and pagination.

The Sprinto Developer API is built on GraphQL and follows standard GraphQL conventions. If you have worked with GraphQL APIs before, you will find the Sprinto Developer API familiar and easy to use. If GraphQL is new to you, reviewing the core concepts will help you get started quickly.

This article explains the structure of the Sprinto Developer API, including root objects, queries, mutations, and arguments, and shows how to explore the schema using the API Playground.


Root objects

Every GraphQL request starts with a root object, which defines the type of operation being performed. The Sprinto Developer API supports two root types:

  • Query – used to read data

  • Mutation – used to modify data

Each API call begins with one of these root types, followed by the specific field that represents the data you want to fetch or update.


Reading data with queries

Queries are used to retrieve data from Sprinto. A query starts with the Query root type and specifies the field representing the data you want to fetch.

Example query

query Query {
  hello
}

In this example:

  • Query indicates that the request is a read operation.

  • hello is the field being queried and defines the data returned in the response.

GraphQL allows you to fetch only the fields you need, even when working with complex or nested data structures. This makes queries efficient and flexible.


Exploring available queries

To explore all supported queries and their fields, use the Sprinto API Playground. The playground allows you to inspect the API schema and test queries interactively.

Use the appropriate playground based on your data residency region:

  • United States: Sprinto API Playground

  • Europe: Sprinto API Playground

  • India: Sprinto API Playground


Using arguments in queries

Arguments allow you to customise queries and control the data returned. They are passed to fields inside parentheses and can accept variables.

Example with arguments

Understanding the arguments

  • first Accepts an integer value and defines the number of records to retrieve.

  • after Accepts a cursor value and allows you to fetch records that appear after a specific node.

Arguments help you navigate large datasets and retrieve only the information you need.


Pagination

Queries that return large result sets use pagination to limit the number of records returned in a single response.

Pagination:

  • Improves performance

  • Reduces response size

  • Prevents timeouts

The Sprinto Developer API uses cursor-based pagination. Refer to the Pagination documentation to learn how cursors work and how to iterate through paginated results.


Writing data with mutations

Mutations are used to create or update data in Sprinto. Mutation requests start with the Mutation root type and specify the mutation field that defines the action to be performed.

Example mutation

In this example:

  • Mutation indicates that the request modifies data.

  • markStaffAsInScope is the mutation field.

  • email is a required argument used to identify the staff member.

The exclamation mark (!) indicates that the argument is mandatory.


Exploring mutations

All available mutations and their required inputs can be explored using the Sprinto API Playground.

Use the appropriate playground for your region:

  • United States: Sprinto API Playground

  • Europe: Sprinto API Playground

  • India: Sprinto API Playground

The playground provides visibility into mutation inputs, required fields, and response types.


Next steps

After understanding the API structure, you can:

  • Use the API Playground to explore queries and mutations

  • Review pagination behaviour for large datasets

  • Follow the Quick Start guide to make authenticated API requests

Last updated