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 Name | Type | Required | Description | Example Value |
---|---|---|---|---|
clientId | String | Yes | The unique identifier of the client associated with the channel. | "60d5ec49f7b1c4b4a1c5d6e0" |
name | String | Yes | The name of the channel. | "My Awesome Channel" |
username | String | Yes | The unique username for the channel. | "awesome_channel" |
avatarUrl | String | Yes | URL to the channel's profile image. | "https://example.com/avatar.jpg" |
role | String | Yes | The role of the channel (for example, "creator" , "admin" ). | "creator" |
projectIds | List<String> | No | A list of project identifiers (ObjectId strings) associated with the channel. | ["60d5ec49f7b1c4b4a1c5d6e1", "60d5ec49f7b1c4b4a1c5d6e2"] |
membershipsEnabled | bool | No | Whether memberships are enabled for the channel. Default: false . | true |
membershipTiers | List<Object> | No | A list of membership tiers. Each object in the list contains details about a membership tier. | [{"name": "Bronze", "price": 5.0}] |
monetizationEnabled | bool | No | Whether monetization is enabled for the channel. Default: false . | true |
revenue | double | No | The 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 Name | Type | Description | Example Value |
---|---|---|---|
name | String | The new name of the channel. | "Updated Channel Name" |
username | String | The new username. | "new_channel_username" |
avatarUrl | String | New URL for the profile image. | "https://example.com/new_avatar.jpg" |
role | String | Updated role. | "moderator" |
projectIds | List<String> | Updated list of project identifiers (ObjectId strings). | ["60d5ec49f7b1c4b4a1c5d6e4"] |
membershipsEnabled | bool | Whether memberships are enabled. | false |
membershipTiers | List<Object> | Updated list of membership tiers. | [{"name": "Gold", "price": 20.0}] |
monetizationEnabled | bool | Whether monetization is enabled. | false |
revenue | double | Updated 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.