REST API
Everything the dashboard does, the API does: create sites, publish HTML, manage versions and domains. Base URL: https://public-it.com/api — JSON in and out.
Authentication
Use an API key in the header (create one at Dashboard → API & MCP):
Authorization: Bearer pit_your_key_here
Example: publish an artifact
# 1. Create the site (once)
curl -X POST https://public-it.com/api/sites \
-H "Authorization: Bearer pit_..." \
-H "Content-Type: application/json" \
-d '{"name": "My Dashboard", "subdomain": "my-dashboard"}'
# 2. Publish the HTML (every publish = new version)
curl -X POST https://public-it.com/api/sites/SITE_ID/publish \
-H "Authorization: Bearer pit_..." \
-H "Content-Type: application/json" \
-d '{"type": "inline", "html": "<!DOCTYPE html><html>...</html>"}'
# → { "publication": { "version": 1, "status": "live" },
# "url": "https://my-dashboard.public-it.com" }
Endpoints
| Method | Route | Description |
|---|---|---|
GET | /api/sites | List the user's sites. |
POST | /api/sites | Create a site. { "name": "Meu site", "subdomain": "meu-site" } |
GET | /api/sites/:id | Get one site. |
DELETE | /api/sites/:id | Delete a site, its versions and files (irreversible). |
POST | /api/sites/:id/publish | Publish inline HTML (new live version) or finalize a ZIP upload. { "type": "inline", "html": "<!DOCTYPE html>..." } |
POST | /api/sites/:id/publications | Start a ZIP publication (validates quota/paths; returns the upload prefix). { "files": [{ "path": "index.html", "size": 1234 }] } |
GET | /api/sites/:id/publications | Version history of the site. |
POST | /api/sites/:id/rollback | Restore an archived version (paid plans). { "publicationId": "uuid" } |
GET | /api/sites/:id/domain | Custom-domain status (expected TXT/CNAME). |
POST | /api/sites/:id/domain | Connect a custom domain (paid plans). { "domain": "meusite.com" } |
POST | /api/sites/:id/domain/verify | Verify the domain DNS (TXT) and activate it. |
GET | /api/me | The user's plan and usage (sites, storage, traffic). |
GET | /api/keys | List active API keys. |
POST | /api/keys | Create an API key (the full value is shown only once). { "name": "minha-chave" } |
DELETE | /api/keys/:id | Revoke a key. |
Errors
Every failure uses the same envelope:
{ "error": { "code": "quota_exceeded", "message": "Your Free plan allows up to 1 site(s)..." } }
| Status | Code | When |
|---|---|---|
| 401 | unauthorized / invalid_api_key | Missing header, invalid or revoked key |
| 402 | quota_exceeded / plan_required | Plan quota reached or paid-plan feature |
| 404 | not_found | Resource doesn't exist or belongs to another user |
| 409 | subdomain_taken / domain_taken | Address already in use |
| 400 | validation_error | Invalid request body |
Limits
Sites, storage (shared across the account's sites) and monthly traffic vary by plan — see the plans. Inline HTML up to 5 MB per publish; ZIPs up to 2,000 files.