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}
⚠️ Important Each token is tied to a specific project. The project ID in the URL must match the token's project.

Base URL

https://api.websitepublisher.ai

Status

GET /project/{project_id}/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

GET /project/{project_id}/pages

List all pages in the project.

POST /project/{project_id}/pages

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 /project/{project_id}/pages/{slug}

Get a specific page by slug.

PUT /project/{project_id}/pages/{slug}

Update an existing page. Note: The slug cannot be changed.

ℹ️ Immutable Slugs To change a page's URL, delete the old page and create a new one with the desired slug.
DELETE /project/{project_id}/pages/{slug}

Delete a page.

Assets

GET /project/{project_id}/assets

List all assets in the project.

POST /project/{project_id}/assets

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 pdf 5 MB
Fonts woff, woff2, ttf 2 MB
Other ico, json 1 MB
GET /project/{project_id}/assets/{slug}

Get a specific asset (returns base64 content).

DELETE /project/{project_id}/assets/{slug}

Delete an asset.

Bulk Operations

For efficiency, use bulk endpoints when creating multiple pages or assets:

POST /project/{project_id}/pages/bulk

Create multiple pages in one request.

{
    "pages": [
        { "slug": "index.html", "content": "...", "meta": {...} },
        { "slug": "about.html", "content": "...", "meta": {...} }
    ]
}
POST /project/{project_id}/assets/bulk

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