Manage help center articles through the Help.Center API. Supports creating new articles, reading and updating existing ones, publishing/unpublishing, and organizing by category.
Before making any API calls, you need two pieces of information from the user:
content.read - Required for searching/reading articlescontent.write - Required for creating/updating articles and categoriescontent.publish - Required for publishing/unpublishing articlescontent.delete - Required for deleting articles or categoriesIf the user hasn't provided these, ask for them before proceeding. Store them as environment variables for the session:
export HC_API_KEY="the_api_key"
export HC_CENTER_ID="the_center_id"
https://api.help.center
All requests require the API key in the Authorization header:
Authorization: Bearer $HC_API_KEY
```bash
curl -s -X GET \
-H "Authorization: Bearer $HC_API_KEY" \
-H "Content-Type: application/json" \
"https://api.help.center/v0/centers/$HC_CENTER_ID/articles?search=SEARCH_TERM&expand[]=content"
```
```bash
curl -s -X GET \
-H "Authorization: Bearer $HC_API_KEY" \
-H "Content-Type: application/json" \
"https://api.help.center/v0/centers/$HC_CENTER_ID/articles/ARTICLE_ID?expand[]=content"
```
```bash
curl -s -X PATCH \
-H "Authorization: Bearer $HC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Updated Title",
"html": "
}' \
"https://api.help.center/v0/centers/$HC_CENTER_ID/articles/ARTICLE_ID/draft"
```
```bash
curl -s -X POST \
-H "Authorization: Bearer $HC_API_KEY" \
"https://api.help.center/v0/centers/$HC_CENTER_ID/articles/ARTICLE_ID/publish"
```
```bash
curl -s -X GET \
-H "Authorization: Bearer $HC_API_KEY" \
-H "Content-Type: application/json" \
"https://api.help.center/v0/centers/$HC_CENTER_ID/articles/categories"
```
```bash
curl -s -X POST \
-H "Authorization: Bearer $HC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Article Title",
"content": {
"html": "
Content here...
"},
"category_id": "category-slug"
}' \
"https://api.help.center/v0/centers/$HC_CENTER_ID/articles"
```
```bash
curl -s -X POST \
-H "Authorization: Bearer $HC_API_KEY" \
"https://api.help.center/v0/centers/$HC_CENTER_ID/articles/ARTICLE_ID/publish"
```
starting_after with the last article's ID to fetch more.| Action | Method | Endpoint |
|---|---|---|
| -------- | -------- | ---------- |
| List articles | GET | /v0/centers/:centerId/articles |
| Search articles | GET | /v0/centers/:centerId/articles?search=query |
| Get article | GET | /v0/centers/:centerId/articles/:articleId |
| Create article | POST | /v0/centers/:centerId/articles |
| Update draft | PATCH | /v0/centers/:centerId/articles/:articleId/draft |
| Update metadata | PATCH | /v0/centers/:centerId/articles/:articleId/metadata |
| Publish | POST | /v0/centers/:centerId/articles/:articleId/publish |
| Unpublish | POST | /v0/centers/:centerId/articles/:articleId/unpublish |
| Delete | DELETE | /v0/centers/:centerId/articles/:articleId |
| Duplicate | POST | /v0/centers/:centerId/articles/:articleId/duplicate |
| List drafts | GET | /v0/centers/:centerId/articles/drafts |
| Get draft | GET | /v0/centers/:centerId/articles/:articleId/draft |
| Discard draft | POST | /v0/centers/:centerId/articles/:articleId/draft/discard |
| List categories | GET | /v0/centers/:centerId/articles/categories |
| Create category | POST | /v0/centers/:centerId/articles/categories |
| Update category | PATCH | /v0/centers/:centerId/articles/categories/:categoryId |
| Delete category | DELETE | /v0/centers/:centerId/articles/categories/:categoryId |
| Upload image | POST | /v0/centers/:centerId/articles/images |
| Get center info | GET | /v0/centers/:centerId |
| Count articles | GET | /v0/centers/:centerId/articles/count |
When writing help center articles:
Categories help organize your articles. You can create hierarchical categories with one level of subcategories.
curl -s -X POST \
-H "Authorization: Bearer $HC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Getting Started",
"description": "Articles for new users",
"icon": "<svg>...</svg>", // Optional custom SVG icon
"parent_id": "parent-cat-id" // Optional, for subcategories
}' \
"https://api.help.center/v0/centers/$HC_CENTER_ID/articles/categories"
curl -s -X PATCH \
-H "Authorization: Bearer $HC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Name",
"description": "Updated description",
"icon": "<svg>...</svg>"
}' \
"https://api.help.center/v0/centers/$HC_CENTER_ID/articles/categories/CATEGORY_ID"
Categories can only be deleted if no articles are using them.
curl -s -X DELETE \
-H "Authorization: Bearer $HC_API_KEY" \
"https://api.help.center/v0/centers/$HC_CENTER_ID/articles/categories/CATEGORY_ID"
Upload images for use in your articles:
curl -s -X POST \
-H "Authorization: Bearer $HC_API_KEY" \
-F "image=@/path/to/image.jpg" \
"https://api.help.center/v0/centers/$HC_CENTER_ID/articles/images"
Constraints:
multipart/form-data with field name imageThe response will include the image URL to use in your article HTML:
{
"success": true,
"data": {
"url": "https://cdn.help.center/images/...",
"filename": "image.jpg",
"size": 1024576
}
}
When creating articles, optionally include SEO metadata:
{
"metadata": {
"seo": {
"title": "Concise, keyword-rich title (50-60 chars)",
"description": "Clear summary of the article (150-160 chars)"
}
}
}
You can also update SEO metadata on existing articles via the metadata endpoint:
curl -s -X PATCH \
-H "Authorization: Bearer $HC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"seo": {
"title": "SEO Title",
"description": "SEO Description"
}
}' \
"https://api.help.center/v0/centers/$HC_CENTER_ID/articles/ARTICLE_ID/metadata"
共 1 个版本