API Endpoints Reference

Complete reference for all Twig AI REST API endpoints.

Base URL

https://api.twig.so

All endpoints must be accessed over HTTPS.

Authentication

All requests require an API key in the Authorization header:

curl -H "Authorization: Bearer YOUR_API_KEY" \
  https://api.twig.so/api/agents

See Authentication for details.

Rate Limits

Plan
Requests/Minute
Requests/Day

Free

20

1,000

Pro

100

10,000

Enterprise

1,000+

Custom

See Rate Limits for details.

API Endpoints

Chat & Completion

POST /api/chat

Generate an AI response.

Request:

Response:

POST /api/semantic-search

Search without generating response.

Request:

AI Agents

GET /api/ai-agent-managers

List all agents.

Response:

POST /api/ai-agent-managers

Create new agent.

Request:

GET /api/ai-agent-managers/:id

Get agent details.

PUT /api/ai-agent-managers/:id

Update agent configuration.

DELETE /api/ai-agent-managers/:id

Delete agent.

Data Sources

GET /api/data-specs

List data sources.

POST /api/data-specs

Create data source.

Request:

POST /api/data-specs/:id/process

Trigger processing.

Interactions

GET /api/interactions

List interactions.

Query Parameters:

  • limit: Number of results (default: 50)

  • offset: Pagination offset

  • agentId: Filter by agent

  • startDate: Filter by date range

  • endDate: Filter by date range

POST /api/interactions/feedback

Submit feedback.

Request:

Analytics

GET /api/analytics/charts/dashboard

Get analytics dashboard data.

Query Parameters:

  • startDate: Start date (YYYY-MM-DD)

  • endDate: End date (YYYY-MM-DD)

  • agentId: Filter by agent (optional)

Response:

Users & Groups

GET /api/users

List users.

POST /api/user-management/users

Create user.

GET /api/groups

List groups.

POST /api/groups

Create group.

Organization

GET /api/organizations/:id

Get organization details.

PUT /api/organizations/:id

Update organization settings.

Knowledge Base

GET /api/kb

List KB articles.

POST /api/kb

Create article.

PUT /api/kb/:id

Update article.

Error Responses

All errors follow this format:

Common Error Codes

Code
Status
Description

invalid_request

400

Malformed request

unauthorized

401

Invalid/missing API key

forbidden

403

Insufficient permissions

not_found

404

Resource not found

rate_limit_exceeded

429

Too many requests

internal_error

500

Server error

Webhooks

Configure webhooks to receive event notifications.

Supported Events:

  • interaction.created

  • interaction.completed

  • agent.updated

  • data_source.processed

See Webhooks for details.

SDKs

Official SDKs available for:

  • JavaScript/TypeScript

  • Python (coming soon)

See SDKs for documentation.

Next Steps

Last updated