Subscriptions
Get Member's Plans
Get a List of Member's plans
Get a list of plans for a member. Use optional query parameters to filter or sort the result. Responses include lifecycle fields used for cancellations and pauses.
GET https://api.dyntube.com/v1/member-plans
Headers
| Name | Type | Description |
|---|---|---|
| Authorization | String | Bearer YOUR_API_KEY |
Query Parameters
| Name | Type | Description |
|---|---|---|
| page | Integer | Page number |
| size | Integer | Page size |
| planType | Integer | Type of the plan |
| sort | String | Sort order of the results. See details below. |
| memberId | String | ID of a particular member |
| status | Integer | Plan status (0=NA, 1=Active, 2=Canceled, 3=Paused) |
| cancelAtPeriodEnd | Boolean | Filter plans scheduled to cancel at period end |
200: OK returns a list of member-plan assignments and a pager.
json
{
"pager": {
"page": 1,
"totalPages": 1,
"totalResults": 1,
"sort": "Created:-1"
},
"plans": [
{
"id": "o8ycm3A",
"name": " Access To Channel",
"storePlanType": 1,
"planId": "ggovA",
"memberId": "gDbyQtqg",
"status": 1,
"cancelAt": "2025-12-15T12:57:07.067Z",
"cancelAtPeriodEnd": true,
"currentPeriodStart": "2025-12-05T12:57:07.067Z",
"currentPeriodEnd": "2025-12-15T12:57:07.067Z",
"created": "2022-10-29T03:40:05.0137275+00:00",
"updated": "2022-10-29T03:40:05.0232359+00:00"
}
]
}Error Responses
| Status Code | Description |
|---|---|
| 400 | Bad Request - Invalid query parameters |
| 401 | Unauthorized - Invalid or missing API key |
Sorting of results
Use the sort query parameter to order results. The format is field:1 for ascending order or field:-1 for descending order.
yaml
# Here are examples to sort by "Created" date.
#Sort by date created descending:
https://api.dyntube.com/v1/member-plans?sort=Created:-1
#Sort by date created ascending:
https://api.dyntube.com/v1/member-plans?sort=Created:1Code Samples
C\#
csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json;
class Program
{
static async Task Main(string[] args)
{
string url = "https://api.dyntube.com/v1/member-plans?sort=Created:-1";
using (var httpClient = new HttpClient())
{
httpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", "YOUR_API_KEY");
var response = await httpClient.GetAsync(url);
if (response.IsSuccessStatusCode)
{
var content = await response.Content.ReadAsStringAsync();
var data = JsonConvert.DeserializeObject<MemberPlans>(content);
foreach (var plan in data.Plans)
{
Console.WriteLine("Plan ID: {0}", plan.Id);
Console.WriteLine("Name: {0}", plan.Name);
Console.WriteLine("Store Plan Type: {0}", plan.StorePlanType);
Console.WriteLine("Plan ID: {0}", plan.PlanId);
Console.WriteLine("Member ID: {0}", plan.MemberId);
Console.WriteLine("Status: {0}", plan.Status);
Console.WriteLine("Created: {0}", plan.Created);
Console.WriteLine("Updated: {0}", plan.Updated);
Console.WriteLine();
}
}
else
{
Console.WriteLine($"Failed to get member's plans. Status code: {response.StatusCode}");
}
}
}
}
class MemberPlans
{
public Pager Pager { get; set; }
public Plan[] Plans { get; set; }
}
class Pager
{
public int Page { get; set; }
public int TotalPages { get; set; }
public int TotalResults { get; set; }
public string Sort { get; set; }
}
class Plan
{
public string Id { get; set; }
public string Name { get; set; }
public int StorePlanType { get; set; }
public string PlanId { get; set; }
public string MemberId { get; set; }
public int Status { get; set; }
public string Created { get; set; }
public string Updated { get; set; }
}Node.js
javascript
const axios = require('axios');
const memberId = 'memberId1';
const apiUrl = `https://api.dyntube.com/v1/member-plans?memberId=${memberId}&sort=Created:-1`;
axios.get(apiUrl, { headers: { Authorization: 'Bearer YOUR_API_KEY' } })
.then(response => {
console.log(response.data);
})
.catch(error => {
console.log(error);
});Python
python
import requests
member_id = 'memberId1'
api_url = f'https://api.dyntube.com/v1/member-plans?memberId={member_id}&sort=Created:-1'
response = requests.get(api_url, headers={'Authorization': 'Bearer YOUR_API_KEY'})
if response.status_code == 200:
print(response.json())
else:
print(f'Error getting member plans: {response.status_code}')PHP
php
<?php
$memberId = 'meemberId1';
$url = "https://api.dyntube.com/v1/member-plans?memberId={$memberId}&sort=Created:-1";
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer YOUR_API_KEY'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;Related Pages
- Attach plan to member to assign a new plan.
- Get a member plan to inspect one assignment.
- Manage member plan lifecycle to pause, resume, or cancel a plan assignment.
Something missing or wrong here? Tell us and we will correct it. New to DynTube? Start with uploading and embedding.