Projects
Projects are the top-level container in PageGun. Each project holds pages, settings, and publishing configuration. You need at least one project before creating pages.
List Projects
GET /v1/projectsReturns a list of all projects in your account.
Query Parameters
| Name | Type | Required | Description |
|---|---|---|---|
limit | integer | No | Number of results to return. Default: 20, Max: 100 |
offset | integer | No | Number of results to skip. Default: 0 |
Request
curl https://api.pagegun.com/v1/projects \
-H "Authorization: Bearer pgk_live_xxxxx"const response = await fetch("https://api.pagegun.com/v1/projects", {
headers: { Authorization: "Bearer pgk_live_xxxxx" },
});
const { data } = await response.json();Response
{
"success": true,
"data": [
{
"id": "MgdGoare",
"name": "My Website",
"created_at": "2024-01-15T08:30:00Z",
"updated_at": "2024-02-01T12:00:00Z"
}
]
}Response Fields
| Name | Type | Description |
|---|---|---|
id | string | Unique project identifier |
name | string | Project display name |
created_at | string | ISO 8601 creation timestamp |
updated_at | string | ISO 8601 last update timestamp |
Create Project
POST /v1/projectsCreates a new project.
Note
Project creation is currently limited to whitelisted users. Contact support if you need to create projects via the API.
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Project name (1–100 characters) |
Request
curl -X POST https://api.pagegun.com/v1/projects \
-H "Authorization: Bearer pgk_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{"name": "My New Website"}'const response = await fetch("https://api.pagegun.com/v1/projects", {
method: "POST",
headers: {
Authorization: "Bearer pgk_live_xxxxx",
"Content-Type": "application/json",
},
body: JSON.stringify({ name: "My New Website" }),
});
const { data } = await response.json();Response 201 Created
{
"success": true,
"data": {
"id": "AbCdEfGh",
"name": "My New Website",
"created_at": "2024-03-01T10:00:00Z",
"updated_at": "2024-03-01T10:00:00Z"
}
}Get Project
GET /v1/projects/:idRetrieves a single project by ID.
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Project ID |
Request
curl https://api.pagegun.com/v1/projects/MgdGoare \
-H "Authorization: Bearer pgk_live_xxxxx"const response = await fetch("https://api.pagegun.com/v1/projects/MgdGoare", {
headers: { Authorization: "Bearer pgk_live_xxxxx" },
});
const { data } = await response.json();Response
{
"success": true,
"data": {
"id": "MgdGoare",
"name": "My Website",
"context": "A documentation site for our API",
"settings": {
"custom_domain": "docs.example.com"
},
"created_at": "2024-01-15T08:30:00Z",
"updated_at": "2024-02-01T12:00:00Z"
}
}Response Fields
| Name | Type | Description |
|---|---|---|
id | string | Unique project identifier |
name | string | Project display name |
context | string | Project description or context for AI generation |
settings | object | Project-level settings (custom domain, etc.) |
created_at | string | ISO 8601 creation timestamp |
updated_at | string | ISO 8601 last update timestamp |
Update Project
PUT /v1/projects/:idUpdates a project. Supports partial updates — only include the fields you want to change.
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Project ID |
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
name | string | No | New project name |
context | string | No | Project description or AI context |
settings | object | No | Project settings object |
Request
curl -X PUT https://api.pagegun.com/v1/projects/MgdGoare \
-H "Authorization: Bearer pgk_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{"name": "Updated Website Name", "context": "Our documentation portal"}'const response = await fetch("https://api.pagegun.com/v1/projects/MgdGoare", {
method: "PUT",
headers: {
Authorization: "Bearer pgk_live_xxxxx",
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Updated Website Name",
context: "Our documentation portal",
}),
});
const { data } = await response.json();Response
{
"success": true,
"data": {
"id": "MgdGoare",
"name": "Updated Website Name",
"context": "Our documentation portal",
"settings": {},
"created_at": "2024-01-15T08:30:00Z",
"updated_at": "2024-03-15T14:30:00Z"
}
}