Playground/Resources/Subscription
💼

subscriptions

Recurring subscription plan for a user or customer. Tracks subscription details, pricing, billing cycle, status, renewal settings, and trial period information.

🎯 Request Builder

https://api.mockly.codes/subscriptions?page=1&limit=10&count=10
📡

Configure your request and click Send Request to see the response here.

Endpoints

GET/subscriptions

Get a collection of subscriptions

Alternative: /business/subscriptions
GET/subscriptions/:id

Get a single subscription by ID

Alternative: /business/subscriptions/:id
GET/subscriptions/meta

Get resource metadata and schema

Alternative: /business/subscriptions/meta
🔍

How to Use Search

The search feature allows you to filter results by searching for text across all or specific fields. Choose between ?q= or ?search= parameter names.

1. Basic Search

Search across all text fields:

Basic Search
GET https://api.mockly.codes/subscriptions?q=laptop

2. Search Specific Fields

Field-Specific Search
GET https://api.mockly.codes/subscriptions?q=laptop&search_fields=name,description

💡 Pro Tips

  • Search is case-insensitive and performs partial matching
  • Without search_fields, all text fields are searched
  • Combine with pagination to handle large result sets efficiently

Code Examples

JavaScript

Fetch Collection
// Get 10 subscriptions
fetch('https://api.mockly.codes/subscriptions?count=10')
  .then(res => res.json())
  .then(data => console.log(data));

Python

Fetch with Requests
import requests

response = requests.get(
    'https://api.mockly.codes/subscriptions?count=10'
)
data = response.json()

cURL

Command Line
curl "https://api.mockly.codes/subscriptions?count=10"

Bypass Cache

Get Fresh Data
fetch('https://api.mockly.codes/subscriptions?nocache=true')

Schema Properties

idinteger

Unique identifier for the subscription record

Gen:random_int
user_idinteger

Foreign key reference to the user or customer who owns this subscription

Gen:random_int
planstring

Subscription plan name or tier (e.g., Basic, Pro, Enterprise, Premium)

Gen:subscription_plan
statusstring

Current subscription status (e.g., active, cancelled, expired, suspended, trial)

Gen:subscription_status
pricenumber

Recurring subscription price per billing cycle

Gen:price
currencystring

ISO currency code for the subscription price (e.g., USD, EUR, GBP)

Gen:currency
billing_cyclestring

Frequency of billing (e.g., monthly, quarterly, annually, weekly)

Gen:billing_cycle
start_datestring

Date when the subscription became active

Gen:past_datedate
end_datestring

Date when the subscription expires or is scheduled to end

Gen:future_datedate
next_billing_datestring

Date of the next scheduled billing or renewal charge

Gen:future_datedate
auto_renewboolean

Whether the subscription automatically renews at the end of the billing cycle

Gen:boolean
trial_ends_atstring

Date when a trial period ends and regular billing begins, if applicable

Gen:future_datedate

Query Parameters

countinteger

Number of items to return (default: 10, max: 100)

seedinteger

Seed for reproducible data generation

nocacheboolean

Bypass cache and generate fresh data on every request