Introducing ContioReach - The Headless CMS Built for Content Excellence. Learn More

Categories API

Get categories for a workspace

url

https://contioreach.com/api/public/categories

method

GET


Query Parameters

  • id

    Optional

    Filter categories by ID

  • slug

    Optional

    Filter categories by slug


Authentication

API requests require authentication using an API key in one of two ways:

  • x-api-key header

    Include your API key in the x-api-key header

  • authorization header

    Include your API key in the authorization header with format: Bearer YOUR_API_KEY


Response

200

Success

typescript

{
  categories: [
    { 
      id: string,
      name: string,
      slug: string,
      description: string
    }
  ]
}

401

Unauthorized

{
  error: string // Authentication error message
}

500

Server Error

{
  error: "Failed to fetch categories"
}

Usage Examples

// Fetch all categories
async function fetchCategories() {
  const response = await fetch('https://contioreach.com/api/public/categories', {
    headers: {
      'x-api-key': 'YOUR_API_KEY'
    }
  });
  return await response.json();
}
// Fetch category by slug
async function fetchCategoryBySlug(slug) {
  const response = await fetch('https://contioreach.com/api/public/categories?slug=' + slug, {
    headers: {
      'x-api-key': 'YOUR_API_KEY'
    }
  });
  return await response.json();
}