Subscription CRUD
Subscription API payloads use camelCase. Server-managed fields are returned in responses but rejected in write requests.Operation semantics
| Operation | Use when | Risk | Confirmation |
|---|---|---|---|
GET /api/v1/subscriptions | Search, summarize, analyze, or identify subscriptions | Low | Not required |
GET /api/v1/subscriptions/{id} | Fetch one known record by UUID | Low | Not required |
POST /api/v1/subscriptions | Record a new subscription | Medium | Required for AI agents |
PATCH /api/v1/subscriptions/{id} | Change writable fields, including status (cancel/pause/resume) | Medium–High | Required for AI agents |
DELETE /api/v1/subscriptions/{id} | Permanently remove a tracked record (prefer cancel to keep history) | High | Required for AI agents |
write scope; read-only keys receive 403 insufficient_scope.
Pagination
GET /api/v1/subscriptions returns results newest first and accepts two optional query parameters:
| Parameter | Default | Rule |
|---|---|---|
limit | 50 | Page size, 1 to 100 |
offset | 0 | Number of records to skip from the start |
pagination object. Fetch the next page with offset + limit while hasMore is true.
400 invalid_pagination.
Filtering and sorting
GET /api/v1/subscriptions accepts optional filters and a sort order alongside pagination:
| Parameter | Rule |
|---|---|
status | One of active, paused, cancelled |
category | Exact category match, e.g. Streaming |
period | One of monthly, yearly, custom |
q | Case-insensitive search over the subscription name |
expiringBefore | YYYY-MM-DD; returns records whose nextPaymentDate is on or before this date |
sort | One of createdAt, -createdAt, nextPaymentDate, -nextPaymentDate, amount, -amount, name, -name (default -createdAt; - prefix is descending) |
status=active with expiringBefore to answer “what renews soon”. Invalid values return 400 invalid_query with a field and suggestedFix.
Subscription object
Writable fields
idnextPaymentDatecreatedAtupdatedAt
POST or PATCH requests.
Field rules
| Field | Rule |
|---|---|
name | Required, 1-120 characters |
category | Required, 1-80 characters |
amount | Required number, 0 to 999999.99, max 2 decimals |
currency | Required. One of CNY, USD, EUR, JPY, GBP, AUD, CAD, CHF, HKD, SGD |
period | Required. One of monthly, yearly, custom |
lastPaymentDate | Required date in YYYY-MM-DD format |
customDate | Required only when period is custom; positive whole-number string of days |
notificationEnabled | Optional boolean, defaults to true |
status | Optional. One of active, paused, cancelled; defaults to active |
nextPaymentDate is calculated by the server from lastPaymentDate, period, and customDate. On PATCH, it is recalculated only when one of those three fields changes; updating any other field leaves the stored nextPaymentDate untouched. Only the fields you send in a PATCH are validated, so updating one field never fails because of unrelated stored data.
Lifecycle: cancel, pause, resume vs delete
A subscription has astatus: active (billing), paused (temporarily stopped), or cancelled (no longer billing, kept for history). Changing status is a soft operation — the record and its audit history survive and can be reactivated. DELETE is permanent and removes the record and its audit history.
Prefer a status change when the user says they stopped using a service but might come back:
active subscriptions count toward active spend in the analytics endpoints. Use DELETE only when the user wants the record gone permanently.
Natural language examples
Add a subscription
User intent:Change billing period
User intent:- Call
GET /api/v1/subscriptionsto identify the Netflix record. - Ask the user to confirm the exact record and change.
- Call
PATCH /api/v1/subscriptions/{id}.
Remove a duplicate
User intent:- Call
GET /api/v1/subscriptionsand find duplicate candidates. - Ask the user to confirm the exact subscription name and id.
- Call
DELETE /api/v1/subscriptions/{id}.
Custom billing period
For non-monthly/non-yearly intervals, setperiod to custom and send customDate as a positive whole-number string of days.
custom back to monthly or yearly, omit customDate. The server clears stale custom billing data.