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; a larger limit is 400 with reason invalid_pagination. Responses include hasMore and total.
  • ?domain= on companies and leads finds the exact domain (normalised, without www.), the reliable way to check for duplicates before adding a lead.
  • The OpenAPI 3.1 description is public at /api/v1/openapi.json. An unknown path is 404 with reason unknown_route and links to these docs.
  • 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=&domain=&limit=&offset=companies:read
GET/api/v1/companies/{id}companies:read
POST/api/v1/companiescompanies:create
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=&domain=&status=leads:read
GET/api/v1/leads/{id}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
GET/api/v1/tasks/{id}tasks:read
POST/api/v1/taskstasks:write
PATCH/api/v1/tasks/{id}tasks:write
POST/api/v1/capturescaptures:write
POST/api/v1/captures/{id}/applycaptures:write
POST/api/v1/captures/{id}/undocaptures:write
POST/api/v1/captures/{id}/discardcaptures:write
GET/api/v1/activitiesactivities:read
GET/api/v1/outbound/review-queueoutbound:read
POST/api/v1/outbound/review-verdictsoutbound:review
POST/api/v1/outbound/owner-approvalsoutbound:owner_approve
GET/api/v1/outbound/send-statusoutbound:breaker_read
POST/api/v1/outbound/breaker-resetoutbound:breaker_reset
PATCH/api/v1/outbound/workspace-configoutbound:write
POST/api/v1/outbound/workspace-config/signature-template/approveoutbound:template_approve
GET/api/v1/outbound/messages/{id}/previewoutbound:read
GET/api/v1/outbound/messages/{id}outbound:read
POST/api/v1/outbound/messagesoutbound:write
PATCH/api/v1/outbound/messages/{id}outbound:write
POST/api/v1/outbound/messages/{id}/outcomesoutbound:write
POST/api/v1/outbound/messages/{id}/transitionsoutbound:write

Errors

Error bodies are { "error": code }, often with a stable reason and a message that says how to recover. 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.