Skip to content

Admin Endpoints

All admin endpoints require the X-Admin-Key header.

Admin Content

MethodEndpointDescription
GET/api/v1/admin/contentList all content (including drafts)
GET/api/v1/admin/content/:idGet content by ID
POST/api/v1/admin/contentCreate content
PUT/api/v1/admin/content/:idUpdate content
DELETE/api/v1/admin/content/:idDelete content
GET/api/v1/admin/content/:id/historyGet version history
POST/api/v1/admin/content/:id/restoreRestore to previous version

POST /admin/content

Create new content.

Headers

HeaderRequiredDescription
X-Admin-KeyYesAdmin API key
Idempotency-KeyRecommendedUnique request ID

Request Body

json
{
  "type": "project",
  "slug": "new-project",
  "data": {
    "title": "New Project",
    "description": "An exciting new project",
    "tags": ["typescript"],
    "featured": false
  },
  "status": "draft",
  "sortOrder": 0
}

Response (201 Created)

json
{
  "data": {
    "id": "content_new123",
    "type": "project",
    "slug": "new-project",
    "data": {...},
    "status": "draft",
    "version": 1,
    "sortOrder": 0,
    "createdAt": "2025-01-26T10:00:00Z",
    "updatedAt": "2025-01-26T10:00:00Z"
  }
}

GET /admin/content/:id

Get a single content item by ID, including drafts and archived items.

Path Parameters

ParameterTypeDescription
idstringContent ID

Response

json
{
  "data": {
    "id": "content_abc123",
    "type": "project",
    "slug": "my-project",
    "data": {...},
    "status": "draft",
    "version": 2,
    "sortOrder": 0,
    "createdAt": "2025-01-25T10:00:00Z",
    "updatedAt": "2025-01-26T10:00:00Z",
    "deletedAt": null
  }
}

PUT /admin/content/:id

Update existing content.

Request Body

json
{
  "data": {
    "title": "Updated Title",
    "description": "Updated description"
  },
  "status": "published"
}

Response

Returns the updated content item wrapped in { "data": {...} } with incremented version.

DELETE /admin/content/:id

Delete a content item.

Query Parameters

  • hard: Set to true for permanent deletion (default: soft delete)

GET /admin/content/:id/history

Get version history for a content item.

Response

json
{
  "data": [
    {
      "id": "history_xyz789",
      "contentId": "content_abc123",
      "version": 3,
      "data": {...},
      "changeType": "updated",
      "changedBy": "admin",
      "changeSummary": "Updated title, description",
      "createdAt": "2025-01-26T15:30:00Z"
    }
  ]
}

POST /admin/content/:id/restore

Restore content to a previous version.

Request Body

json
{
  "version": 2
}

Response

Returns the content item wrapped in { "data": {...} } with the restored data and a new version number.

Admin Chat

MethodEndpointDescription
GET/api/v1/admin/chat/sessionsList chat sessions
GET/api/v1/admin/chat/sessions/:idGet session with messages
DELETE/api/v1/admin/chat/sessions/:idEnd/delete session

GET /admin/chat/sessions

List chat sessions with optional filtering.

Query Parameters

ParameterTypeDefaultDescription
statusstring-Filter by status: active, ended, or expired
limitinteger50Maximum sessions to return (1-100)
offsetinteger0Number of sessions to skip (for pagination)

Response

json
{
  "data": [
    {
      "id": "sess_abc123",
      "visitorId": "visitor-unique-id",
      "ipHash": "hashed-ip",
      "userAgent": "Mozilla/5.0...",
      "messageCount": 5,
      "status": "active",
      "createdAt": "2025-01-25T10:00:00Z",
      "lastActiveAt": "2025-01-25T10:05:00Z",
      "expiresAt": "2025-01-25T11:00:00Z"
    }
  ]
}

GET /admin/chat/sessions/:id

Get a single session with all its messages.

Path Parameters

ParameterTypeDescription
idstringSession ID (must start with sess_)

Response

json
{
  "data": {
    "id": "sess_abc123",
    "visitorId": "visitor-unique-id",
    "ipHash": "hashed-ip",
    "userAgent": "Mozilla/5.0...",
    "messageCount": 2,
    "status": "active",
    "createdAt": "2025-01-25T10:00:00Z",
    "lastActiveAt": "2025-01-25T10:05:00Z",
    "expiresAt": "2025-01-25T11:00:00Z",
    "messages": [
      {
        "id": "msg_xyz789",
        "sessionId": "sess_abc123",
        "role": "user",
        "content": "Tell me about your projects",
        "tokensUsed": null,
        "model": null,
        "createdAt": "2025-01-25T10:00:00Z"
      },
      {
        "id": "msg_xyz790",
        "sessionId": "sess_abc123",
        "role": "assistant",
        "content": "I have several projects...",
        "tokensUsed": 150,
        "model": "gpt-4o-mini",
        "createdAt": "2025-01-25T10:00:01Z"
      }
    ]
  }
}

DELETE /admin/chat/sessions/:id

End a chat session.

Path Parameters

ParameterTypeDescription
idstringSession ID (must start with sess_)

See Also

Released under the MIT License.