API Reference
The Snipara REST API allows you to manage your projects, documents, and billing programmatically. All endpoints require authentication.
Authentication
Snipara supports two authentication methods:
API Keys (Recommended)
Generate an API key from your project settings. Include it in the Authorization header:
curl -H "Authorization: Bearer sk_live_xxx" https://api.snipara.com/...Session Authentication
When making requests from the browser while logged in, session cookies are automatically included. This is used by the dashboard.
Base URL
https://api.snipara.com/v1API Endpoints
| Endpoint | Description | Documentation |
|---|---|---|
/projects | Create, list, update, and delete projects | View Docs |
/projects/:id/documents | Manage documents within a project | View Docs |
/billing | Manage subscriptions and view usage | View Docs |
/mcp/:projectId | MCP server endpoint for context queries | View Docs |
Projects API
List Projects
GET /v1/projectsReturns a list of all projects you have access to.
Response
{ "projects": [ { "id": "proj_abc123", "name": "My Documentation", "documentCount": 42, "createdAt": "2024-01-15T10:30:00Z" } ]}Create Project
POST /v1/projectsRequest Body
{ "name": "My New Project", "description": "Optional description"}Documents API
Upload Document
POST /v1/projects/:projectId/documentsRequest Body
{ "title": "Getting Started Guide", "content": "# Getting Started\n\nWelcome to...", "filePath": "docs/getting-started.md"}List Documents
GET /v1/projects/:projectId/documentsDelete Document
DELETE /v1/projects/:projectId/documents/:documentIdBilling API
Get Usage
GET /v1/billing/usageResponse
{ "plan": "pro", "queriesUsed": 1250, "queriesLimit": 5000, "periodStart": "2024-01-01T00:00:00Z", "periodEnd": "2024-01-31T23:59:59Z"}Manage Subscription
POST /v1/billing/portalReturns a URL to the Stripe Customer Portal where users can manage their subscription, update payment methods, and view invoices.
Error Responses
All API errors follow a consistent format:
{ "error": { "code": "UNAUTHORIZED", "message": "Invalid API key", "status": 401 }}Common Error Codes
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Invalid request body or parameters |
| 401 | UNAUTHORIZED | Missing or invalid authentication |
| 403 | FORBIDDEN | Access denied to this resource |
| 404 | NOT_FOUND | Resource not found |
| 402 | INSUFFICIENT_CREDITS | Query limit exceeded for current plan |
| 429 | RATE_LIMITED | Too many requests |
| 500 | INTERNAL_ERROR | Server error |
Rate Limits
API rate limits vary by plan:
| Plan | Requests/minute | Requests/day |
|---|---|---|
| Free | 10 | 100 |
| Pro | 60 | 5,000 |
| Team | 120 | 20,000 |
| Enterprise | Custom | Unlimited |