API Reference

The PageGun API is a RESTful API for managing your sites, pages, and content programmatically.

Base URL

https://api.pagegun.com

All 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_here

API keys are generated from your PageGun Dashboard under Settings → API Keys.

Learn more about 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" }

See all error codes →

Response Headers

All API responses include:

HeaderDescription
X-Request-IdUnique request tracking ID (useful for debugging)
pagegun-versionAPI version (e.g. 2026-03-01)
Access-Control-Allow-OriginAlways * (CORS enabled)

Response Codes

CodeDescription
200Success
201Created
400Bad request — check your parameters
401Unauthorized — missing or invalid API key
403Forbidden — action not allowed via API key
404Not found
429Rate limited — slow down
500Server error

Rate Limiting

The API allows 100 requests per minute per API key. When exceeded, you'll receive a 429 response.

Rate limiting details →

Endpoints

Projects

MethodEndpointDescription
GET/projectsList all projects
GET/projects/:idGet a project
PUT/projects/:idUpdate a project

Pages

MethodEndpointDescription
GET/pagesList pages
POST/pagesCreate a page
GET/pages/:idGet a page
PUT/pages/:idUpdate a page
POST/pages/:id/publishPublish a page
POST/pages/:id/unpublishUnpublish a page

Settings

MethodEndpointDescription
GET/projects/:id/settingsGet settings
PUT/projects/:id/settingsUpdate settings

Data Mode

MethodEndpointDescription
POST/projects/:id/data-mode/enableEnable Data Mode
POST/projects/:id/data-mode/disableDisable Data Mode

Users

MethodEndpointDescription
GET/users/meGet 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:

statusCodenamemessage
401missing_api_keyMissing API key in the authorization header
401unauthorizedUnauthorized
403invalid_api_keyAPI key is invalid
403forbiddenInsufficient permissions
403project_scope_violationThis API key does not have access to the requested project
404not_foundResource not found
422validation_errorValidation error
422missing_required_fieldMissing required field
429rate_limit_exceededToo many requests
500internal_errorAn 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!" }'

Full Quick Start guide →

© 2026 PageGun. All rights reserved.