GraphQL Basics
Kanvas uses GraphQL. All requests go to a single endpoint — you describe exactly what data you want and get back precisely that.
Endpoint
Every request is a POST with a JSON body containing your query (or mutation) and optional variables.
Request Format
{
"query": "query GetPeople($first: Int!) { peoples(first: $first) { data { id name email } } }",
"variables": { "first": 10 }
}Queries (Read Data)
Queries fetch data. You specify exactly which fields you need:
query {
peoples(first: 10) {
data {
id
uuid
firstname
lastname
email
contacts {
type { name }
value
}
organizations { name }
}
paginatorInfo {
total
currentPage
lastPage
hasMorePages
}
}
}Mutations (Write Data)
Mutations create, update, or delete data:
mutation {
createPeople(input: {
firstname: "Jane"
lastname: "Doe"
email: "jane@example.com"
contacts: [
{ contacts_types_id: 1, value: "+1-555-0100" }
]
}) {
id
name
email
}
}Subscriptions (Real-Time)
Subscribe to changes via WebSocket:
subscription {
leadUpdate {
id
title
status { name }
stage { name }
}
}Scalar Types
| Field | Type | Description |
|---|---|---|
| DateTime | String | Y-m-d H:i:s format |
| Date | String | Y-m-d format |
| DateTimeTz | String | ISO 8601 with timezone |
| Upload | File | GraphQL multipart upload |
| Mixed | Any | Any type — used for flexible fields |
| JSON | Object | JSON object |
| String | Valid email address |