API Reference
The PageGun API is a RESTful API for managing your sites, pages, and content programmatically.
Base URL
https://api.pagegun.comAll API requests must be made over HTTPS. HTTP requests are rejected.
Authentication
Authenticate using an API key in the Authorization header:
Authorization: Bearer pgk_live_your_key_hereAPI keys are generated from your PageGun Dashboard under Settings → API Keys.
Request Format
- All request bodies must be JSON with
Content-Type: application/json - All responses are JSON
Response Format
Success
{
"data": {
"id": "page_xyz789",
"title": "My Page",
"status": "published"
}
}Error
Errors use a flat Resend-style format:
{
"statusCode": 404,
"name": "not_found",
"message": "Resource not found"
}Response Headers
All API responses include:
| Header | Description |
|---|---|
X-Request-Id | Unique request tracking ID (useful for debugging) |
pagegun-version | API version (e.g. 2026-03-01) |
Access-Control-Allow-Origin | Always * (CORS enabled) |
Response Codes
| Code | Description |
|---|---|
200 | Success |
201 | Created |
400 | Bad request — check your parameters |
401 | Unauthorized — missing or invalid API key |
403 | Forbidden — action not allowed via API key |
404 | Not found |
429 | Rate limited — slow down |
500 | Server error |
Rate Limiting
The API allows 100 requests per minute per API key. When exceeded, you'll receive a 429 response.
Endpoints
Projects
| Method | Endpoint | Description |
|---|---|---|
GET | /projects | List all projects |
GET | /projects/:id | Get a project |
PUT | /projects/:id | Update a project |
Pages
| Method | Endpoint | Description |
|---|---|---|
GET | /pages | List pages |
POST | /pages | Create a page |
GET | /pages/:id | Get a page |
PUT | /pages/:id | Update a page |
POST | /pages/:id/publish | Publish a page |
POST | /pages/:id/unpublish | Unpublish a page |
Settings
| Method | Endpoint | Description |
|---|---|---|
GET | /projects/:id/settings | Get settings |
PUT | /projects/:id/settings | Update settings |
Data Mode
| Method | Endpoint | Description |
|---|---|---|
POST | /projects/:id/data-mode/enable | Enable Data Mode |
POST | /projects/:id/data-mode/disable | Disable Data Mode |
Users
| Method | Endpoint | Description |
|---|---|---|
GET | /users/me | Get current user |
Migration from v1
If you were using the previous v1 API paths (e.g. https://api.pagegun.com/v1/projects), update your base URL to https://api.pagegun.com. The /v1/ prefix is no longer needed — all endpoints are served directly from the API subdomain.
What to change: Remove /v1 from your base URL. Everything else (endpoints, parameters, authentication) remains the same.
Error Catalog
All standard error responses:
| statusCode | name | message |
|---|---|---|
401 | missing_api_key | Missing API key in the authorization header |
401 | unauthorized | Unauthorized |
403 | invalid_api_key | API key is invalid |
403 | forbidden | Insufficient permissions |
403 | project_scope_violation | This API key does not have access to the requested project |
404 | not_found | Resource not found |
422 | validation_error | Validation error |
422 | missing_required_field | Missing required field |
429 | rate_limit_exceeded | Too many requests |
500 | internal_error | An unexpected error occurred |
Quick Start
# Set your API key
export PAGEGUN_API_KEY="pgk_live_your_key_here"
# List your projects
curl "https://api.pagegun.com/projects" \
-H "Authorization: Bearer $PAGEGUN_API_KEY"
# Create a page
curl -X POST "https://api.pagegun.com/pages" \
-H "Authorization: Bearer $PAGEGUN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"page_name": "Hello World",
"slug": "hello",
"subroute": "blog",
"type": "article",
"project_id": "YOUR_PROJECT_ID",
"markdown_content": "# Hello\n\nFirst post!"
}'