API Documentation
StarLaker's REST API lets you publish, fetch, and manage content programmatically. Base URL: https://starlaker.com/api/v1
Authentication
Protected endpoints require a Bearer token in the Authorization header:
Authorization: Bearer sl_live_YOUR_API_KEYGenerate API keys from Dashboard → API Keys. Keys are prefixed with sl_live_.
Endpoints
/api/v1/postsFetch published articles with optional tag filtering and pagination.
Query Parameters:
| Param | Type | Default | Description |
|---|---|---|---|
| tag | string | — | Filter by tag |
| limit | number | 20 | Results per page (max 100) |
| offset | number | 0 | Pagination offset |
Example:
curl https://starlaker.com/api/v1/posts?tag=AI&limit=5/api/v1/posts/:slugFetch a single published article by its URL slug.
Example:
curl https://starlaker.com/api/v1/posts/hello-world/api/v1/postsCreate a new post. Requires Bearer token authentication.
Request Body (JSON):
| Field | Type | Required |
|---|---|---|
| title | string | ✅ |
| content | string (markdown) | ✅ |
| tags | string[] | — |
| excerpt | string | — |
| status | draft | published | default: draft |
| cover_image | string (URL) | — |
| slug | string | auto-generated |
Example:
curl -X POST https://starlaker.com/api/v1/posts \
-H "Authorization: Bearer sl_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Hello World",
"content": "# My First Post\n\nThis is **bold**.",
"tags": ["tech", "intro"],
"status": "published"
}'/api/v1/posts/:slug/commentsFetch all comments for a post.
Example:
curl https://starlaker.com/api/v1/posts/hello-world/comments/api/v1/posts/:slug/commentsAdd a comment to a post. No authentication required.
Request Body (JSON):
| Field | Type | Required |
|---|---|---|
| author_name | string | ✅ |
| author_email | string | ✅ |
| body | string | ✅ |
curl -X POST https://starlaker.com/api/v1/posts/hello-world/comments \
-H "Content-Type: application/json" \
-d '{
"author_name": "Jane",
"author_email": "jane@example.com",
"body": "Great article!"
}'/api/v1/keys/generateGenerate a new API key. The raw key is returned ONCE — store it safely.
Request Body (JSON):
| Field | Type | Required |
|---|---|---|
| name | string | — |
| company_id | string | ✅ |
curl -X POST https://starlaker.com/api/v1/keys/generate \
-H "Content-Type: application/json" \
-d '{"name":"VS Code","company_id":"YOUR_COMPANY_ID"}'/api/v1/views/trackTrack a page view for analytics. Called automatically by the frontend.
curl -X POST https://starlaker.com/api/v1/views/track \
-H "Content-Type: application/json" \
-d '{"postId":"POST_ID"}'Response Format
All endpoints return JSON:
{
"success": true,
"data": { ... },
"pagination": { "total": 50, "limit": 20, "offset": 0, "hasMore": true }
}Rate Limiting
Rate limiting is applied per API key. If you exceed the limit, you'll receive a429 Too Many Requests response. Contact us for higher limits.