Subscriptions API
Base path: /api/subscriptions
GET /api/subscriptions
List all subscriptions.
Response 200:
[ { "id": "sub_abc123", "name": "Acme Corp", "productId": "prod_xyz", "apiKey": "ltg_live_xxxxxxxxxxxxxxxx", "plan": "professional", "scope": "write", "rateLimit": 100, "callLimit": 10000, "callCount": 1523, "callCountToday": 42, "callCountResetDate": "2024-01-16T00:00:00.000Z", "status": "active", "notes": "Main integration account", "packageIds": ["pkg_tickets_read"], "createdAt": "2024-01-15T10:00:00.000Z" }]GET /api/subscriptions/:id
Get a single subscription.
POST /api/subscriptions
Create a subscription and issue an API key.
Request body:
{ "name": "Acme Corp", "productId": "prod_xyz", "plan": "professional", "scope": "write", "notes": "Main integration"}| Field | Type | Required | Default |
|---|---|---|---|
name |
string | Yes | — |
productId |
string | Yes | — |
plan |
"free" | "professional" | "enterprise" |
No | "free" |
scope |
"read" | "write" | "admin" |
No | Plan default |
rateLimit |
number | No | Plan default |
callLimit |
number | No | Plan default |
notes |
string | No | "" |
Response 201: Subscription with apiKey field. This is the only time the full key is returned in a list response — copy it immediately.
PUT /api/subscriptions/:id
Update a subscription. All fields optional. Commonly used to:
- Change plan:
{ "plan": "enterprise" } - Change scope:
{ "scope": "admin" } - Override limits:
{ "rateLimit": 50, "callLimit": 500 } - Suspend:
{ "status": "suspended" }
DELETE /api/subscriptions/:id
Revoke a subscription. The API key immediately becomes invalid.
POST /api/subscriptions/:id/regenerate
Issue a new API key and invalidate the old one.
Response 200:
{ "apiKey": "ltg_live_yyyyyyyyyyyyyyyy"}GET /api/subscriptions/:id/usage
Get today’s usage statistics.
Response 200:
{ "callCountToday": 42, "callLimit": 10000, "rateLimit": 100, "remainingToday": 9958, "resetDate": "2024-01-16T00:00:00.000Z"}GET /api/subscriptions/:id/packages
Get the effective permissions for this subscription (union of all assigned packages).
Response 200:
{ "packageIds": ["pkg_tickets_read"], "permissions": [ { "method": "GET", "path": "/api/service/tickets" }, { "method": "GET", "path": "/api/service/tickets/{id}" } ], "customPermissions": []}PUT /api/subscriptions/:id/packages
Assign packages to this subscription.
Request body:
{ "packageIds": ["pkg_tickets_read", "pkg_companies_read"], "customPermissions": []}Pass an empty array to remove all package restrictions.