# 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 `

Welcome to My Website

This site was built by AI.

", "meta": {"title": "Home"} }, { "slug": "about.html", "content": "About - My Website

About Us

We are a company that does things.

Back to Home

", "meta": {"title": "About"} }, { "slug": "contact.html", "content": "Contact - My Website

Contact Us

Email: hello@example.com

Back to Home

", "meta": {"title": "Contact"} } ] } ``` ### Step 3: Verify ``` GET /project/22253/pages Authorization: Bearer {token} ``` The website is now live! --- ## MAPI (Meta API) MAPI allows you to create dynamic data structures. This is useful for: - Blog posts stored as data records - Product catalogs - Any structured content that pages can reference ### Base URL ``` https://api.websitepublisher.ai ``` ### Key Endpoints **List Entities** ``` GET /mapi/entities Authorization: Bearer {token} X-Project-ID: {project_id} ``` **Create Entity** ``` POST /mapi/entities Authorization: Bearer {token} X-Project-ID: {project_id} Content-Type: application/json { "name": "blogpost", "plural": "blogposts", "properties": [ {"name": "title", "type": "varchar", "length": 200, "required": true}, {"name": "content", "type": "text", "required": true}, {"name": "published_at", "type": "datetime"} ] } ``` **CRUD Operations** ``` GET /mapi/project/{id}/{entity} # List records POST /mapi/project/{id}/{entity} # Create record GET /mapi/project/{id}/{entity}/{record} # Get record PUT /mapi/project/{id}/{entity}/{record} # Update record DELETE /mapi/project/{id}/{entity}/{record} # Delete record ``` Full MAPI documentation: https://websitepublisher.ai/docs/mapi.html --- ## Support - Documentation: https://websitepublisher.ai/docs/ - llms.txt: https://websitepublisher.ai/llms.txt - Platform: Powered by https://websumo.com