# Publish a site to The Website Company A designer can hand you one sentence and an access code. This page is public so you can read it without signing in. It never contains an access code. API host: `https://the-website-company.vercel.app`. ## What you need from the designer 1. The site id, inside the URLs, like `https://the-website-company.vercel.app/api/sites/<siteId>/files`. 2. The access code. It starts with `twc_live_`. Send it only as `Authorization: Bearer <access code>`. Do not put it in chat, tickets, URLs, or a repository. The code can upload files, read status, and read assets for that one site. ## 1. Upload `POST https://the-website-company.vercel.app/api/sites/<siteId>/files` JSON: ```json {"files":[{"path":"index.html","content":"<!doctype html><title>Harbor</title><h1>Hello</h1>"}]} ``` Or a zip, multipart field `file`, up to 50 MB and 2,000 files. Include `index.html`. Where the upload goes is the designer's choice on the project page: - **Live site** (the default) stores the files and the preview is ready. - **Preview only** stores a preview and does not replace the live files. - **Hold until I publish** accepts the upload and deploys nothing. The response is HTTP 202 with `state` `held`. That is a normal answer, not an error. Do not send it again. This server publishes the files it receives. It does not run a framework build. Upload the built site, including `index.html`. ## 2. Check status `GET https://the-website-company.vercel.app/api/sites/<siteId>/status` `state` is `waiting`, `building`, `ready`, `needs_fix`, or `held`. `previewUrl` is set when the preview is ready. Poll every few seconds, no faster than 30 requests a minute. Uploads are limited to 10 a minute. ## Assets `GET https://the-website-company.vercel.app/api/sites/<siteId>/assets` returns logos, photos, and copy the client sent, so you can use them while you build. ## Errors `401` means the access code is missing or wrong. `403` means it is for a different site. `413` means the upload is too large. `429` means slow down. Errors are JSON with an `error` sentence. ## curl ``` ORIGIN="https://the-website-company.vercel.app" SITE_ID="your_site_id" TOKEN="twc_live_..." curl -sS -X POST "$ORIGIN/api/sites/$SITE_ID/files" \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{"files":[{"path":"index.html","content":"<!doctype html><h1>Hello</h1>"}]}' curl -sS -X POST "$ORIGIN/api/sites/$SITE_ID/files" \ -H "Authorization: Bearer $TOKEN" \ -F "file=@site.zip" curl -sS "$ORIGIN/api/sites/$SITE_ID/status" \ -H "Authorization: Bearer $TOKEN" ```