Skip to main content
Post Categories help organize blog posts by topics and types. Each category can contain multiple posts and is associated with a specific site. These endpoints provide read-only access to post category data.

Data Structure

{
  "id": 1,
  "site_id": 1,
  "type": "blog",
  "country": "US",
  "name": "Payroll Guides",
  "slug": "payroll-guides",
  "created_at": "2024-01-28T12:00:00Z",
  "updated_at": "2024-01-28T12:00:00Z",
  "posts_count": 15
}

List Categories

Retrieve a paginated list of post categories.
curl https://api.paystub.dev/post-categories

Available Filters

  • filter[type] - Filter by category type
  • filter[country] - Filter by country
  • filter[name] - Filter by category name
  • sort - Sort by field (e.g., name, -created_at)
  • include - Include related resources (e.g., posts, site)
  • per_page - Number of items per page (default: 15)

Get Category

Retrieve a specific category by ID.
curl https://api.paystub.dev/post-categories/1

Error Handling

  • 404 Not Found - Category does not exist
  • 422 Validation Error - Invalid input data

Best Practices

  1. Cache responses for improved performance
  2. Use appropriate filters to minimize data transfer
  3. Include related data only when needed
  4. Handle site-specific content appropriately