Assets

Upload an asset

Upload a file (image, font, PDF, etc). Provide base64 content OR a source_url (public HTTPS URL) — not both. source_url is recommended for DALL-E/Unsplash images. Always use the returned url field in your HTML.

post/papi/project/{projectId}/assets

Request

  • Base URL: https://api.websitepublisher.ai
  • URL: https://api.websitepublisher.ai/papi/project/{projectId}/assets
  • Auth: OAuth 2 (authorization code, authorization URL https://api.websitepublisher.ai/dapi/oauth/authorize, token URL https://api.websitepublisher.ai/dapi/oauth/token, scopes: read, write)

Path parameters

projectIdinteger required

Request body

slugstring required

Desired file path for the asset. Used for upload only — use the returned url field in your HTML.

contentstring

Base64 encoded file content (no data: prefix). Use this OR content_text OR source_url — exactly one.

content_textstring

Plain text content for text-based assets (JS, JSX, TS, TSX, CSS, JSON, SVG, TXT, HTML, XML, MD, CSV). Preferred over content (base64) for text files — saves ~33% tokens. Use this OR content OR source_url — exactly one.

source_urlstring uri

Public HTTPS URL to fetch the file from (e.g. DALL-E image URL, Unsplash). Use this OR content, not both. Supports images, PDF, fonts, ico. For CSS/SVG/JSON use content instead.

altstring

Alt text for images

Example request

{
  "slug": "images/logo.png",
  "source_url": "https://images.unsplash.com/photo-example.jpg"
}

Response

Uploaded

Changes

No recorded changes to this operation across all 1 revision of this API.