Skip to content

Enterprise REST API

Integrate ThinkFlyFlow into your own systems. A versioned JSON API over HTTPS with JWT and Personal Access Token authentication, predictable pagination, and a stable error contract.

Overview

The ThinkFlyFlow API is a REST API returning JSON. All endpoints are namespaced under /api/v2.

EnvironmentBase URLUse for
Productionhttps://api.laureljar.com/api/v2Live integrations
Testhttps://apitest.laureljar.com/api/v2Development & certification

Every response uses a consistent envelope:

success
{
  "success": true,
  "data": { "...": "payload" }
}
error
{
  "success": false,
  "error": "Human-readable message",
  "code": "machine_code"
}

Interactive schema (OpenAPI 3):
• Swagger UI — /api/v2/docs/
• OpenAPI JSON — /api/v2/schema/

Send Content-Type: application/json on all write requests. Uploads use multipart/form-data.

Authentication

All endpoints except /auth/login/, /auth/signup/, and /health/ require a bearer token:

header
Authorization: Bearer <access_token_or_pat>
POST/auth/login/
request
{
  "email": "you@example.com",
  "password": "••••••••"
}
response
{
  "success": true,
  "data": {
    "access": "eyJhbGciOi...",
    "refresh": "eyJhbGciOi...",
    "user": { "id": 7757, "email": "you@example.com", "user_type": "admin" }
  }
}

Token lifetimes. Access tokens are valid for 72 hours; refresh tokens for 30 days and are rotated on each refresh.

POST/auth/refresh/
refresh
{ "refresh": "eyJhbGciOi..." }

Two-factor authentication is supported: /auth/2fa/setup/, /auth/2fa/verify/, /auth/2fa/disable/, /auth/2fa/status/.

Personal Access Tokens

For server-to-server and headless integrations, use a Personal Access Token. PATs are prefixed lj-, do not expire by default, and are scoped to the issuing user. Treat them like passwords.

POST/auth/pat/generate/
request
{ "name": "ci-agent" }
response
{
  "success": true,
  "token": {
    "id": "…",
    "name": "ci-agent",
    "token": "lj-xxxxxxxxxxxxxxxxxxxxxxxx",
    "expires_at": null
  }
}

Use the token exactly like an access token in the Authorization header.

usage
curl https://api.laureljar.com/api/v2/auth/me/ \
  -H "Authorization: Bearer lj-xxxxxxxxxxxxxxxxxxxxxxxx"

Pagination & filtering

List endpoints are paginated (page-number style) with a default page size of 20. Pass page and page_size as query parameters.

request
GET /projects/?page=2&page_size=50
response
{
  "success": true,
  "data": {
    "count": 137,
    "next": "https://api.laureljar.com/api/v2/projects/?page=3&page_size=50",
    "previous": "https://api.laureljar.com/api/v2/projects/?page=1&page_size=50",
    "results": [ { "...": "item" } ]
  }
}

Follow next until it is null to page through a collection. Sort and filter parameters are documented per endpoint in the reference below.

Errors

Errors use standard HTTP status codes and the error envelope above.

StatusMeaningTypical cause
400Bad RequestValidation error — check required fields
401UnauthorizedMissing, invalid, or expired token
402Payment RequiredAI credit quota exhausted
403ForbiddenAuthenticated but lacking permission
404Not FoundResource does not exist or is not yours
409ConflictDuplicate / state conflict
422UnprocessableSemantically invalid input
429Too Many RequestsRate limited — honour Retry-After
500Server ErrorUnexpected error — contact support with the request id

Include the request id (returned in the X-Request-Id response header) when contacting support.

Rate limits & AI credits

The API enforces per-account rate limits and an AI credit budget for AI-backed endpoints.

ControlWhereNotes
HTTP rate limitAll endpointsReturns 429 + Retry-After when exceeded
AI creditsAI endpointsFree tier: 100 credits/day (UTC reset); surfaced via /ai/credits/
Model costAI endpointsLower-cost models spend fewer credits — see /ai/models/
GET/ai/credits/
credit state
{
  "success": true,
  "data": { "remaining": 82, "limit": 100, "resets_at": "2026-09-12T00:00:00Z" }
}

Endpoint reference

Grouped by domain. Method and path are shown; parameters, bodies and full response schemas are available in the live Swagger UI linked above.

Auth

POST/auth/login/
POST/auth/signup/
POST/auth/refresh/
GET/auth/me/
POST/auth/pat/generate/
POST/auth/2fa/setup/ · verify/ · disable/ · status/

Workspaces

GET/workspaces/
POST/workspaces/
GET/workspaces/{id}/
GET/workspaces/{id}/members/
GET/workspaces/{id}/roles/
GET/workspaces/{id}/audit/
POST/workspaces/create-org/

Projects, folders & files

GET/projects/
POST/projects/
GET/projects/{id}/tree/
POST/projects/{id}/folders/
POST/files/upload/
GET/files/{id}/
GET/files/{id}/download/
POST/files/{id}/reanalyze/

AI & intelligence

POST/ai/chat/
GET/ai/chats/
GET/ai/credits/
GET/ai/models/
POST/search/semantic/

Builder, notifications, dashboard

GET/builder/
POST/builder/
GET/notifications/
POST/notifications/{id}/read/
GET/dashboard/stats/

Integrations & webhooks

GET/integrations/
POST/integrations/{provider}/auth/
GET/webhooks/
POST/webhooks/

Prefer the command line? Use the ThinkFlyFlow CLI →

Webhooks

Register an HTTPS endpoint to receive event notifications. Webhooks are signed so you can verify authenticity, and failed deliveries are retried with exponential backoff.

POST/webhooks/
register
{
  "url": "https://your-app.example.com/hooks/thinkflyflow",
  "events": ["file.created", "file.updated", "ai.completed"],
  "secret": "whsec_xxxxxxxx"
}
delivery payload
{
  "id": "evt_123",
  "type": "file.created",
  "created_at": "2026-09-11T13:45:00Z",
  "data": { "file_id": "…", "project_id": "…", "name": "report.pdf" }
}

Verify the X-ThinkFlyFlow-Signature header by computing an HMAC-SHA256 of the raw body with your secret and comparing in constant time. Respond 2xx within 10 seconds to acknowledge.

Enterprise & compliance

The following apply to enterprise agreements. Wording here is indicative and subject to the signed contract.

TopicDetail
EnvironmentsDedicated test environment for certification before production cutover
SSO / MFA2FA endpoints available; SSO via enterprise IdP on request
AuditPer-workspace audit trail at /workspaces/{id}/audit/
Data residencyPer agreement — confirm region before onboarding
Rate limitsHigher limits available on enterprise plans
Support & SLAPriority support channel and response-time SLA per contract
VersioningAdditive changes within /api/v2; deprecations announced in advance

For onboarding, certification, and API credentials, contact support@laureljar.com.