Introduction
Welcome to the Kavitro Dev Center.
Kavitro API
The Kavitro API allows developers to programmatically access and update data inside their Kavitro account. Whether it's to integrate it with your website or some other application.
Kavitro API is fully built with GraphQL, which is a flexible query language that allows you to specify as much or as little data as you need. Learn more about the decision why we decided in favor of GraphQL over REST.
How does GraphQL work?
GraphQL relies on a type system, where each object is a type and contains fields that define it. These fields can be scalars (such as integers) or can be objects themselves. Some fields also take arguments, which can be used to limit, filter, or sort the data that is returned.
Mutations are a special kind of field that update data.
When you make a query, you define what objects (and fields) you want to return. If you're returning a object that itself contains other fields, you need to define what data you want to return on that nested object.
Here's an example of a query for retrieving the currently authenticated user's data:
query {
me {
id
firstName
lastName
email
}
}
Learn more about GraphQL from the GraphQL Foundation introduction.
Making a request
Every query and mutation goes to one endpoint, over HTTPS:
POST https://api.kavitro.com/graphql
There are no other paths. The request body is JSON with a query property, plus variables when your document takes any, and your access token travels in an Authorization header.
Here is the query above, sent with curl:
curl https://api.kavitro.com/graphql \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"query": "query { me { id firstName lastName email } }"}'
{
"data": {
"me": {
"id": "1",
"firstName": "John",
"lastName": "Doe",
}
},
"extensions": {
"complexity": 5
}
}
Everything else in these docs is a variation on that one shape: a different document in query, and matching variables beside it. The extensions object comes back on every executed query and reports what the query cost.
Start building
To start building on Kavitro API:
- You'll need a Kavitro account. If you already have one - great - one less step to complete.
- An access token for authenticating your requests. Tokens are long-lived, so store and reuse yours rather than logging in repeatedly.
- If you're not familiar with GraphQL we suggest you read through:
- Head over to the API Reference page for a more detailed overview of our schema.