REST API

ZephyrPHP provides a built-in REST API for accessing your content programmatically. Enable API access per collection from the admin panel.

Enabling API Access

  1. Go to CMS Admin > Collections > [Your Collection]
  2. Enable API Access in the collection settings
  3. Optionally set a rate limit

API Endpoints

Once enabled, your collection is accessible at:

Method Endpoint Description
GET/api/v1/{collection}List entries (paginated)
GET/api/v1/{collection}/{id}Get a single entry
POST/api/v1/{collection}Create an entry
PUT/api/v1/{collection}/{id}Update an entry
DELETE/api/v1/{collection}/{id}Delete an entry

Authentication

API requests require an API key. Create one from CMS Admin > API Keys.

Pass the key in the request header:

Authorization: Bearer your-api-key-here

Filtering & Sorting

Use query parameters to filter and sort results:

GET /api/v1/blog?status=published&sort=created_at&order=desc&per_page=10

Rate Limiting

Configure rate limits per collection in the collection settings. The API returns 429 Too Many Requests when the limit is exceeded, along with X-RateLimit-* headers.

OAuth 2.0

For third-party integrations, ZephyrPHP supports OAuth 2.0. Manage OAuth clients from CMS Admin > OAuth Clients. Supports authorization code flow with access and refresh tokens.

Webhooks

Trigger webhooks when content changes. Go to CMS Admin > Webhooks to configure endpoint URLs that receive POST notifications when entries are created, updated, or deleted.