Help Center API Reference

Help Center API

The Help Center API is a versioned internal REST API used by the OnCodes support platform. It allows you to programmatically manage articles, categories, and sections. All endpoints are prefixed with /api/v1/hc/ and require an active authenticated session.

Base URL

https://support.oncodes.com/api/v1/hc/

Authentication

All requests require a valid browser session cookie and the CSRF token passed as a request header. The token is stored in the XSRF-TOKEN cookie and must be decoded before use.

X-XSRF-TOKEN: <decoded value of XSRF-TOKEN cookie>
Content-Type: application/json
Accept: application/json

To extract the token in the browser console:

decodeURIComponent(document.cookie.match(/XSRF-TOKEN=([^;]+)/)[1])

Articles

List Articles

Endpoint: GET /api/v1/hc/articles

Returns a paginated list of articles. Supports filtering, searching, and sorting.

Query Parameters

ParameterTypeDescription
pageintPage number (default: 1)
perPageintResults per page (default: 15)
orderBystringField to sort by (e.g. updated_at)
orderDirstringSort direction: asc or desc
querystringSearch term to filter articles by title
filtersstringAdditional filters (JSON-encoded)
withstringComma-separated relationships to eager load
withCountstringComma-separated relationships to count
paginatestringPagination mode — use preferLengthAware for full pagination metadata
aiAgentIdintFilter by AI agent association

Response

{
  "pagination": {
    "current_page": 1,
    "per_page": 15,
    "total": 76,
    "last_page": 6,
    "from": 1,
    "to": 15,
    "next_page": 2,
    "prev_page": null,
    "data": [
      {
        "id": 101,
        "title": "Article Title",
        "slug": "article-title",
        "draft": false,
        "updated_at": "2026-02-26T08:00:00.000000Z",
        "used_by_ai_agent": false,
        "author": { "id": 1, "name": "..." },
        "tags": [],
        "path": [
          { "id": 1, "name": "ChatNet", "model_type": "category", "is_section": false },
          { "id": 2, "name": "Getting Started", "model_type": "category", "is_section": true }
        ]
      }
    ]
  },
  "status": "success"
}

Get Article

Endpoint: GET /api/v1/hc/articles/{id}

Returns a single article including full body content, navigation context, and category path.

Response

{
  "article": {
    "id": 101,
    "title": "Article Title",
    "body": "<p>HTML content...</p>",
    "slug": "article-title",
    "draft": false,
    "visibility": "public",
    "views": 0,
    "position": 0,
    "description": null,
    "extra_data": null,
    "managed_by_role": null,
    "visible_to_role": null,
    "author_id": 1,
    "scan_pending": false,
    "used_by_ai_agent": 0,
    "created_at": "2026-02-26T08:00:00.000000Z",
    "updated_at": "2026-02-26T08:00:00.000000Z",
    "model_type": "article",
    "categories": [...],
    "tags": [],
    "attachments": []
  },
  "categoryNav": {...},
  "pageNav": {...},
  "status": "success"
}

Create Article

Endpoint: POST /api/v1/hc/articles

Creates a new article. Returns 201 Created on success.

Request Body

FieldTypeRequiredDescription
titlestringNoArticle title
bodystringYesArticle HTML content
author_idintYesID of the article author (agent)
sectionsint[]YesArray of section IDs to attach the article to (at least one required)
draftbooleanNotrue = draft, false = published (default: false)
tagsarrayNoArray of tag strings
descriptionstringNoShort meta description
slugstringNoURL slug (auto-generated from title if omitted)

Validation Errors (422)

FieldRule
bodyRequired
author_idRequired
sectionsMust contain at least one section ID

Example Request

fetch('https://support.oncodes.com/api/v1/hc/articles', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'X-XSRF-TOKEN': decodeURIComponent(document.cookie.match(/XSRF-TOKEN=([^;]+)/)[1])
  },
  body: JSON.stringify({
    title: 'My New Article',
    body: '<p>Content here</p>',
    author_id: 1,
    sections: [2],
    draft: false,
    tags: []
  })
});

Response

HTTP 201 Created
{
  "article": {
    "id": 102,
    "title": "My New Article",
    "body": "<p>Content here</p>",
    "draft": false,
    ...
  },
  "status": "success"
}

Update Article

Endpoint: PUT /api/v1/hc/articles/{id}

Updates an existing article. Accepts the same fields as Create Article. Note: PATCH is not supported — use PUT.

Supported Methods

Only GET, PUT, and DELETE are supported on /api/v1/hc/articles/{id}. Using PATCH returns 405 Method Not Allowed.


Delete Article

Endpoint: DELETE /api/v1/hc/articles/{id}

Permanently deletes an article. Returns 200 with {"status":"success"} even if the article does not exist.


Categories

In this platform, categories and sections share the same data model. A category is a top-level grouping (e.g. a product). A section is a child of a category (is_section: true, parent_id set). Articles are attached to sections, not directly to categories.

List Categories (Manager View)

Endpoint: GET /api/v1/hc/manager/categories

Returns all top-level categories used in the admin arrange view. Does not include children — fetch sections separately per category.

Response

{
  "categories": [
    {
      "id": 1,
      "name": "ChatNet - PHP Chat Room",
      "is_section": false,
      "parent_id": null,
      "description": "...",
      "image": "storage/category/image.png",
      "visible_to_role": null,
      "managed_by_role": null,
      "articles_count": 45,
      "sections_count": 11,
      "tags": []
    }
  ],
  "status": "success"
}

List Sections for a Category

Endpoint: GET /api/v1/hc/manager/categories/{categoryId}/sections

Returns all sections (child categories) belonging to a given top-level category.

Response

{
  "categories": [
    {
      "id": 2,
      "name": "Getting Started",
      "is_section": true,
      "parent_id": 1,
      "articles_count": 6
    }
  ],
  "category": { ... },
  "status": "success"
}

Create Category or Section

Endpoint: POST /api/v1/hc/categories

Creates a new category (top-level) or section (child). To create a section, set parent_id to the parent category ID and is_section to true.

Request Body

FieldTypeRequiredDescription
namestringYesCategory or section name
descriptionstringNoDescription text
parent_idintNoParent category ID (set this to create a section)
is_sectionbooleanNotrue if this is a section under a category
visible_to_rolestringNoRestrict visibility to a specific role
managed_by_rolestringNoRestrict management to a specific role

Response

HTTP 200 OK
{
  "category": {
    "id": 32,
    "name": "My Section",
    "parent_id": 1,
    "is_section": true,
    "position": 12,
    "created_at": "...",
    "updated_at": "...",
    "model_type": "category"
  },
  "status": "success"
}

Update Category or Section

Endpoint: PUT /api/v1/hc/categories/{id}

Updates an existing category or section. Accepts the same fields as Create. Returns the full updated category object.

Full Category Object Fields

The response includes: id, name, description, position, default, parent_id, managed_by_role, visible_to_role, hide_from_structure, is_section, image, created_at, updated_at, model_type.


Delete Category or Section

Endpoint: DELETE /api/v1/hc/categories/{id}

Permanently deletes a category or section. Returns 404 if the ID does not exist.

Note: POST and DELETE are not available on /api/v1/hc/manager/categories — use /api/v1/hc/categories instead.


Other Endpoints

Normalized Models (Lookup Data)

These endpoints return lightweight lists used to populate dropdowns and filters in the UI.

EndpointDescription
GET /api/v1/helpdesk/normalized-models/hc-categoriesAll categories as flat list for selects
GET /api/v1/helpdesk/normalized-models/article-authorsAll agents who can author articles
GET /api/v1/helpdesk/normalized-models/article-authors/{id}Single author by ID
GET /api/v1/helpdesk/normalized-models/tags?query=&paginate=simple&perPage=25Tag list with search support
GET /api/v1/helpdesk/normalized-models/roles?type=allAll roles for visibility/management restrictions
GET /api/v1/helpdesk/compact-agentsCompact agent list for assignments

Arrange View

Endpoint: GET /api/v1/hc/manager/categories/arrange

Returns the category tree used to render the drag-and-drop arrange page at /dashboard/hc/arrange.


Current Category & Section Structure

IDNameTypeParentArticles
1ChatNet - PHP Chat Room & Private Chat ScriptCategory45
2Getting StartedSectionChatNet6
31ChatNet 2.0SectionChatNet2
3How ToSectionChatNet20
5Change LogSectionChatNet1
14Cloud StorageSectionChatNet3
6Frequently Asked QuestionsSectionChatNet1
4TranslateSectionChatNet2
7Chat RoomsSectionChatNet3
30Video ChatSectionChatNet1
13Third Party IntegrationSectionChatNet3
8AdvancedSectionChatNet4
9ChatBubble - WordPress All in One Social Support Floating ButtonCategory20
10Getting StartedSectionChatBubble3
11ConfigurationSectionChatBubble3
12IntegrationSectionChatBubble14
15ChatNetWP - WordPress Plugin for ChatNetCategory5
16Getting StartedSectionChatNetWP2
17ConfigurationSectionChatNetWP2
18Usage / Short CodesSectionChatNetWP1
20HotelPrice - WordPress Price Comparison Plugin for Hotel WebsitesCategory6
21Getting StartedSectionHotelPrice4
22ConfigurationSectionHotelPrice1
23OTA ChannelsSectionHotelPrice1