# Developer API & MCP

Build custom integrations and applications using our comprehensive REST API. Programmatically manage agents, query knowledge bases, and integrate AI capabilities into your own products.

## Overview

The Developer API provides programmatic access to all platform capabilities, enabling you to:

* Query agents and receive AI-powered responses
* Manage knowledge bases and data sources
* Create and configure agents programmatically
* Integrate AI capabilities into your applications
* Build custom workflows and automations
* Monitor usage and performance metrics

## Getting Started

### Quick Start Checklist

1. [**Obtain API Keys**](/product/developer-api/authentication.md) - Generate and secure your API credentials
2. [**Review API Overview**](/product/developer-api/overview.md) - Understand REST endpoints and core concepts
3. [**Explore Endpoints**](/product/developer-api/rest-api.md) - Browse the complete API reference
4. [**Check Rate Limits**](/product/developer-api/rate-limits.md) - Understand usage quotas and best practices
5. [**Set Up Webhooks**](/product/developer-api/webhooks.md) (Optional) - Receive real-time event notifications

## API Documentation

### [REST API Overview](/product/developer-api/overview.md)

Learn the fundamentals of our REST API, including base URLs, request/response formats, pagination, error handling, and versioning.

### [API Endpoints Reference](/product/developer-api/rest-api.md)

Complete reference documentation for all available endpoints, including request parameters, response schemas, and example calls.

### [Authentication & API Keys](/product/developer-api/authentication.md)

Secure your API access with proper authentication. Learn how to generate, rotate, and manage API keys safely.

### [Webhooks & Events](/product/developer-api/webhooks.md)

Set up webhooks to receive real-time notifications about events like conversation completions, data source updates, and agent status changes.

### [SDKs & Client Libraries](/product/developer-api/sdks.md)

Use official and community-maintained SDKs for popular programming languages to accelerate your integration.

### [Rate Limits](/product/developer-api/rate-limits.md)

Understand rate limiting, quotas, and best practices for high-volume usage. Learn how to handle rate limit errors gracefully.

## Common Use Cases

### Custom Chatbots

Build your own chat interface using the conversational API. Perfect for:

* Custom web applications
* Mobile apps
* Internal tools
* Specialized user interfaces

**Example:** Query an agent and display responses in your UI.

### Workflow Automation

Integrate AI into your business processes:

* Automated document analysis
* Email response generation
* Data enrichment pipelines
* Scheduled report generation

**Example:** Process incoming support tickets and suggest responses.

### Data Pipeline Integration

Programmatically manage your knowledge base:

* Bulk upload documents
* Sync custom data sources
* Update metadata
* Delete outdated content

**Example:** Automatically sync new documentation when your code is deployed.

### Monitoring & Analytics

Build custom dashboards and alerts:

* Track API usage
* Monitor response quality
* Analyze user patterns
* Set up custom alerts

**Example:** Create a real-time dashboard showing agent performance metrics.

### Multi-Tenant Applications

Build SaaS applications powered by our AI:

* Isolate data per customer
* Create agents programmatically per tenant
* Manage permissions
* Track usage per customer

**Example:** White-label AI assistant for your customers.

## API Architecture

### RESTful Design

Our API follows REST principles with:

* Resource-based URLs
* Standard HTTP methods (GET, POST, PUT, DELETE)
* JSON request/response bodies
* Stateless authentication

### Response Format

```json
{
  "data": { ... },
  "metadata": {
    "request_id": "req_abc123",
    "timestamp": "2026-01-26T10:30:00Z"
  }
}
```

### Error Handling

Comprehensive error responses with:

* Standard HTTP status codes
* Detailed error messages
* Error codes for programmatic handling
* Request IDs for debugging

## Security Best Practices

### API Key Management

* Store keys in environment variables, never in code
* Use different keys for development and production
* Rotate keys regularly
* Revoke compromised keys immediately

### Request Security

* Always use HTTPS
* Validate and sanitize user input
* Implement request signing for sensitive operations
* Use webhook signature verification

### Data Privacy

* Follow least-privilege principles
* Implement proper access controls
* Audit API usage regularly
* Comply with data residency requirements

Learn more in [Security & Compliance](/product/security/authentication-authorization.md).

## Rate Limits & Quotas

| Plan       | Requests/Minute | Daily Quota |
| ---------- | --------------- | ----------- |
| Free       | 10              | 1,000       |
| Pro        | 100             | 50,000      |
| Enterprise | Custom          | Custom      |

See [Rate Limits](/product/developer-api/rate-limits.md) for complete details and best practices.

## SDKs & Tools

### Official SDKs

* Python SDK
* Node.js/TypeScript SDK
* REST API Postman Collection

### Community SDKs

* Ruby (community-maintained)
* Go (community-maintained)
* Java (community-maintained)

See [SDKs & Client Libraries](/product/developer-api/sdks.md) for installation and usage.

## Support & Resources

### Documentation

* [API Reference](/product/developer-api/rest-api.md) - Complete endpoint documentation
* [Authentication Guide](/product/developer-api/authentication.md) - Security and API keys
* [Webhooks Guide](/product/developer-api/webhooks.md) - Real-time event handling

### Developer Resources

* Code examples and tutorials
* Postman collection for testing
* OpenAPI/Swagger specification
* Changelog and versioning

### Getting Help

* API status page for incidents
* Developer community forum
* Support tickets for API issues
* Professional services for enterprise customers

## Versioning & Changelog

We use semantic versioning for our API:

* **Major versions** include breaking changes
* **Minor versions** add new features
* **Patch versions** fix bugs

Current version: `v1`

See our [Changelog](/product/reference/changelog.md) for detailed updates.

## Next Steps

Ready to start building?

1. [**Generate your API key**](/product/developer-api/authentication.md) to authenticate requests
2. [**Explore the REST API Overview**](/product/developer-api/overview.md) to understand core concepts
3. [**Browse API endpoints**](/product/developer-api/rest-api.md) to find what you need
4. [**Check out SDKs**](/product/developer-api/sdks.md) if you prefer language-specific libraries

For advanced use cases, review [Webhooks & Events](/product/developer-api/webhooks.md) and [Rate Limits](/product/developer-api/rate-limits.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.twig.so/product/developer-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
