PAPI Documentation
The Presentation API (PAPI) enables you to create, manage, and publish web pages and assets programmatically.
Authentication
All PAPI requests require authentication via Bearer token in the Authorization header:
Authorization: Bearer {your_api_token}
Base URL
https://api.websitepublisher.ai
Status
Get the current status of a project including page and asset counts.
Response
{
"success": true,
"data": {
"project_id": 22253,
"domain": "mysite.websitepublisher.ai",
"pages_count": 5,
"assets_count": 12,
"status": "published"
}
}
Pages
List all pages in the project.
Create a new page.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
slug |
string | Yes | URL path (e.g., "index.html", "blog/post1.html") |
content |
string | Yes | Full HTML content |
meta |
object | No | Page metadata (title, language, etc.) |
seo |
object | No | SEO settings (description, robots, etc.) |
Example Request
{
"slug": "about.html",
"content": "<!DOCTYPE html><html>...</html>",
"meta": {
"title": "About Us",
"language": "en"
},
"seo": {
"description": "Learn more about our company",
"robots": "index, follow"
}
}
Get a specific page by slug.
Update an existing page. Note: The slug cannot be changed.
Delete a page.
Assets
List all assets in the project.
Upload a new asset.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
slug |
string | Yes | File path (e.g., "images/logo.png") |
content |
string | Yes | Base64 encoded binary data |
alt |
string | No | Alt text for images |
Supported File Types
| Category | Extensions | Max Size |
|---|---|---|
| Images | jpg, jpeg, png, gif, webp, svg | 5 MB |
| Documents | 5 MB | |
| Fonts | woff, woff2, ttf | 2 MB |
| Other | ico, json | 1 MB |
Get a specific asset (returns base64 content).
Delete an asset.
Bulk Operations
For efficiency, use bulk endpoints when creating multiple pages or assets:
Create multiple pages in one request.
{
"pages": [
{ "slug": "index.html", "content": "...", "meta": {...} },
{ "slug": "about.html", "content": "...", "meta": {...} }
]
}
Upload multiple assets in one request.
{
"assets": [
{ "slug": "images/a.png", "content": "{base64}" },
{ "slug": "images/b.png", "content": "{base64}" }
]
}
Error Handling
All errors return a consistent format:
{
"success": false,
"error": {
"message": "Description of the error",
"code": 400
}
}
HTTP Status Codes
| Code | Meaning |
|---|---|
200 |
Success |
201 |
Created |
400 |
Bad Request - Invalid input |
401 |
Unauthorized - Invalid token or project mismatch |
404 |
Not Found - Resource doesn't exist |
409 |
Conflict - Resource already exists |
422 |
Validation Error |
500 |
Server Error |
Complete Example
Here's a complete example of creating a simple website:
# 1. Check project status
curl -X GET "https://api.websitepublisher.ai/project/22253/status" \
-H "Authorization: Bearer YOUR_TOKEN"
# 2. Create pages
curl -X POST "https://api.websitepublisher.ai/project/22253/pages/bulk" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"pages": [
{
"slug": "index.html",
"content": "<!DOCTYPE html><html><head><title>Home</title></head><body><h1>Welcome</h1></body></html>",
"meta": {"title": "Home"}
}
]
}'
# 3. Verify
curl -X GET "https://api.websitepublisher.ai/project/22253/pages" \
-H "Authorization: Bearer YOUR_TOKEN"
Powered by WebSumo