Menu

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.

Primary path
For product integration: use API / SDK
Enterprise administration is a software-system workflow. Use API / SDK contracts here, and keep Hosted MCP for agent access.

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:

curl -H "Authorization: Bearer ent_admin_xxx" https://your-instance.example.com/api/v1/enterprise/...

Base URL

https://your-instance.example.com/api/v1/enterprise

API Overview

ResourceEndpointsDescription
/usersCRUD + PermissionsManage users and their project permissions
/workspacesCRUD + Members + TransferManage workspaces, members, and ownership
/api-keysCRUD + RotateManage API keys for projects and teams
/webhooksCRUD + Test + DeliveriesConfigure webhook endpoints for events
/auditList + ExportView and export audit logs
/usageStatisticsEnterprise-wide usage metrics and trends

Users API

List Users

GET /users?page=1&limit=50&search=john

Query Parameters

  • page - Page number (default: 1)
  • limit - Results per page (default: 50, max: 100)
  • search - Search by email or name

Get User

GET /users/:userId

Create User

POST /users
{
  "email": "user@example.com",
  "name": "John Doe"
}

Update User

PATCH /users/:userId

Delete User

DELETE /users/:userId

Get User Permissions

GET /users/:userId/permissions

Returns 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=engineering

Create Workspace

POST /workspaces
{
  "name": "Engineering Team",
  "ownerId": "user_abc"
}

Get Workspace

GET /workspaces/:workspaceId

Update Workspace

PATCH /workspaces/:workspaceId

Delete Workspace

DELETE /workspaces/:workspaceId

List Workspace Members

GET /workspaces/:workspaceId/members

Add Workspace Member

POST /workspaces/:workspaceId/members
{
  "userId": "user_abc",
  "role": "MEMBER" // ADMIN or MEMBER
}

Update Member Role

PATCH /workspaces/:workspaceId/members/:memberId

Remove Member

DELETE /workspaces/:workspaceId/members/:memberId

Transfer 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=active

Query Parameters

  • type - Filter by type: PROJECT
  • status - 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/:keyId

Update API Key

PATCH /api-keys/:keyId

Revoke API Key

DELETE /api-keys/:keyId

Rotate API Key

POST /api-keys/:keyId/rotate

Generates a new key while preserving all settings. The old key becomes invalid immediately.

Webhooks API

List Webhooks

GET /webhooks?status=ACTIVE

Create 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.cancelled

Get Webhook

GET /webhooks/:webhookId

Update Webhook

PATCH /webhooks/:webhookId

Delete Webhook

DELETE /webhooks/:webhookId

Test Webhook

POST /webhooks/:webhookId/test

Sends a test delivery to verify the webhook endpoint. Returns delivery status and response.

List Webhook Deliveries

GET /webhooks/:webhookId/deliveries?status=failed

Webhook 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-31

Query Parameters

  • action - Filter by action pattern (e.g., user.*, api_key.rotate)
  • entityType - Filter by entity: user, team, project, api_key, webhook
  • actorId - Filter by actor (user who performed action)
  • teamId - Filter by workspace
  • startDate, endDate - Date range (ISO 8601)

Export Audit Logs

GET /audit/export?format=csv&startDate=2024-01-01&endDate=2024-01-31

Query Parameters

  • format - Export format: csv or json
  • startDate, 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=30d

Query Parameters

  • period - Time period: 7d, 30d, 90d, or all

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

StatusCodeDescription
400BAD_REQUESTInvalid request body or parameters
401UNAUTHORIZEDMissing or invalid Enterprise Admin Token
403FORBIDDENInsufficient permissions for this operation
404NOT_FOUNDResource not found
409CONFLICTResource already exists or conflict detected
500INTERNAL_ERRORServer error

Required Permissions

Enterprise Admin Tokens have granular permissions:

PermissionRequired For
USERS_READList/Get users, Get permissions
USERS_WRITECreate/Update/Delete users, Update permissions
WORKSPACES_READList/Get workspaces, List members
WORKSPACES_WRITECreate/Update/Delete workspaces, Manage members, Transfer
API_KEYS_READList/Get API keys
API_KEYS_WRITECreate/Revoke/Rotate API keys
WEBHOOKS_READList/Get webhooks, View deliveries
WEBHOOKS_WRITECreate/Update/Delete webhooks, Test webhook
AUDIT_READList/Export audit logs
USAGE_READView usage statistics

Next Steps