Vatly
Api Reference

Subscriptions

On this page, we'll dive into the different subscription endpoints you can use to manage subscriptions programmatically.

The Subscription API Resource

The subscription model contains all the information about recurring billing relationships with customers.

Properties

NameTypeDescription
idstringUnique identifier for the subscription (starts with sub_).
resourcestringThe resource type. Always subscription.
customerIdstringID of the customer who owns this subscription.
testmodebooleanWhether this resource is in test mode.
namestringThe name for the subscription (from the plan).
descriptionstringThe description for the subscription.
billingAddressobjectThe customer billing address for the subscription. Includes fullName, companyName, vatNumber, streetAndNumber, streetAdditional, city, region, postalCode, and country.
basePriceMoneyThe base price per billing cycle before taxes. A Money object with value (decimal string) and currency (ISO 4217 code).
quantityintegerThe quantity for the subscription (e.g., number of seats).
intervalstringThe billing interval. Can be day, week, month, or year.
intervalCountintegerThe interval count, e.g., "3" for charging every 3 months.
statusstringThe status for the subscription. Can be created, trial, active, canceled, on_grace_period, or paused.
startedAtstring | nullWhen the subscription started (ISO 8601 format).
endedAtstring | nullWhen the subscription ended (ISO 8601 format). Null if the subscription is still active.
cancelledAtstring | nullWhen the subscription was cancelled (ISO 8601 format). Null if not cancelled.
renewedAtstring | nullWhen the subscription was last renewed (ISO 8601 format).
renewedUntilstring | nullCurrent billing period end date (ISO 8601 format).
nextRenewalAtstring | nullWhen the next renewal will be attempted (ISO 8601 format). Null if subscription is canceled or ended.
trialUntilstring | nullWhen the trial period ends (ISO 8601 format). Null if not in trial or trial has ended.
linksobjectHATEOAS links to related resources. Contains self and customer links.

List all subscriptions

GET /v1/subscriptions

This endpoint allows you to retrieve a paginated list of all subscriptions across your account.

Optional attributes

NameTypeDescription
limitintegerThe number of subscriptions to return (default: 10, max: 100).
startingAfterstringA cursor for use in pagination. Returns results after this subscription ID.
endingBeforestringA cursor for use in pagination. Returns results before this subscription ID.
curl -G https://api.vatly.com/v1/subscriptions \
  -H "Authorization: Bearer live_your_api_key_here" \
  -d limit=10

Get a subscription

GET /v1/subscriptions/:id

This endpoint allows you to retrieve a specific subscription by its ID.

Parameters

NameTypeDescription
subscriptionIdstringThe unique identifier of the subscription.
curl https://api.vatly.com/v1/subscriptions/sub_abc123def456 \
  -H "Authorization: Bearer live_your_api_key_here"

List customer subscriptions

GET /v1/customers/:customerId/subscriptions

This endpoint allows you to retrieve a paginated list of all subscriptions for a specific customer.

Parameters

NameTypeDescription
customerIdstringThe unique identifier of the customer.
limitintegerThe number of subscriptions to return (default: 10, max: 100).
startingAfterstringA cursor for use in pagination. Returns results after this subscription ID.
endingBeforestringA cursor for use in pagination. Returns results before this subscription ID.
curl -G https://api.vatly.com/v1/customers/cus_xyz789/subscriptions \
  -H "Authorization: Bearer live_your_api_key_here" \
  -d limit=10

Get a customer subscription

GET /v1/customers/:customerId/subscriptions/:subscriptionId

This endpoint allows you to retrieve a specific subscription for a specific customer.

Parameters

NameTypeDescription
customerIdstringThe unique identifier of the customer.
subscriptionIdstringThe unique identifier of the subscription.
curl https://api.vatly.com/v1/customers/cus_xyz789/subscriptions/sub_abc123def456 \
  -H "Authorization: Bearer live_your_api_key_here"

Update a subscription

PATCH /v1/subscriptions/:id

This endpoint allows you to update a subscription. You can change the plan, quantity, or apply proration settings.

Optional attributes

At least one of subscriptionPlanId or quantity must be provided.

NameTypeDescription
subscriptionPlanIdstringThe ID of the subscription plan to update to (starts with plan_). Must match the testmode of the current subscription.
quantityintegerThe new quantity for the subscription. Must be at least 1.
proratebooleanWhether to prorate charges for the partial billing period. If true, the customer is credited for unused time on the old plan and charged for remaining time on the new plan. Default: true.
applyImmediatelybooleanWhether to apply changes immediately or at the end of the current billing period. Default: false.
invoiceImmediatelybooleanWhether to generate an invoice immediately for proration. Only applies when applyImmediately and prorate are both true. Default: false.
anchordateReset the billing anchor to this date. Cannot be combined with trialUntil.
trialUntilstringExtend or set a trial period until this date (ISO 8601 format). Cannot be combined with anchor.
curl -X PATCH https://api.vatly.com/v1/subscriptions/sub_abc123def456 \
  -H "Authorization: Bearer live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "subscriptionPlanId": "plan_yearly123",
    "quantity": 3,
    "prorate": true,
    "applyImmediately": true
  }'

Update subscription billing details

PATCH /v1/subscriptions/:id/update-billing

This endpoint initiates a hosted flow for updating subscription billing details. It returns a URL where the customer can update their billing address, VAT number, and other invoice details.

Required attributes

NameTypeDescription
redirectUrlSuccessstringURL to redirect after successful billing update.
redirectUrlCanceledstringURL to redirect if customer cancels the update.

Optional attributes

NameTypeDescription
billingAddressobjectPre-fill billing address fields. Customer can modify these values in the hosted form.
curl -X PATCH https://api.vatly.com/v1/subscriptions/sub_abc123def456/update-billing \
  -H "Authorization: Bearer live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "redirectUrlSuccess": "https://example.com/billing-updated",
    "redirectUrlCanceled": "https://example.com/billing-canceled",
    "billingAddress": {
      "country": "NL",
      "streetAndNumber": "456 New St",
      "city": "Amsterdam",
      "postalCode": "1012AB"
    }
  }'

Cancel a subscription

DELETE /v1/subscriptions/:id

This endpoint allows you to cancel a subscription. By default, the subscription will remain active until the end of the current billing period (grace period), after which it will be fully canceled. Set immediately=true to cancel immediately.

Optional query parameters

NameTypeDescription
immediatelybooleanCancel immediately instead of at period end. Default: false.
curl -X DELETE https://api.vatly.com/v1/subscriptions/sub_abc123def456 \
  -H "Authorization: Bearer live_your_api_key_here"

Returns 204 No Content on success.

Copyright © 2026