Skip to contentleitvik

Documentation

REST API v1

The REST API gives scripts and integrations the same scoped access as the connector. It accepts only API tokens; OAuth tokens work only on the MCP endpoint.

Basics

  • Base URL: https://app.leitvik.com/api/v1
  • Header: Authorization: Bearer qre_…. Requests and responses are JSON.
  • Rate limit: the token's own limit per minute (60 by default, 1 to 600), shared with the connector. Over it the answer is 429 with Retry-After.
  • Lists default to 50 items and cap at 100, with limit and offset; responses include hasMore.
  • Dates use the workspace timezone.

First request

curl
curl -s "https://app.leitvik.com/api/v1/context" \
  -H "authorization: Bearer $LEITVIK_TOKEN"

Idempotent writes

Record writes accept a requestId (UUID) in the body or an Idempotency-Key header. For 24 hours a repeat with the same key and content returns the first result without writing again; the same key with different content is 409. Task, opportunity and capture writes require their own requestId.

Versions

Tasks and opportunities carry a version. Send the current one with every change; a stale version is 409, so read again and decide again.

Endpoints

MethodPathScope
GET/api/v1/contextAny scope
GET/api/v1/companies?q=&limit=&offset=companies:read
GET/api/v1/companies/{id}companies:read
PUT/api/v1/companiescompanies:write
GET/api/v1/companies/{id}/briefcompanies:readleads:readtouches:readsignals:read
GET/api/v1/contacts?companyId=contacts:read
PUT/api/v1/contactscontacts:write
GET/api/v1/leads?q=&status=leads:read
PATCH/api/v1/leads/{id}leads:write
GET/api/v1/touches?companyId=touches:read
POST/api/v1/touchestouches:write
GET/api/v1/signals?companyId=signals:read
POST/api/v1/signalssignals:write
GET/api/v1/dossiers?companyId=dossiers:read
PUT/api/v1/dossiersdossiers:write
GET/api/v1/today?limit=&offset=leads:read
GET/api/v1/tasks?status=&due=&owner=&companyId=tasks:read
POST/api/v1/taskstasks:write
PATCH/api/v1/tasks/{id}tasks:write
GET/api/v1/opportunities?companyId=&stage=opportunities:read
POST/api/v1/opportunitiesopportunities:write
PATCH/api/v1/opportunities/{id}opportunities:write
POST/api/v1/capturescaptures:write
POST/api/v1/captures/{id}/applycaptures:write
POST/api/v1/captures/{id}/undocaptures:write

Errors

Error bodies are { "error": code }. They never include stack traces, SQL or your input.

StatusCodeMeaning
400validationInvalid input.
401unauthorizedMissing, expired or revoked token, or missing scope.
403forbiddenThe token cannot do it.
404not_foundNot in this workspace.
409conflictStale version, invalid transition, or reused key with different content.
413too_largeBody over the limit.
429rate_limitedToo many requests; wait Retry-After seconds.