Subscriptions

Subscriptions

Use the Subscriptions API to manage video monetization with plans and members for pay-per-view or subscription-based access.

Base URL

example
https://api.dyntube.com/v1

Available Endpoints

Plans

Method / Endpoint / Description
MethodEndpointDescription
POST/plansCreate a new plan
GET/plansGet list of plans
DELETE/plans?id={planId}Delete an unused plan

Members

Method / Endpoint / Description
MethodEndpointDescription
POST/membersCreate a new member
GET/membersGet list of members
GET/members/{id}Get one member
GET/members/{id}/activityGet member activity
GET/member-plansList member-plan assignments
POST/member-plansAttach a plan to a member

Member plan lifecycle

Use /member-plans/{id} to inspect an assignment, then use its pause, resume, cancel-now, or cancel-at-period-end action when access needs to change.

Plan Types

Type / Value / Description
TypeValueDescription
Purchase1One-time purchase access
Rental3Time-limited rental access

Quick Example

javascript
// Create a subscription plan
const response = await fetch('https://api.dyntube.com/v1/plans', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'Premium Access',
    description: 'Access to all premium videos',
    type: 3, // Rental
    frequency: {
      interval: 1,
      count: 30 // 30 days
    },
    videoKeys: ['vid_abc123'],
    status: 1
  })
});

const plan = await response.json();
console.log('Plan created:', plan.id);
  • Create a plan that identifies the videos or channels included in the offer.
  • Create a member for the viewer who should receive protected access.
  • Attach the plan to the member and retain the returned member-plan ID.
  • Read the member plan when checking its current access and lifecycle state.

Something missing or wrong here? Tell us and we will correct it. New to DynTube? Start with uploading and embedding.