CMS Service
The CMS Service provides content management capabilities for your application. Create and manage blog posts, FAQs, pages, and custom content types. The service includes JSON schema validation for custom content structures and access to pre-fetched public news for content enrichment.
What you can do:
- Create and manage blog posts, FAQs, and pages
- Define custom content types with JSON schema validation
- Manage content status (draft, published, archived)
- Access pre-fetched public news content
- Store custom metadata with any content type
Interactive API Reference
For complete API documentation with interactive testing, visit our Swagger UI where you can try all endpoints with your own credentials.
View Interactive API DocsCreate Content
Create new content items like blog posts, FAQs, or pages. Each content item has a type, title, content body, and optional metadata. You can save content as a draft, publish it immediately, or archive it later. Use the slug field to create SEO-friendly URLs.
curl -X POST https://cms.stackfordevs.com/v1/content \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-secret-key: YOUR_SECRET_KEY" \
-H "x-tenant-id: YOUR_TENANT_ID" \
-H "x-project-id: YOUR_PROJECT_ID" \
-d '{
"type": "blog",
"title": "Getting Started with StackForDevs",
"slug": "getting-started-with-stackfordevs",
"content": "Welcome to our platform! Here is how to get started...
",
"metadata": {
"author": "Jane Doe",
"tags": ["tutorial", "getting-started"],
"featured": true
},
"status": "published"
}'
Content Types:
blog- Blog postsfaq- Frequently asked questionspage- Static pagescustom- Custom content types (requires content type definition)
Status Values:
draft- Not visible to publicpublished- Live and visiblearchived- Hidden but retained
List Content
Retrieve all your content items with optional filtering by type and status. Use pagination to handle large content libraries. This is perfect for building blog listings, FAQ pages, or admin content management interfaces.
curl -X GET "https://cms.stackfordevs.com/v1/content?type=blog&status=published&limit=20&offset=0" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-secret-key: YOUR_SECRET_KEY" \
-H "x-tenant-id: YOUR_TENANT_ID" \
-H "x-project-id: YOUR_PROJECT_ID"
Query Parameters:
type- Filter by content type (blog, faq, page, custom)status- Filter by status (draft, published, archived)limit- Max results (default: 20)offset- Pagination offset (default: 0)
Get Single Content Item
Retrieve a specific content item by its ID. Use this for displaying individual blog posts, FAQ answers, or page content. The response includes the full content body, metadata, and status information.
curl -X GET https://cms.stackfordevs.com/v1/content/cnt_abc123 \
-H "x-api-key: YOUR_API_KEY" \
-H "x-secret-key: YOUR_SECRET_KEY" \
-H "x-tenant-id: YOUR_TENANT_ID" \
-H "x-project-id: YOUR_PROJECT_ID"
Update Content
Modify existing content items. You can update the title, content body, metadata, or status. Use this for editing blog posts, updating FAQ answers, or publishing draft content. Only provide the fields you want to change.
curl -X PUT https://cms.stackfordevs.com/v1/content/cnt_abc123 \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-secret-key: YOUR_SECRET_KEY" \
-H "x-tenant-id: YOUR_TENANT_ID" \
-H "x-project-id: YOUR_PROJECT_ID" \
-d '{
"title": "Getting Started with StackForDevs (Updated)",
"content": "Updated content here...
",
"status": "published"
}'
Delete Content
Permanently delete a content item. This removes the content from your database completely. For temporary removal, consider using the archived status instead, which keeps the content but hides it from public view.
curl -X DELETE https://cms.stackfordevs.com/v1/content/cnt_abc123 \
-H "x-api-key: YOUR_API_KEY" \
-H "x-secret-key: YOUR_SECRET_KEY" \
-H "x-tenant-id: YOUR_TENANT_ID" \
-H "x-project-id: YOUR_PROJECT_ID"
Response: Returns 204 No Content on success. The content is permanently deleted and cannot be recovered.
Define Custom Content Types
Create custom content types with JSON schema validation for structured data. Perfect for products, events, team members, testimonials, or any domain-specific content. The schema ensures data consistency and validates content on creation and update.
curl -X POST https://cms.stackfordevs.com/v1/content-types \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-secret-key: YOUR_SECRET_KEY" \
-H "x-tenant-id: YOUR_TENANT_ID" \
-H "x-project-id: YOUR_PROJECT_ID" \
-d '{
"name": "product",
"description": "E-commerce product listings",
"schema": {
"type": "object",
"required": ["name", "price", "sku"],
"properties": {
"name": {
"type": "string"
},
"price": {
"type": "number",
"minimum": 0
},
"sku": {
"type": "string"
},
"inStock": {
"type": "boolean"
},
"categories": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}'
Tip: Use JSON Schema to enforce required fields, data types, and validation rules. Once a content type is defined, all content of that type will be validated against the schema.
List Content Types
View all custom content types you've defined. This is useful for building admin interfaces that let users create content, or for understanding what content structures are available in your CMS.
curl -X GET https://cms.stackfordevs.com/v1/content-types \
-H "x-api-key: YOUR_API_KEY" \
-H "x-secret-key: YOUR_SECRET_KEY" \
-H "x-tenant-id: YOUR_TENANT_ID" \
-H "x-project-id: YOUR_PROJECT_ID"
Get Public News
Access pre-fetched public news content updated every 2 hours. Perfect for enriching your application with current events, industry news, or trending topics without managing your own news aggregation infrastructure. Filter by category to get relevant news for your audience.
curl -X GET "https://cms.stackfordevs.com/v1/news?category=technology&limit=10" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-secret-key: YOUR_SECRET_KEY" \
-H "x-tenant-id: YOUR_TENANT_ID" \
-H "x-project-id: YOUR_PROJECT_ID"
Note: News content is automatically refreshed every 2 hours from public sources. This provides fresh content without hitting rate limits on external APIs.
Get Single News Item
Retrieve a specific news article by its ID. Use this for displaying full news article pages or when you need detailed information about a particular news item.
curl -X GET https://cms.stackfordevs.com/v1/news/news_xyz789 \
-H "x-api-key: YOUR_API_KEY" \
-H "x-secret-key: YOUR_SECRET_KEY" \
-H "x-tenant-id: YOUR_TENANT_ID" \
-H "x-project-id: YOUR_PROJECT_ID"
Error Codes
The CMS API uses standard HTTP status codes.
| Status | Description |
|---|---|
| 200 | Success - Request completed successfully |
| 201 | Created - Content or content type created |
| 204 | No Content - Content deleted successfully |
| 400 | Bad Request - Invalid data or schema validation failed |
| 401 | Unauthorized - Missing or invalid API keys |
| 404 | Not Found - Content or news item doesn't exist |