Skip to main content

GraphQL API

clepit's GraphQL surface covers the document model: workspaces, pages, blocks, comments, search, revisions and sharing. Every request needs an access token.

JSON
{
  "method": "POST",
  "url": "https://api.clepit.com/graphql",
  "headers": { "Authorization": "Bearer <access token>" }
}

Playground

A graphical explorer is served at GET /graphql in every environment except production.

https://staging.api.clepit.com/graphql

Reading a page tree

GraphQL
query PageTree($workspaceId: String!) {
  pages(workspaceId: $workspaceId) {
    id
    title
    parentId
    position
  }
}

Saving a document

Blocks are stored generically as type plus data, so a block type the server has never seen round-trips untouched rather than being rewritten.

GraphQL
mutation SaveDocument($id: String!, $blocks: [BlockInput!]!) {
  saveDocument(id: $id, blocks: $blocks) {
    id
    updatedAt
  }
}

Subscriptions

Subscribe over WebSocket at wss://api.clepit.com/graphql/ws

JSON
{
  "type": "connection_init",
  "payload": { "Authorization": "Bearer <access token>" }
}