Collections

Collections are the building blocks of your knowledge base structure. They allow you to group articles into sections, making it easier for your customers to navigate your help center. The API gives you full control over collections: you can fetch them, create new ones, or update existing ones.

Fetching a collection

Use this endpoint to retrieve all metadata about a specific collection, including the articles it contains.

GET /knowledge/collections/{collection_id}

Authentication

Include your API key in the X-Api-Key header:

curl -H "X-Api-Key: sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \ https://api.getfernand.com/knowledge/collections/<COLLECTION_ID>

Response

Each collection includes:

  • id: numeric identifier

  • parent_id: ID of the parent collection, or null

  • title: collection name

  • slug: URL-safe identifier

  • description: optional description

  • icon: optional emoji or code

  • sort: integer used for ordering

  • articles: array of article IDs in this collection

{ "id": 10, "parent_id": null, "title": "Getting started", "slug": "getting-started", "description": "Introductory guides", "icon": "πŸ‘‹", "sort": 1, "articles": [101, 102, 103] }

Creating a collection

You can create a new collection by making a POST request to the collections endpoint without specifying an ID. This will create a new collection with the fields you provide.

POST /knowledge/collections
curl -X POST \ -H "X-Api-Key: sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "title": "API Guides", "slug": "api-guides", "description": "All articles related to the API", "icon": "πŸ“š", "parent_id": null, "sort": 2, "articles": [] }' \ https://api.getfernand.com/knowledge/collections

Updating a collection

To update an existing collection, send a PATCH request to its URL. You only need to include the fields you want to change, but you can also send the full payload to replace all values.

PATCH /knowledge/collections/{collection_id}
curl -X PATCH \ -H "X-Api-Key: sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "title": "Getting started (updated)", "slug": "getting-started", "description": "Introductory and onboarding guides", "icon": "πŸš€", "sort": 1, "articles": [101, 104] }' \ https://api.getfernand.com/knowledge/collections/<COLLECTION_ID>

Deleting a collection

To delete an existing collection, send a DELETE request to its URL. No need to include a body.

DELETE /knowledge/collections/{collection_id}
curl -X DELETE \ -H "X-Api-Key: sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Usage

With these endpoints you can:

  • Fetch and display a collection and its articles

  • Create new collections to expand your knowledge base

  • Update existing collections to reorganize or rename them

Next steps

Once you have collections set up, you can populate them with articles using the Articles endpoint, or list everything at once with Fetching the knowledge base structure.

Was this helpful?