Skip to content

Blog

Category for public blog API endpoints.

Available endpoints

  • GET /api/posts

    • Returns a list of published blog posts.
    • Limit: up to 100 records.
    • Response: { ok, posts }
  • GET /api/posts/:slug

    • Returns a single published blog post by slug.
    • Errors: 400 for missing slug, 404 when the post does not exist.
    • Response: { ok, post }
  • GET /api/search?q=query

    • Searches published blog posts by title, slug, excerpt, content and category name.
    • When q is empty, the endpoint returns the newest posts.
    • Response: { ok, items, total }
  • GET /:slug/json

    • Returns the full JSON payload of a single published post by slug.
    • Errors: 400 for missing slug, 404 when the post does not exist.
    • Response: { ok, post }
  • GET /api/categories

    • Returns the list of blog categories.
    • Supports optional q filter for slug or name.
    • Response: { ok, categories }
  • POST /api/categories

    • Creates a new blog category.
    • JSON body: { name, slug? }
    • Errors: 400 for invalid payload, 409 for duplicate slug.
    • Response: { ok, category }
  • GET /api/categories/:id

    • Returns a single category by id.
    • Errors: 400 for invalid id, 404 when the category does not exist.
    • Response: { ok, category }
  • PUT /api/categories/:id

  • PATCH /api/categories/:id

    • Updates a blog category.
    • JSON body: { name?, slug? }
    • Errors: 400, 404, 409.
    • Response: { ok, category }
  • DELETE /api/categories/:id

    • Deletes a category if it is not the default category and is not linked to blog posts.
    • Errors: 400, 404, 409.
    • Response: { ok: true }

Notes

  • All endpoints return JSON.
  • Error responses use { ok: false, error }.
  • Category endpoints are currently publicly accessible and are not protected by an authorization layer.