Skip to Content
API reference

Publish

One call that creates an artifact, uploads it and — depending on the plan — releases it.

POST
/v1/publish

Authorization

bearerAuth
headerAuthorizationBearer <token>

A personal API token (pl4m_pat_…). The owner is resolved from the credential, never claimed by the caller.

Header Parameters

authorization?string|null

Request Body

application/json
  1. body

One-shot publish used by the MCP server and the CLI.

Either targets an existing artifact (artifact_id) or creates one (kind required), and carries exactly one source: inline files for a single HTML or JSX file, or an archive for a dist/ upload. Bytes are base64 inline, so this path suits anything that fits comfortably in one request; larger uploads use the explicit three-call flow, which takes the archive as a raw body.

archive?|

A zip or tar.gz, base64-encoded. This is how a dist/ upload arrives: one archive per publish, unpacked by the write service.

archive_format?|

Required with archive.

artifact_id?|null
description?|

One-paragraph summary. Shown in the built-in site index and used as the OG description fallback. Applied when this publish CREATES the artifact, the same as title and slug; use PATCH /v1/artifacts/{id} to change it afterwards.

files?array<>|

Inline files. Use this for a single HTML or JSX file.

kind?|null
owner_id?|

Which of your owners to act as. Defaults to your personal owner. Checked against your memberships before use: an owner you do not belong to returns FORBIDDEN, and a personal API token may only act as the owner it was minted for.

release?|

Free owners always release. Pro owners default to a draft.

runtime?|null
slug?|null
title?|null

Response Body

Successful Response

application/json
  1. response

A successful publish, release or rollback. version is the human-facing sequence number; version_id is the opaque id used in URLs and in later API calls.

artifact_id*Artifact Id
Formatuuid
code*Code

The artifact's short code, which is its live host label: the live URL is <code>.pl4m.site. Permanent and immutable, and not a credential — every request to it is still authorised. It sits next to url so a caller that needs the label does not have to take a URL apart to get it.

draft_host*Draft Host

The draft host label for this version. Always present, because a released version still has a draft host — that is how an owner previews exactly those bytes after the live pointer has moved on.

ok?Ok
Defaulttrue
preview_url?|

Set when the publish created a draft instead of releasing.

released*Released

True if live_version_id now points at this version.

url*Url

Content URL serving the live version.

version*Version
Range1 <= value
version_id*Version Id
Formatuuid
warnings?array<>
Example Request
curl -X POST 'https://app.pl4m.com/api/v1/publish' \  -H 'Authorization: Bearer ' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "artifact_id": "b7bd6bbb-c7f1-4314-8742-2aeeeece9d12",  "code": "string",  "draft_host": "string",  "ok": true,  "preview_url": "string",  "released": true,  "url": "string",  "version": 1,  "version_id": "9e94c502-ca41-4342-a7f7-af96b444512c",  "warnings": [    {      "code": "UNSUPPORTED_IMPORT",      "column": 1,      "file": "string",      "hint": "string",      "line": 1,      "message": "string"    }  ]}