# BinHTML API

BinHTML provides a REST API for publishing generated HTML artifacts and returning managed share links.

Last reviewed: 2026-05-18

Source-of-truth links:
- Canonical docs: https://binhtml.com/docs/api
- OpenAPI JSON: https://binhtml.com/openapi.json
- LLM full reference: https://binhtml.com/llms-full.txt

## Endpoint

POST https://binhtml.com/api/v1/artifacts

Send a BinHTML API key with the Authorization header:

```bash
Authorization: Bearer $BINHTML_API_KEY
```

The x-binhtml-api-key header is also supported.

## Publish request

Required fields:

- title: artifact title shown in BinHTML
- sourceHtml: complete HTML document to publish

Optional fields:

- projectName: groups related artifacts in the dashboard
- visibility: private or unlisted; defaults to unlisted
- expiresAt: optional future expiry date
- description: short artifact summary

Example:

```bash
curl -X POST https://binhtml.com/api/v1/artifacts \
  -H "Authorization: Bearer $BINHTML_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Agent report",
    "projectName": "Launch workspace",
    "visibility": "unlisted",
    "sourceHtml": "<!doctype html><html><body><h1>Report</h1></body></html>"
  }'
```

## Response

The publish response includes:

- artifact metadata, including id, slug, title, visibility, expiry, and project
- version metadata, including version number, source size, and render mode
- urls.share for the artifact share link
- urls.management for the dashboard artifact page
- urls.sourceDownload for downloading the source HTML

## Versions

POST https://binhtml.com/api/v1/artifacts/$ARTIFACT_ID/versions uploads a new version while keeping the same share URL.

## Project shares

- POST https://binhtml.com/api/v1/projects/share creates one project share link.
- GET https://binhtml.com/api/v1/projects/$PROJECT_ID/share inspects a project share link.
- DELETE https://binhtml.com/api/v1/projects/$PROJECT_ID/share disables a project share link.

Project share links are unlisted and noindex. They are meant for direct collaboration, not public search discovery.

## Limits and safety

Plan limits apply at publish time, including file size, retention, visibility options, project-link caps, and publish-rate limits. Builder project links are short-lived; Pro unlocks permanent project links. Generated HTML renders in a sandboxed BinHTML viewer.

Canonical human docs: https://binhtml.com/docs/api
OpenAPI JSON: https://binhtml.com/openapi.json
