# WebsitePublisher.ai - Complete AI Reference
> Full documentation for AI assistants to build and publish websites.
This document contains everything an AI needs to create complete websites using WebsitePublisher.ai.
## Overview
WebsitePublisher.ai is a platform that enables AI assistants to:
- Create and manage web pages (HTML/CSS/JS)
- Upload and serve assets (images, fonts, files)
- Publish instantly to a subdomain or custom domain
The user provides you with credentials. You build their website.
---
## Authentication
Every API request requires:
1. **Bearer Token** in the Authorization header
2. **Project ID** in the URL path
```
Authorization: Bearer {token}
```
The token is tied to a specific project. Using a token with the wrong project ID will fail.
---
## API Base URL
```
https://api.websitepublisher.ai
```
---
## PAPI Endpoints (Presentation API)
### Status
**Check Project Status**
```
GET /project/{project_id}/status
Authorization: Bearer {token}
```
Response:
```json
{
"success": true,
"data": {
"project_id": 22253,
"domain": "mysite.websitepublisher.ai",
"pages_count": 5,
"assets_count": 12,
"status": "published"
}
}
```
### Pages
**List All Pages**
```
GET /project/{project_id}/pages
Authorization: Bearer {token}
```
**Create Single Page**
```
POST /project/{project_id}/pages
Authorization: Bearer {token}
Content-Type: application/json
{
"slug": "index.html",
"content": "
Home
...
",
"meta": {
"title": "Home",
"language": "en"
},
"seo": {
"description": "Welcome to my website",
"robots": "index, follow"
}
}
```
**Create Multiple Pages (Bulk)**
```
POST /project/{project_id}/pages/bulk
Authorization: Bearer {token}
Content-Type: application/json
{
"pages": [
{
"slug": "index.html",
"content": "...",
"meta": {"title": "Home"}
},
{
"slug": "about.html",
"content": "...",
"meta": {"title": "About"}
},
{
"slug": "contact.html",
"content": "...",
"meta": {"title": "Contact"}
}
]
}
```
**Get Single Page**
```
GET /project/{project_id}/pages/{slug}
Authorization: Bearer {token}
```
Note: For nested slugs like `blog/post1.html`, use URL encoding or include the full path.
**Update Page**
```
PUT /project/{project_id}/pages/{slug}
Authorization: Bearer {token}
Content-Type: application/json
{
"content": "...(updated)...",
"meta": {"title": "Updated Title"}
}
```
Important: The slug CANNOT be changed. To change a URL, delete the old page and create a new one.
**Delete Page**
```
DELETE /project/{project_id}/pages/{slug}
Authorization: Bearer {token}
```
### Assets
**List All Assets**
```
GET /project/{project_id}/assets
Authorization: Bearer {token}
```
**Upload Single Asset**
```
POST /project/{project_id}/assets
Authorization: Bearer {token}
Content-Type: application/json
{
"slug": "images/logo.png",
"content": "{base64_encoded_binary_data}",
"alt": "Company logo"
}
```
The content must be base64 encoded. The API will detect the MIME type from the file extension.
**Upload Multiple Assets (Bulk)**
```
POST /project/{project_id}/assets/bulk
Authorization: Bearer {token}
Content-Type: application/json
{
"assets": [
{
"slug": "images/hero.jpg",
"content": "{base64}",
"alt": "Hero image"
},
{
"slug": "images/icon.png",
"content": "{base64}",
"alt": "Icon"
}
]
}
```
**Get Single Asset**
```
GET /project/{project_id}/assets/{slug}
Authorization: Bearer {token}
```
Returns the asset metadata and base64 content.
**Delete Asset**
```
DELETE /project/{project_id}/assets/{slug}
Authorization: Bearer {token}
```
---
## Response Formats
**Success Response**
```json
{
"success": true,
"data": {
"slug": "index.html",
"created_at": "2026-01-13T10:00:00Z"
}
}
```
**Error Response**
```json
{
"success": false,
"error": {
"message": "Page not found",
"code": 404
}
}
```
**HTTP Status Codes**
- 200: Success
- 201: Created
- 400: Bad Request (invalid input)
- 401: Unauthorized (invalid token or project mismatch)
- 404: Not Found
- 409: Conflict (resource already exists)
- 422: Validation Error
- 500: Server Error
---
## CDN URLs
Assets are served from the CDN at:
```
https://cdn.websitepublisher.ai/custom/wid{project_id}/{slug}
```
Example:
```
https://cdn.websitepublisher.ai/custom/wid22253/images/logo.png
```
When creating HTML, reference assets using relative paths or full CDN URLs.
---
## Best Practices for AI
### 1. Always Start with Status Check
Before building, verify your credentials work:
```
GET /project/{id}/status
```
### 2. Use Bulk Operations
When creating multiple pages or assets, use bulk endpoints for efficiency:
```
POST /project/{id}/pages/bulk
POST /project/{id}/assets/bulk
```
### 3. Generate Complete HTML
Always include the full document structure:
```html
Page Title
```
### 4. Use Inline Styles
Since each page is standalone, include CSS inline in the `