List Pages
Retrieve all pages for a project with powerful filtering, sorting, and pagination options. Perfect for building admin interfaces or content management workflows.
Endpoint
Name Required Description AuthorizationYes Bearer $PAGEGUN_API_KEYContent-TypeNo application/json
Query Parameters
Name Type Required Default Description project_idstring Yes - Project ID to list pages for typestring No allFilter by page type: page, article, docs, item, or all subroutestring No - Filter by subroute (e.g., pages, blog, docs) statusstring No allFilter by status: draft, published, archived, or all slugstring No - Filter by slug (exact match or partial with * wildcard) limitinteger No 25Number of results per page (1-100) offsetinteger No 0Pagination offset sortstring No updated_atSort field: created_at, updated_at, page_name, or slug orderstring No descSort order: asc or desc created_afterstring No - ISO 8601 timestamp to filter pages created after this date created_beforestring No - ISO 8601 timestamp to filter pages created before this date updated_afterstring No - ISO 8601 timestamp to filter pages updated after this date updated_beforestring No - ISO 8601 timestamp to filter pages updated before this date include_contentboolean No falseInclude page content in response (increases response size)
Response
Returns a paginated list of page objects.
{
"data" : [
{
"id" : "page_xyz789" ,
"page_name" : "Product Landing Page" ,
"slug" : "product-landing" ,
"subroute" : "pages" ,
"type" : "page" ,
"status" : "published" ,
"url" : "/product-landing" ,
"meta" : {
"title" : "Amazing Product - Get Started Today" ,
"description" : "Discover our amazing product features and benefits." ,
"image" : "https://example.com/product-og.png"
},
"sections_count" : 8 ,
"word_count" : 1250 ,
"created_at" : "2024-01-15T10:30:00Z" ,
"updated_at" : "2024-01-20T14:00:00Z"
},
{
"id" : "page_abc456" ,
"page_name" : "Getting Started Guide" ,
"slug" : "getting-started" ,
"subroute" : "docs" ,
"type" : "docs" ,
"status" : "published" ,
"url" : "/docs/quick-start" ,
"meta" : {
"title" : "Getting Started - Documentation" ,
"description" : "Learn how to get started with our platform." ,
"image" : null
},
"sections_count" : 5 ,
"word_count" : 850 ,
"created_at" : "2024-01-12T08:00:00Z" ,
"updated_at" : "2024-01-18T16:30:00Z"
}
],
"meta" : {
"total" : 47 ,
"limit" : 25 ,
"offset" : 0 ,
"has_more" : true ,
"filters" : {
"project_id" : "proj_abc123" ,
"type" : "all" ,
"status" : "all"
}
}
}
Response Fields
Page Object
Field Type Description idstring Unique identifier for the page page_namestring Display name of the page slugstring URL slug for the page subroutestring Subroute/folder for the page typestring Page type: page, article, docs, or item statusstring Publishing status: draft, published, or archived urlstring Full URL path for the page metaobject SEO metadata for the page sections_countinteger Number of content sections in the page word_countinteger Approximate word count of page content created_atstring ISO 8601 timestamp when page was created updated_atstring ISO 8601 timestamp when page was last modified
Field Type Description titlestring Page title for SEO descriptionstring Meta description for SEO imagestring Social sharing image URL
Field Type Description totalinteger Total number of pages matching the filter limitinteger Maximum number of items returned in this response offsetinteger Number of items skipped for pagination has_moreboolean Whether there are more results available filtersobject Applied filters for this request
Examples
Basic Request
curl -X GET "https://api.pagegun.com/pages?project_id=proj_abc123" \
-H "Authorization: Bearer $PAGEGUN_API_KEY "
Filter by Type and Status
curl -X GET "https://api.pagegun.com/pages?project_id=proj_abc123&type=article&status=published" \
-H "Authorization: Bearer $PAGEGUN_API_KEY "
Pagination and Sorting
curl -X GET "https://api.pagegun.com/pages?project_id=proj_abc123&limit=10&offset=20&sort=page_name&order=asc" \
-H "Authorization: Bearer $PAGEGUN_API_KEY "
Search by Slug Pattern
curl -X GET "https://api.pagegun.com/pages?project_id=proj_abc123&slug=blog-*" \
-H "Authorization: Bearer $PAGEGUN_API_KEY "
Filter by Date Range
curl -X GET "https://api.pagegun.com/pages?project_id=proj_abc123&created_after=2024-01-01T00:00:00Z&created_before=2024-02-01T00:00:00Z" \
-H "Authorization: Bearer $PAGEGUN_API_KEY "
Include Content in Response
curl -X GET "https://api.pagegun.com/pages?project_id=proj_abc123&include_content=true&limit=5" \
-H "Authorization: Bearer $PAGEGUN_API_KEY "
JavaScript Example
const listPages = async (projectId, filters = {}) => {
const params = new URLSearchParams({
project_id : projectId,
...filters
});
const response = await fetch( `https://api.pagegun.com/pages? ${params} ` , {
headers : {
'Authorization' : `Bearer ${process.env.PAGEGUN_API_KEY} `
}
});
if (!response.ok) {
throw new Error ( `HTTP error! status: ${response.status} ` );
}
return response.json();
};
// Usage examples
const publishedArticles = await listPages( 'proj_abc123' , {
type : 'article' ,
status : 'published' ,
sort : 'created_at' ,
order : 'desc'
});
const recentPages = await listPages( 'proj_abc123' , {
created_after : '2024-01-01T00:00:00Z' ,
limit : 50
});
Error Responses
400 Bad Request
{
"statusCode" : 422 ,
"name" : "invalid_request" ,
"message" : "Invalid query parameter"
}
401 Unauthorized
{
"statusCode" : 401 ,
"name" : "unauthorized" ,
"message" : "Invalid or missing API key"
}
403 Forbidden
{
"statusCode" : 403 ,
"name" : "forbidden" ,
"message" : "You don't have access to this project"
}
404 Not Found
{
"statusCode" : 404 ,
"name" : "not_found" ,
"message" : "Project not found"
}
429 Too Many Requests
{
"statusCode" : 429 ,
"name" : "rate_limit_exceeded" ,
"message" : "Too many requests. Please try again later."
}