Skip to main content

Channels

Overview

This document details the API endpoints for managing channels, allowing for the creation, retrieval, updating, and deletion of channel objects within the system. Channels are not a replacment or duplicate of users but rather an extention to the user data with a focus on content.

Endpoints

1. Create a Channel

POST /channels

Description

Creates a new channel in the database.

Headers

{
"Accept": "application/json",
"Content-Type": "application/json"
}

Request Body

Field NameTypeRequiredDescriptionExample Value
clientIdStringYesThe unique identifier of the client associated with the channel."60d5ec49f7b1c4b4a1c5d6e0"
nameStringYesThe name of the channel."My Awesome Channel"
usernameStringYesThe unique username for the channel."awesome_channel"
avatarUrlStringYesURL to the channel's profile image."https://example.com/avatar.jpg"
roleStringYesThe role of the channel (for example, "creator", "admin")."creator"
projectIdsList<String>NoA list of project identifiers (ObjectId strings) associated with the channel.["60d5ec49f7b1c4b4a1c5d6e1", "60d5ec49f7b1c4b4a1c5d6e2"]
membershipsEnabledboolNoWhether memberships are enabled for the channel. Default: false.true
membershipTiersList<Object>NoA list of membership tiers. Each object in the list contains details about a membership tier.[{"name": "Bronze", "price": 5.0}]
monetizationEnabledboolNoWhether monetization is enabled for the channel. Default: false.true
revenuedoubleNoThe current total revenue of the channel. Default: 0.0.1234.56
{
"clientId": "60d5ec49f7b1c4b4a1c5d6e0",
"name": "My Awesome Channel",
"username": "awesome_channel",
"avatarUrl": "https://example.com/avatar.jpg",
"role": "creator",
"projectIds": [],
"membershipsEnabled": true,
"membershipTiers": [
{
"name": "Basic",
"description": "Access to basic content",
"price": 5.0,
"features": ["exclusive posts"]
},
{
"name": "Premium",
"description": "Access to all content",
"price": 15.0,
"features": ["exclusive posts", "early access"]
}
],
"monetizationEnabled": true,
"revenue": 0.0
}

Success Response (Status: 200 OK)

{
"message": "Channel created successfully"
}

Error Responses

  • 500 Internal Server Error: An unexpected server-side error occurred.

2. Get All Channels by Client ID

GET /channels/client/{clientId}

Description

Retrieves all channels associated with a specific client ID. Replace {clientId} with the client's unique identifier.

Headers

{
"Accept": "application/json"
}

Request Body

N/A (No request body is required for this endpoint.)

Success Response (Status: 200 OK)

Returns a JSON array of channel objects. Each channel object will include the following fields: _id, clientId, name, username, avatarUrl, role, projectIds, membershipsEnabled, membershipTiers, monetizationEnabled, revenue, createdAt, and updatedAt.

[
{
"_id": "60d5ec49f7b1c4b4a1c5d6e3",
"clientId": "60d5ec49f7b1c4b4a1c5d6e0",
"name": "My Awesome Channel",
"username": "awesome_channel",
"avatarUrl": "https://example.com/avatar.jpg",
"role": "creator",
"projectIds": [],
"membershipsEnabled": true,
"membershipTiers": [
{"name": "Basic", "description": "...", "price": 5.0, "features": ["..."]},
{"name": "Premium", "description": "...", "price": 15.0, "features": ["..."]}
],
"monetizationEnabled": true,
"revenue": 0.0,
"createdAt": "2025-06-05T10:00:00.000Z",
"updatedAt": "2025-06-05T10:00:00.000Z"
}
]

Error Responses

  • 500 Internal Server Error: An unexpected server-side error occurred.

3. Get a Single Channel by ID

GET /channels/{id}

Description

Retrieves a single channel by its unique channel ID. Replace {id} with the unique identifier of the channel.

Headers

{
"Accept": "application/json"
}

Request Body

N/A (No request body is required for this endpoint.)

Success Response (Status: 200 OK)

Returns a single JSON object of a channel (same fields as in "Get All Channels by Client ID").

{
"_id": "60d5ec49f7b1c4b4a1c5d6e3",
"clientId": "60d5ec49f7b1c4b4a1c5d6e0",
"name": "My Awesome Channel",
"username": "awesome_channel",
"avatarUrl": "https://example.com/avatar.jpg",
"role": "creator",
"projectIds": [],
"membershipsEnabled": true,
"membershipTiers": [
{"name": "Basic", "description": "...", "price": 5.0, "features": ["..."]},
{"name": "Premium", "description": "...", "price": 15.0, "features": ["..."]}
],
"monetizationEnabled": true,
"revenue": 0.0,
"createdAt": "2025-06-05T10:00:00.000Z",
"updatedAt": "2025-06-05T10:00:00.000Z"
}

Error Responses

  • 404 Not Found: Channel not found.
  • 500 Internal Server Error: An unexpected server-side error occurred.

4. Update an Existing Channel

PUT /channels/{id}

Description

Updates an existing channel in the database by its identifier. Replace {id} with the unique identifier of the channel to update.

Headers

{
"Accept": "application/json",
"Content-Type": "application/json"
}

Request Body

A JSON object containing the fields to update. All fields are optional.

Field NameTypeDescriptionExample Value
nameStringThe new name of the channel."Updated Channel Name"
usernameStringThe new username."new_channel_username"
avatarUrlStringNew URL for the profile image."https://example.com/new_avatar.jpg"
roleStringUpdated role."moderator"
projectIdsList<String>Updated list of project identifiers (ObjectId strings).["60d5ec49f7b1c4b4a1c5d6e4"]
membershipsEnabledboolWhether memberships are enabled.false
membershipTiersList<Object>Updated list of membership tiers.[{"name": "Gold", "price": 20.0}]
monetizationEnabledboolWhether monetization is enabled.false
revenuedoubleUpdated total revenue.1500.75
{
"name": "My Renamed Channel",
"membershipsEnabled": false,
"revenue": 1500.00
}

Success Response (Status: 200 OK)

{
"message": "Channel updated successfully"
}

Error Responses

  • 404 Not Found: Channel not found or not updated.
  • 500 Internal Server Error: An unexpected server-side error occurred.

5. Delete a Channel

DELETE /channels/{id}

Description

Deletes a channel from the database by its identifier. Replace {id} with the unique identifier of the channel to delete.

Headers

{
"Accept": "application/json",
"Content-Type": "application/json"
}

Request Body

N/A (No request body is required for this endpoint.)

Success Response (Status: 200 OK)

{
"message": "Channel deleted successfully"
}

Error Responses

  • 404 Not Found: Channel not found.
  • 500 Internal Server Error: An unexpected server-side error occurred.