Subscriptions
Delete a Plan
Delete an unused plan from your account. DynTube marks the matching account-scoped plan as deleted and returns an empty response when the operation succeeds.
DELETE https://api.dyntube.com/v1/plans?id={planId}
Headers
| Name | Type | Description |
|---|---|---|
| Authorization | String | Bearer YOUR_API_KEY |
Query Parameters
| Name | Type | Description |
|---|---|---|
| id | String | Plan ID |
200: OK with an empty body
Plans with existing assignments
A plan that has been used in a transaction or member subscription should be archived instead. This preserves the plan record for existing access history while removing it from active use.
Code Samples
C\#
csharp
using System;
using System.Net.Http;
class Program
{
static async System.Threading.Tasks.Task Main(string[] args)
{
string planId = "your_plan_id";
string url = $"https://api.dyntube.com/v1/plans?id={planId}";
using (var httpClient = new HttpClient())
{
httpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", "YOUR_API_KEY");
var response = await httpClient.DeleteAsync(url);
if (response.IsSuccessStatusCode)
{
Console.WriteLine("Plan deleted successfully.");
}
else
{
Console.WriteLine($"Failed to delete plan. Status code: {response.StatusCode}");
}
}
}
}Node.js
javascript
const https = require('https');
const planId = 'your_plan_id';
const url = `https://api.dyntube.com/v1/plans?id=${planId}`;
const options = {
method: 'DELETE',
headers: { Authorization: 'Bearer YOUR_API_KEY' }
};
const req = https.request(url, options, (res) => {
if (res.statusCode === 200) {
console.log('Plan deleted successfully.');
} else {
console.log(`Failed to delete plan. Status code: ${res.statusCode}`);
}
});
req.end();Python
python
import requests
plan_id = "your_plan_id"
url = f"https://api.dyntube.com/v1/plans?id={plan_id}"
response = requests.delete(url, headers={"Authorization": "Bearer YOUR_API_KEY"})
if response.status_code == 200:
print("Plan deleted successfully.")
else:
print(f"Failed to delete plan. Status code: {response.status_code}")PHP
php
<?php
$planId = 'your_plan_id';
$url = "https://api.dyntube.com/v1/plans?id=$planId";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_API_KEY']);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
if ($httpCode === 200) {
echo 'Plan deleted successfully.';
} else {
echo "Failed to delete plan. Status code: $httpCode";
}
curl_close($ch);Related Pages
- Get plans to verify the plan ID before deleting.
- Get member's plans to check whether members are still assigned to the plan.
- Manage member plan lifecycle if member access should be canceled instead of deleting a plan.
Something missing or wrong here? Tell us and we will correct it. New to DynTube? Start with uploading and embedding.