Skip to main content

Subscription CRUD

Subscription API payloads use camelCase. Server-managed fields are returned in responses but rejected in write requests.

Operation semantics

For AI integrations, list subscriptions before updating or deleting unless the user already supplied a subscription UUID. Write operations require an API key with the write scope; read-only keys receive 403 insufficient_scope.

Pagination

GET /api/v1/subscriptions returns results newest first and accepts two optional query parameters: The response includes a pagination object. Fetch the next page with offset + limit while hasMore is true.
Out-of-range values return 400 invalid_pagination.

Filtering and sorting

GET /api/v1/subscriptions accepts optional filters and a sort order alongside pagination: Combine status=active with expiringBefore to answer “what renews soon”. Invalid values return 400 invalid_query with a field and suggestedFix.
The response echoes the applied query so an agent can confirm what produced the result:

Subscription object

Writable fields

The server manages:
  • id
  • createdAt
  • updatedAt
Do not send server-managed fields in POST or PATCH requests.

Field rules

nextPaymentDate is the authoritative schedule date. For monthly billing, billingAnchorDay preserves the original calendar day across short months: January 31 → February 28/29 → March 31. If a charge repeats every 30 days rather than on a fixed day of each month, use period: "custom" with customDate: "30". lastPaymentDate remains in responses as a derived compatibility field and should not be used for new integrations.

Lifecycle: cancel, pause, resume vs delete

A subscription has a status: 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:
Only 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:
API call:

Change billing period

User intent:
Agent flow:
  1. Call GET /api/v1/subscriptions to identify the Netflix record.
  2. Ask the user to confirm the exact record and change.
  3. Call PATCH /api/v1/subscriptions/{id}.

Remove a duplicate

User intent:
Agent flow:
  1. Call GET /api/v1/subscriptions and find duplicate candidates.
  2. Ask the user to confirm the exact subscription name and id.
  3. Call DELETE /api/v1/subscriptions/{id}.

Custom billing period

For non-monthly/non-yearly intervals, set period to custom and send customDate as a positive whole-number string of days.
For a fixed 30-day interval, set customDate to "30"; do not use monthly. When patching from custom back to monthly or yearly, omit customDate. The server clears stale custom billing data.

AI tool schema

Use ai-tools.json for tool/function definitions, risk levels, and confirmation prompts.