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/v1

API Endpoints

EndpointDescriptionDocumentation
/projectsCreate, list, update, and delete projectsView Docs
/projects/:id/documentsManage documents within a projectView Docs
/billingManage subscriptions and view usageView Docs
/mcp/:projectIdMCP server endpoint for context queriesView Docs

Projects API

List Projects

GET /v1/projects

Returns 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/projects

Request Body

{
  "name": "My New Project",
  "description": "Optional description"
}

Documents API

Upload Document

POST /v1/projects/:projectId/documents

Request Body

{
  "title": "Getting Started Guide",
  "content": "# Getting Started\n\nWelcome to...",
  "filePath": "docs/getting-started.md"
}

List Documents

GET /v1/projects/:projectId/documents

Delete Document

DELETE /v1/projects/:projectId/documents/:documentId

Billing API

Get Usage

GET /v1/billing/usage

Response

{
  "plan": "pro",
  "queriesUsed": 1250,
  "queriesLimit": 5000,
  "periodStart": "2024-01-01T00:00:00Z",
  "periodEnd": "2024-01-31T23:59:59Z"
}

Manage Subscription

POST /v1/billing/portal

Returns 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

StatusCodeDescription
400VALIDATION_ERRORInvalid request body or parameters
401UNAUTHORIZEDMissing or invalid authentication
403FORBIDDENAccess denied to this resource
404NOT_FOUNDResource not found
402INSUFFICIENT_CREDITSQuery limit exceeded for current plan
429RATE_LIMITEDToo many requests
500INTERNAL_ERRORServer error

Rate Limits

API rate limits vary by plan:

PlanRequests/minuteRequests/day
Free10100
Pro605,000
Team12020,000
EnterpriseCustomUnlimited

Next Steps