Get subscriptions list

Retrieves a paginated list of subscriptions with filtering options

📘

API Refs

Request parameters

NameTypeDescriptionRequired
limitnumberMaximum number of subscriptions to return (default: 20, max: 100)no
starting_afterstringCursor for pagination - ID of the last subscription from previous pageno
statusstringFilter by subscription status (see enum values below)no
customer_idstringFilter by Stripe customer ID (must start with "cus_")no

Status Filter Values

  • incomplete
  • incomplete_expired
  • trialing
  • active
  • past_due
  • canceled
  • unpaid
  • paused
  • unpaid_paused

Response body

Success Response (200 OK)

FieldTypeDescription
dataarrayList of subscription objects
paginationobjectPagination information

Subscription Object Structure

FieldTypeDescription
idstringSubscription ID
statusstringCurrent subscription status
customerobjectCustomer information
planobjectPlan information
currentPeriodStartstringCurrent billing period start (ISO 8601)
currentPeriodEndstringCurrent billing period end (ISO 8601)
createdAtstringSubscription creation date (ISO 8601)

Customer Object Structure

FieldTypeDescription
stripeCustomerIdstringStripe customer ID
emailstringCustomer email
namestringCustomer name

Plan Object Structure

FieldTypeDescription
stripePriceIdstringStripe price ID
namestringPlan name
amountnumberPlan amount in cents
currencystringCurrency code
intervalstringBilling interval
intervalCountnumberBilling interval count

Pagination Object Structure

FieldTypeDescription
limitnumberApplied limit per page
hasMorebooleanWhether more results are available
nextCursorstringCursor for next page (if hasMore is true)

Response

{
  "data": [
    {
      "id": "sub_ExampleSubscription789",
      "status": "active",
      "customer": {
        "stripeCustomerId": "cus_ExampleCustomerID123",
        "email": "[email protected]",
        "name": "John Doe"
      },
      "plan": {
        "stripePriceId": "price_ExamplePriceID456",
        "name": "Premium Auto Insurance",
        "amount": 4999,
        "currency": "usd",
        "interval": "month",
        "intervalCount": 1
      },
      "currentPeriodStart": "2024-01-01T00:00:00.000Z",
      "currentPeriodEnd": "2024-02-01T00:00:00.000Z",
      "createdAt": "2024-01-01T00:00:00.000Z"
    }
  ],
  "pagination": {
    "limit": 10,
    "hasMore": true,
    "nextCursor": "sub_ExampleSubscription789"
  }
}

Pagination Usage

To retrieve the next page of results, use the nextCursor value from the pagination object as the starting_after parameter:

GET /api/public/subscriptions?limit=10&starting_after=sub_ExampleSubscription789

Error Responses

  • 400 Bad Request: Invalid pagination parameters or filter values
  • 401 Unauthorized: Invalid or missing authorization token
  • 403 Forbidden: Insufficient permissions

Notes

  1. Default Limit: If not specified, the API returns 20 subscriptions per page
  2. Maximum Limit: You cannot retrieve more than 100 subscriptions in a single request
  3. Cursor-based Pagination: Uses cursor-based pagination for consistent results
  4. Filtering: Multiple filters can be combined (e.g., filter by both status and customer_id)
  5. Sorting: Results are returned in descending order by creation date