Skip to content

Admin

All admin endpoints use the base URL /v1 and require the requireAdmin middleware. Requests must include a valid Bearer token belonging to an admin or service_role account.

Authorization: Bearer <admin_or_service_role_token>

GET /v1/admin/users

Returns a cursor-paginated list of users. Supports searching by username, first name, or last name.

Query Parameters:

ParameterTypeDefaultDescription
searchstringOptional. Searches across username, first_name, and last_name.
cursorstringCursor value from a previous response for pagination.
limitinteger20Number of users to return. Maximum 100.

Response 200 OK:

{
"users": [
{
"id": "uuid",
"username": "janedoe",
"first_name": "Jane",
"last_name": "Doe",
"role": "user",
"user_status": "active",
"verified": true,
"type": "creator",
"created_at": "2025-01-15T08:30:00.000Z"
}
],
"next_cursor": "2025-01-10T06:00:00.000Z"
}

When there are no more results, next_cursor is null.


GET /v1/admin/users/{id}

Returns full details for a single user.

Path Parameters:

ParameterTypeRequiredDescription
iduuidYesThe user’s unique ID.

Response 200 OK:

{
"user": {
"id": "uuid",
"username": "janedoe",
"first_name": "Jane",
"last_name": "Doe",
"email": "jane@example.com",
"role": "user",
"user_status": "active",
"verified": true,
"type": "creator",
"created_at": "2025-01-15T08:30:00.000Z",
"updated_at": "2025-06-01T12:00:00.000Z"
}
}

Errors:

StatusDescription
404 Not FoundNo user exists with the given ID.

PATCH /v1/admin/users/{id}

Updates specific fields on a user record. Only the allowed fields listed below are accepted.

Path Parameters:

ParameterTypeRequiredDescription
iduuidYesThe user’s unique ID.

Request Body:

FieldTypeRequiredDescription
rolestringNoThe user’s role (e.g. user, admin).
user_statusstringNoAccount status (e.g. active, suspended, banned).
verifiedbooleanNoWhether the user is verified.
typestringNoUser type (e.g. creator, standard).

Request Example:

{
"role": "admin",
"verified": true
}

Response 200 OK:

{
"user": {
"id": "uuid",
"username": "janedoe",
"role": "admin",
"user_status": "active",
"verified": true,
"type": "creator",
"updated_at": "2025-06-02T10:00:00.000Z"
}
}

Errors:

StatusDescription
404 Not FoundNo user exists with the given ID.

DELETE /v1/admin/users/{id}

Permanently deletes a user from Supabase Auth. This cascades to all related data and is irreversible.

Path Parameters:

ParameterTypeRequiredDescription
iduuidYesThe user’s unique ID.

Response 200 OK:

{
"message": "User deleted"
}

Errors:

StatusDescription
404 Not FoundNo user exists with the given ID.

GET /v1/admin/posts

Returns a list of posts across all users, with basic author information.

Query Parameters:

ParameterTypeDefaultDescription
statusstringOptional. Filter by post status (e.g. published, draft, flagged).
limitinteger20Number of posts to return. Maximum 100.

Response 200 OK:

{
"posts": [
{
"id": "uuid",
"title": "My First Post",
"status": "published",
"created_at": "2025-06-01T12:00:00.000Z",
"author": {
"id": "uuid",
"username": "janedoe"
}
}
]
}

DELETE /v1/admin/posts/{id}

Removes a post. This is typically used for content moderation.

Path Parameters:

ParameterTypeRequiredDescription
iduuidYesThe post’s unique ID.

Response 200 OK:

{
"message": "Post removed"
}

Errors:

StatusDescription
404 Not FoundNo post exists with the given ID.

GET /v1/admin/products

Returns up to 50 products with seller information. The limit is fixed and not configurable.

Response 200 OK:

{
"products": [
{
"id": "uuid",
"title": "Digital Art Pack",
"price": 29.99,
"status": "active",
"created_at": "2025-05-20T14:00:00.000Z",
"seller": {
"id": "uuid",
"username": "alexsmith"
}
}
]
}

DELETE /v1/admin/products/{id}

Removes a product listing.

Path Parameters:

ParameterTypeRequiredDescription
iduuidYesThe product’s unique ID.

Response 200 OK:

{
"message": "Product removed"
}

Errors:

StatusDescription
404 Not FoundNo product exists with the given ID.

GET /v1/admin/reports

Returns reports with reporter information. Can be filtered by resolution status.

Query Parameters:

ParameterTypeDefaultDescription
statusstringOptional. One of: pending, resolved, dismissed.

Response 200 OK:

{
"reports": [
{
"id": "uuid",
"reportable_id": "uuid",
"reportable_type": "post",
"reason": "Spam content",
"description": "This post contains repeated spam links.",
"status": "pending",
"resolved_by": null,
"resolved_at": null,
"created_at": "2025-06-10T08:00:00.000Z",
"reporter": {
"id": "uuid",
"username": "mchen"
}
}
]
}

PATCH /v1/admin/reports/{id}

Updates a report’s status. Automatically sets resolved_by to the authenticated admin’s ID and resolved_at to the current timestamp.

Path Parameters:

ParameterTypeRequiredDescription
iduuidYesThe report’s unique ID.

Request Body:

FieldTypeRequiredDescription
statusstringYesNew status. Must be one of: resolved, dismissed.

Request Example:

{
"status": "resolved"
}

Response 200 OK:

{
"report": {
"id": "uuid",
"reportable_id": "uuid",
"reportable_type": "post",
"reason": "Spam content",
"status": "resolved",
"resolved_by": "admin-uuid",
"resolved_at": "2025-06-11T10:00:00.000Z"
}
}

Errors:

StatusDescription
400 Bad RequestMissing status or invalid value. Must be resolved or dismissed.
404 Not FoundNo report exists with the given ID.

GET /v1/admin/ads

Returns up to 50 ad campaigns with owner information. The limit is fixed and not configurable.

Response 200 OK:

{
"ads": [
{
"id": "uuid",
"title": "Summer Sale Campaign",
"status": "pending",
"budget": 500,
"spent_budget": 120.50,
"views_count": 2410,
"created_at": "2025-06-01T09:00:00.000Z",
"owner": {
"id": "uuid",
"username": "janedoe"
}
}
]
}

PATCH /v1/admin/ads/{id}

Approve or reject an ad campaign.

Path Parameters:

ParameterTypeRequiredDescription
iduuidYesThe ad’s unique ID.

Request Body:

FieldTypeRequiredDescription
statusstringYesNew status. One of: active, rejected.

Request Example:

{
"status": "active"
}

Response 200 OK:

{
"ad": {
"id": "uuid",
"title": "Summer Sale Campaign",
"status": "active",
"updated_at": "2025-06-02T14:00:00.000Z"
}
}

Errors:

StatusDescription
400 Bad RequestInvalid status value. Must be active or rejected.
404 Not FoundNo ad exists with the given ID.

GET /v1/admin/jobs

Returns up to 50 job listings with poster information. The limit is fixed and not configurable.

Response 200 OK:

{
"jobs": [
{
"id": "uuid",
"title": "Senior Frontend Developer",
"status": "pending",
"location": "Remote",
"created_at": "2025-06-05T11:00:00.000Z",
"poster": {
"id": "uuid",
"username": "alexsmith"
}
}
]
}

PATCH /v1/admin/jobs/{id}

Updates any fields on a job listing. All job fields are allowed.

Path Parameters:

ParameterTypeRequiredDescription
iduuidYesThe job’s unique ID.

Request Example:

{
"status": "active",
"title": "Senior Frontend Developer (Updated)"
}

Response 200 OK:

{
"job": {
"id": "uuid",
"title": "Senior Frontend Developer (Updated)",
"status": "active",
"updated_at": "2025-06-06T09:00:00.000Z"
}
}

Errors:

StatusDescription
404 Not FoundNo job exists with the given ID.

GET /v1/admin/categories

Returns all categories ordered alphabetically by name. Supports hierarchical structure via parent_id.

Response 200 OK:

{
"categories": [
{
"id": "uuid",
"name": "Art",
"parent_id": null,
"slug": "art"
},
{
"id": "uuid",
"name": "Digital Art",
"parent_id": "uuid",
"slug": "digital-art"
}
]
}

POST /v1/admin/categories

Creates a new category.

Request Body:

FieldTypeRequiredDescription
namestringYesDisplay name of the category.
parent_iduuidNoID of the parent category for nesting.
slugstringNoURL-friendly slug. Auto-generated from name if omitted.

Request Example:

{
"name": "Digital Art",
"parent_id": "art-category-uuid",
"slug": "digital-art"
}

Response 201 Created:

{
"category": {
"id": "uuid",
"name": "Digital Art",
"parent_id": "art-category-uuid",
"slug": "digital-art"
}
}

Errors:

StatusDescription
400 Bad RequestMissing required name field.

PATCH /v1/admin/categories/{id}

Updates an existing category.

Path Parameters:

ParameterTypeRequiredDescription
iduuidYesThe category’s unique ID.

Request Body:

FieldTypeRequiredDescription
namestringNoUpdated display name.
parent_iduuidNoUpdated parent category ID.
slugstringNoUpdated slug.

Request Example:

{
"name": "Fine Art"
}

Response 200 OK:

{
"category": {
"id": "uuid",
"name": "Fine Art",
"parent_id": null,
"slug": "fine-art"
}
}

Errors:

StatusDescription
404 Not FoundNo category exists with the given ID.

DELETE /v1/admin/categories/{id}

Deletes a category.

Path Parameters:

ParameterTypeRequiredDescription
iduuidYesThe category’s unique ID.

Response 200 OK:

{
"message": "Category deleted"
}

Errors:

StatusDescription
404 Not FoundNo category exists with the given ID.

GET /v1/admin/blacklist

Returns all blacklist entries.

Response 200 OK:

{
"entries": [
{
"id": "uuid",
"type": "email",
"value": "spammer@example.com",
"reason": "Repeated spam violations",
"created_at": "2025-05-01T10:00:00.000Z"
},
{
"id": "uuid",
"type": "ip",
"value": "192.168.1.100",
"reason": null,
"created_at": "2025-05-15T14:30:00.000Z"
}
]
}

POST /v1/admin/blacklist

Adds a new entry to the blacklist.

Request Body:

FieldTypeRequiredDescription
typestringYesType of entry (e.g. email, ip, domain, username).
valuestringYesThe value to blacklist.
reasonstringNoReason for blacklisting.

Request Example:

{
"type": "email",
"value": "spammer@example.com",
"reason": "Repeated spam violations"
}

Response 201 Created:

{
"entry": {
"id": "uuid",
"type": "email",
"value": "spammer@example.com",
"reason": "Repeated spam violations",
"created_at": "2025-06-12T08:00:00.000Z"
}
}

Errors:

StatusDescription
400 Bad RequestMissing required type or value field.

DELETE /v1/admin/blacklist/{id}

Removes an entry from the blacklist.

Path Parameters:

ParameterTypeRequiredDescription
iduuidYesThe blacklist entry’s unique ID.

Response 200 OK:

{
"message": "Blacklist entry deleted"
}

Errors:

StatusDescription
404 Not FoundNo blacklist entry exists with the given ID.

GET /v1/admin/censors

Returns all content filter patterns.

Response 200 OK:

{
"censors": [
{
"id": "uuid",
"pattern": "badword",
"replacement": "****",
"created_at": "2025-04-20T12:00:00.000Z"
},
{
"id": "uuid",
"pattern": "offensive\\s?phrase",
"replacement": "[removed]",
"created_at": "2025-05-10T09:00:00.000Z"
}
]
}

POST /v1/admin/censors

Adds a new content filter pattern.

Request Body:

FieldTypeRequiredDescription
patternstringYesRegex pattern to match against content.
replacementstringNoReplacement text. Defaults to empty string if omitted.

Request Example:

{
"pattern": "badword",
"replacement": "****"
}

Response 201 Created:

{
"censor": {
"id": "uuid",
"pattern": "badword",
"replacement": "****",
"created_at": "2025-06-12T08:30:00.000Z"
}
}

Errors:

StatusDescription
400 Bad RequestMissing required pattern field.

DELETE /v1/admin/censors/{id}

Removes a content filter pattern.

Path Parameters:

ParameterTypeRequiredDescription
iduuidYesThe censor entry’s unique ID.

Response 200 OK:

{
"message": "Censor deleted"
}

Errors:

StatusDescription
404 Not FoundNo censor exists with the given ID.

Creator Verification (Authorship Requests)

Section titled “Creator Verification (Authorship Requests)”
GET /v1/admin/authorship-requests

Returns all creator verification requests with the associated user profile.

Response 200 OK:

{
"authorship_requests": [
{
"id": "uuid",
"user_id": "uuid",
"status": "pending",
"reviewed_by": null,
"reviewed_at": null,
"created_at": "2025-06-01T10:00:00.000Z",
"user": {
"id": "uuid",
"username": "janedoe",
"first_name": "Jane",
"last_name": "Doe",
"avatar_url": "https://cdn.example.com/avatars/janedoe.jpg"
}
}
]
}

PATCH /v1/admin/authorship-requests/{id}

Approves or rejects a creator verification request. Automatically sets reviewed_by to the authenticated admin’s ID and reviewed_at to the current timestamp. If approved, the user’s verified field is set to true.

Path Parameters:

ParameterTypeRequiredDescription
iduuidYesThe authorship request’s unique ID.

Request Body:

FieldTypeRequiredDescription
statusstringYesNew status. Must be one of: approved, rejected.

Request Example:

{
"status": "approved"
}

Response 200 OK:

{
"authorship_request": {
"id": "uuid",
"user_id": "uuid",
"status": "approved",
"reviewed_by": "admin-uuid",
"reviewed_at": "2025-06-02T14:30:00.000Z"
}
}

Errors:

StatusDescription
400 Bad RequestMissing status or invalid value. Must be approved or rejected.
404 Not FoundNo authorship request exists with the given ID.