Enterprise API
The Enterprise API provides administrative control for an Enterprise workspace or administrative deployment. Manage users, workspaces, project API keys, webhooks, audit logs, and usage statistics.
Enterprise Only
The Enterprise API is an Enterprise administrative surface. Hosted availability, enabled routes, and licensing depend on the workspace configuration; self-hosting is not required by the route contract. Contact enterprise@snipara.com for licensing information.
Authentication
All Enterprise API endpoints require an Enterprise Admin Token. Generate tokens from:
- Workspace Settings: Dashboard → Settings → Workspace → Enterprise Admin Tokens
- Enterprise Console: snipara.com/enterprise/login
curl -H "Authorization: Bearer ent_admin_xxx" https://your-instance.example.com/api/v1/enterprise/...Base URL
https://your-instance.example.com/api/v1/enterpriseAPI Overview
| Resource | Endpoints | Description |
|---|---|---|
/users | CRUD + Permissions | Manage users and their project permissions |
/workspaces | CRUD + Members + Transfer | Manage workspaces, members, and ownership |
/api-keys | CRUD + Rotate | Manage API keys for projects and teams |
/webhooks | CRUD + Test + Deliveries | Configure webhook endpoints for events |
/audit | List + Export | View and export audit logs |
/usage | Statistics | Enterprise-wide usage metrics and trends |
Users API
List Users
GET /users?page=1&limit=50&search=johnQuery Parameters
page- Page number (default: 1)limit- Results per page (default: 50, max: 100)search- Search by email or name
Get User
GET /users/:userIdCreate User
POST /users{ "email": "user@example.com", "name": "John Doe"}Update User
PATCH /users/:userIdDelete User
DELETE /users/:userIdGet User Permissions
GET /users/:userId/permissionsReturns project-level permissions for the user.
Update User Permissions
PUT /users/:userId/permissions{ "permissions": [ { "projectId": "proj_123", "accessLevel": "EDITOR" }, { "projectId": "proj_456", "accessLevel": "ADMIN" } ]}Access levels: NONE, VIEWER, EDITOR, ADMIN
The Enterprise user role field is currently returned as NONE by the administrative route; use project permission records for the effective access contract. The documented ADMIN/MEMBER role labels are not yet an implemented Enterprise-wide role assignment API.
Workspaces API
List Workspaces
GET /workspaces?page=1&limit=50&search=engineeringCreate Workspace
POST /workspaces{ "name": "Engineering Team", "ownerId": "user_abc"}Get Workspace
GET /workspaces/:workspaceIdUpdate Workspace
PATCH /workspaces/:workspaceIdDelete Workspace
DELETE /workspaces/:workspaceIdList Workspace Members
GET /workspaces/:workspaceId/membersAdd Workspace Member
POST /workspaces/:workspaceId/members{ "userId": "user_abc", "role": "MEMBER" // ADMIN or MEMBER}Update Member Role
PATCH /workspaces/:workspaceId/members/:memberIdRemove Member
DELETE /workspaces/:workspaceId/members/:memberIdTransfer Ownership
POST /workspaces/:workspaceId/transfer{ "newOwnerId": "user_xyz"}The new owner must be an existing member. Current owner is demoted to Admin.
Workspace creation requires both name and ownerId. The current administrative contract does not document a separate email-invitation endpoint; create or provision the user first, then add the existing user as a member.
API Keys API
List API Keys
GET /api-keys?type=PROJECT&status=activeQuery Parameters
type- Filter by type:PROJECTstatus- Filter:active,revoked,expired
Create API Key
POST /api-keys{ "name": "CI/CD Key", "type": "PROJECT" "projectId": "proj_123" "accessLevel": "EDITOR", // VIEWER, EDITOR, or ADMIN "expiresInDays": 90 // Optional}Save the API Key
The full API key is only returned once during creation. Store it securely.
Get API Key
GET /api-keys/:keyIdUpdate API Key
PATCH /api-keys/:keyIdRevoke API Key
DELETE /api-keys/:keyIdRotate API Key
POST /api-keys/:keyId/rotateGenerates a new key while preserving all settings. The old key becomes invalid immediately.
Webhooks API
List Webhooks
GET /webhooks?status=ACTIVECreate Webhook
POST /webhooks{ "name": "Production Webhook", "url": "https://example.com/webhook", "events": [ "user.created", "project.indexed", "api_key.rotated" ], "headers": { "X-Custom": "value" }, // Optional "maxRetries": 3, // 0-10, default: 3 "retryDelay": 60 // 10-3600 seconds}Available Events
user.createduser.updateduser.deletedproject.createdproject.updatedproject.deletedproject.indexedapi_key.createdapi_key.revokedapi_key.rotatedworkspace.createdworkspace.updatedworkspace.deletedworkspace.member_addedworkspace.member_removedsubscription.createdsubscription.updatedsubscription.cancelledGet Webhook
GET /webhooks/:webhookIdUpdate Webhook
PATCH /webhooks/:webhookIdDelete Webhook
DELETE /webhooks/:webhookIdTest Webhook
POST /webhooks/:webhookId/testSends a test delivery to verify the webhook endpoint. Returns delivery status and response.
List Webhook Deliveries
GET /webhooks/:webhookId/deliveries?status=failedWebhook Signature Verification
All webhook deliveries include an X-Webhook-Signature header for verification:
X-Webhook-Signature: t=1234567890,v1=abc123...Verify by computing HMAC-SHA256(timestamp + "." + body, secret) and comparing to the v1 value.
Audit Logs API
List Audit Logs
GET /audit?action=user.*&startDate=2024-01-01&endDate=2024-01-31Query Parameters
action- Filter by action pattern (e.g.,user.*,api_key.rotate)entityType- Filter by entity:user,team,project,api_key,webhookactorId- Filter by actor (user who performed action)teamId- Filter by workspacestartDate,endDate- Date range (ISO 8601)
Export Audit Logs
GET /audit/export?format=csv&startDate=2024-01-01&endDate=2024-01-31Query Parameters
format- Export format:csvorjsonstartDate,endDate- Required date range- Supports same filters as list endpoint
Maximum 10,000 records per export. Returns a downloadable file.
Usage API
Get Usage Statistics
GET /usage?period=30dQuery Parameters
period- Time period:7d,30d,90d, orall
Response
{ "period": "30d", "overview": { "totalUsers": 150, "activeUsers": 89, "totalWorkspaces": 12, "totalProjects": 45, "totalApiKeys": 78, "totalQueries": 125000, "recentAuditLogs": 3500 }, "trends": { "dailyQueries": [...], "userGrowth": [...] }, "topWorkspaces": [...], "subscriptions": [...]}Error Responses
All Enterprise API errors follow a consistent format:
{ "success": false, "error": { "code": "FORBIDDEN", "message": "Insufficient permissions" }}Common Error Codes
| Status | Code | Description |
|---|---|---|
| 400 | BAD_REQUEST | Invalid request body or parameters |
| 401 | UNAUTHORIZED | Missing or invalid Enterprise Admin Token |
| 403 | FORBIDDEN | Insufficient permissions for this operation |
| 404 | NOT_FOUND | Resource not found |
| 409 | CONFLICT | Resource already exists or conflict detected |
| 500 | INTERNAL_ERROR | Server error |
Required Permissions
Enterprise Admin Tokens have granular permissions:
| Permission | Required For |
|---|---|
USERS_READ | List/Get users, Get permissions |
USERS_WRITE | Create/Update/Delete users, Update permissions |
WORKSPACES_READ | List/Get workspaces, List members |
WORKSPACES_WRITE | Create/Update/Delete workspaces, Manage members, Transfer |
API_KEYS_READ | List/Get API keys |
API_KEYS_WRITE | Create/Revoke/Rotate API keys |
WEBHOOKS_READ | List/Get webhooks, View deliveries |
WEBHOOKS_WRITE | Create/Update/Delete webhooks, Test webhook |
AUDIT_READ | List/Export audit logs |
USAGE_READ | View usage statistics |