GET
Collections
Collections API
https://api.airogelcms.com/v1/accounts/:account_id/collections
Collections group content entries (like "posts", "pages", "products"). Each collection has a routing pattern that determines the URL structure for its entries.
Supported Operations
- GET /v1/accounts/:account_id/collections - List all collections
- GET /v1/accounts/:account_id/collections/:id - Get a specific collection
- POST /v1/accounts/:account_id/collections - Create a new collection
- PUT /v1/accounts/:account_id/collections/:id - Update a collection
- DELETE /v1/accounts/:account_id/collections/:id - Delete a collection
Routing Patterns
Supported placeholders in the routing field:
| Placeholder | Source | Example |
|---|---|---|
| :handle | Entry handle/slug | my-post |
| :year | 4-digit year from published_at | 2025 |
| :month | 2-digit month from published_at | 01 |
| :day | 2-digit day from published_at | 08 |
Create Fields
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | yes | Display name |
| handle | string | yes | URL-friendly identifier |
| routing | string | yes | URL pattern with :handle placeholder |
| root_routing | boolean | no | Whether entries can be at root level |
| orderable | string | no | Sort order: "no", "ascending", "descending" |
| schema_type | string | no | SEO schema type (e.g., "BlogPosting") |
| template_handle | string | no | Default template for entries |
| layout_handle | string | no | Default layout for entries |
| blueprint_handle | string | no | Attach an existing blueprint by handle |
| blueprint | object | no | Create inline blueprint with fields |
| index_template_handle | string | no | Template for index page |
| index_routing | string | no | URL path for index page (e.g., "blog") |
| index_per_page | integer | no | Entries per page (default: 10) |
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
account_id
|
string | Required | Your account ID |
handle
|
string | Optional | Filter by exact handle match |
page
|
integer | Optional | Page number (default: 1) |
Request Example
# List collections
curl https://api.airogelcms.com/v1/accounts/$ACCOUNT_ID/collections \
-H "Authorization: Bearer $API_TOKEN"
# Create collection with existing blueprint
curl -X POST \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Blog Posts",
"handle": "posts",
"routing": "blog/:handle",
"orderable": "descending",
"blueprint_handle": "blog-post",
"index_template_handle": "blog-index",
"index_routing": "blog",
"index_per_page": 10
}' \
https://api.airogelcms.com/v1/accounts/$ACCOUNT_ID/collections
Response Example
{
"data": [
{
"id": "clctn_abc123",
"name": "Blog Posts",
"handle": "posts",
"routing": "blog/:handle",
"root_routing": false,
"orderable": "descending",
"schema_type": "BlogPosting",
"template_handle": "post",
"layout_handle": "default",
"blueprints": [
{
"id": "blprt_xyz789",
"handle": "blog-post",
"title": "Blog Post"
}
],
"created_at": "2025-01-08T12:00:00Z",
"updated_at": "2025-01-08T12:00:00Z"
}
]
}
Additional Notes
Using existing vs. inline blueprints: Use blueprint_handle to attach an existing blueprint (recommended for imports), or blueprint to create one inline. If both are provided, blueprint_handle takes precedence.
Index pages: Collections can have an index page that displays a paginated list of entries. Set index_template_handle, index_routing, and index_per_page to enable.
Example routing patterns:
blog/:handle→ /blog/my-post:handle→ /about:year/:month/:day/:handle→ /2024/06/15/hello-world