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.

Status vs delete

Responses include a read-only status (active, paused, or cancelled), and list queries may filter by it. The public API does not cancel, pause, or resume subscriptions by writing status. Use DELETE when the user wants the tracked record removed. Only active subscriptions count toward active spend in the analytics endpoints.

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.