Skip to main content

Admin API

Manage tenants, connections, and multi-tenant configuration.

Base Path

/admin

Endpoints

Connection Management

GET /admin/connections/stats

Get connection statistics for the current tenant.

Request:

curl http://localhost:3007/admin/connections/stats \
-H "X-API-KEY: your-internal-key" \
-H "X-JWT-Token: your-jwt-token"

Response:

{
"success": true,
"data": {
"tenant_id": "company-a",
"total_connections": 2,
"connections_by_type": {
"jira": 1,
"github": 1
}
}
}

Use Cases:

  • Monitor connection usage per tenant
  • Verify connection pooling is working
  • Debug connection issues
  • Test tenant isolation

DELETE /admin/connections

Clear cached connections for the current tenant.

Request:

# Clear all connections
curl -X DELETE http://localhost:3007/admin/connections \
-H "X-API-KEY: your-internal-key" \
-H "X-JWT-Token: your-jwt-token"

# Clear specific connection type
curl -X DELETE "http://localhost:3007/admin/connections?connection_type=jira" \
-H "X-API-KEY: your-internal-key" \
-H "X-JWT-Token: your-jwt-token"

Query Parameters:

  • connection_type (optional): Clear specific type (jira, github). If omitted, clears all.

Response:

{
"success": true,
"message": "Cleared connections for tenant company-a",
"connection_type": "all"
}

Use Cases:

  • Force connection recreation after credential changes
  • Testing connection creation
  • Debugging connection issues
  • Clearing stale connections

Tenants

GET /admin/tenants

List all tenants.

Request:

curl http://localhost:3007/admin/tenants \
-H "X-API-KEY: your-internal-key"

Response:

{
"success": true,
"data": {
"tenants": [
{
"id": "my-tenant",
"consumerId": "apideck-consumer-id",
"name": "My Organization",
"description": "My organization tenant",
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z"
}
],
"count": 1
}
}

GET /admin/tenants/:id

Get tenant by ID.

Request:

curl http://localhost:3007/admin/tenants/my-tenant \
-H "X-API-KEY: your-internal-key"

POST /admin/tenants

Create new tenant.

Request:

curl -X POST http://localhost:3007/admin/tenants \
-H "Content-Type: application/json" \
-H "X-API-KEY: your-internal-key" \
-d '{
"id": "new-tenant",
"consumerId": "apideck-consumer-id",
"name": "New Tenant",
"description": "Description of the tenant"
}'

Request Body:

{
"id": "new-tenant",
"consumerId": "apideck-consumer-id",
"name": "New Tenant Name",
"description": "Description of the tenant"
}

Validation Rules:

  • id: Required, 3-50 characters, alphanumeric only
  • consumerId: Required, 3-100 characters
  • name: Optional, max 100 characters
  • description: Optional, max 500 characters

PUT /admin/tenants/:id

Update tenant.

Request:

curl -X PUT http://localhost:3007/admin/tenants/my-tenant \
-H "Content-Type: application/json" \
-H "X-API-KEY: your-internal-key" \
-d '{
"name": "Updated Name",
"description": "Updated description"
}'

DELETE /admin/tenants/:id

Delete tenant.

Request:

curl -X DELETE http://localhost:3007/admin/tenants/my-tenant \
-H "X-API-KEY: your-internal-key"

Response:

{
"success": true,
"message": "Tenant deleted successfully"
}

Data Model

Tenant

{
"id": "my-tenant",
"consumerId": "apideck-consumer-id",
"name": "My Organization",
"description": "My organization tenant",
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z"
}

Error Responses

400 Bad Request - Validation error

{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid tenant ID format"
}
}

404 Not Found - Tenant not found

{
"success": false,
"error": {
"code": "TENANT_NOT_FOUND",
"message": "Tenant 'my-tenant' not found"
}
}

409 Conflict - Tenant already exists

{
"success": false,
"error": {
"code": "TENANT_EXISTS",
"message": "Tenant with ID 'my-tenant' already exists"
}
}

Connection Management

ConstellationAPI automatically manages connections per tenant:

  • Connections are cached in Redis with key: constellation:connection:{tenant_id}:{type}:{hash}
  • Cache TTL: 24 hours
  • Each tenant has isolated connections
  • Connections are reused across requests for better performance

See Connection Management Guide for detailed information.