Cycle API
Ask or search…
K
Links

How to start

The public API is built around Graphql and is the same as the one we use internally at Cycle. Some basic knowledge about Graphql and its paradigms is required to fully understand the schema. The Graphql official documentation is the best starting point.

Endpoint

Cycle's endpoint is the following: https://api.product.cycle.app/graphql
It supports introspection so you can query the whole schema.

Playground

Cycle's API provides a Graphql playground IDE to expose the schema with its query, mutations, subscriptions and resolvers that serves as a self documented tool to explore the API.
Cycle's Graphql playground

Queries and mutations

Most queries and mutations require to be authenticated to run them. The token must be placed in the Authorization header prefixed with the Bearer word (refer to the Authentication section).
curl \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <Replace this with your access token>" \
--data '{ "query": "{ me { id email } }" }' \
https://api.product.cycle.app/graphql
To access informations available to the authenticated user, you can use the me query.
query me {
me {
id
email
firstname
lastname
}
}
From there, you can explore the whole schema but keep in mind that if you go too deep, you may be complexity limited (see section Limitations).
query me {
me {
id
email
firstName
lastName
products {
edges {
node {
id
name
}
}
}
}
}
Triggering a mutation is as simple but you may sometimes need to fetch some piece of information first to populate the needed arguments. This is typically the case when creating a feedback with the createFeedback mutation for which you need at least the productId. The updateMe doesn't require any specific and let you update your user programatically.
mutation updateMe {
updateMe(firstName: "Super", lastName: "hero") {
id
firstName
lastName
}
}