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

FieldTypeDescription
DateTimeStringY-m-d H:i:s format
DateStringY-m-d format
DateTimeTzStringISO 8601 with timezone
UploadFileGraphQL multipart upload
MixedAnyAny type — used for flexible fields
JSONObjectJSON object
EmailStringValid email address