AI 代理 API

您的代理几秒内
创建网站

一次 API 调用。您的 AI 代理获得实时 URL。发布 Figma 设计、共享文档或部署静态网站 — 以编程方式,无需人工干预。

agent.py
# Your AI agent creates a live website
response = requests.post("https://api.hiro.host/api/v1/external/projects",
    headers={"X-API-Key": API_KEY},
    json={"mode": "figma", "figmaUrl": url})

# → { "url": "https://my-design.hirohost.site" }

工作原理

三个步骤,零摩擦。

01

获取您的 API 密钥

从组织设置页面获取您的工作区 API 密钥。每个工作区一个密钥。

02

代理调用 API

向 /external/projects 发送 POST 请求,指定模式(figma、viewer 或 static)和可选配置。如果不指定子域名,将自动生成。

03

获取实时 URL

响应包含一个实时 URL,您的代理可以分享、嵌入或交给用户。随时通过 PATCH 更新项目。

API 示例

每种项目类型,一个端点。

Figma 嵌入、文档查看器、静态网站 — 全部通过同一个 POST 请求创建。您的代理选择模式。

Publish a Figma designpython
import requests

resp = requests.post(
    "https://api.hiro.host/api/v1/external/projects",
    headers={"X-API-Key": API_KEY},
    json={
        "mode": "figma",
        "figmaUrl": "https://www.figma.com/design/abc/My-Design",
    },
)
print(resp.json()["url"])
# → https://cedar-drift-bloom.hirohost.site
Create a document sitepython
resp = requests.post(
    "https://api.hiro.host/api/v1/external/projects",
    headers={"X-API-Key": API_KEY},
    json={
        "mode": "viewer",
        "subdomain": "quarterly-report",
    },
)
# Upload files to the project separately
print(resp.json()["url"])
# → https://quarterly-report.hirohost.site
Deploy a static sitepython
resp = requests.post(
    "https://api.hiro.host/api/v1/external/projects",
    headers={"X-API-Key": API_KEY},
    json={
        "mode": "static",
        "subdomain": "docs-preview",
        "spaFallback": True,
    },
)
# Upload ZIP/HTML to the project separately
print(resp.json()["url"])
# → https://docs-preview.hirohost.site
Update a projectpython
requests.patch(
    f"https://api.hiro.host/api/v1/external/projects/{uid}",
    headers={"X-API-Key": API_KEY},
    json={
        "password": "secret123",
        "isActive": True,
        "locale": "fr",
    },
)

Claude Code 技能

一键教会
您的代理。

复制下方技能并保存为 SKILL.md 文件。您的 Claude Code 代理将自动学会创建和管理 HIRO host 网站。

1

创建 ~/.claude/skills/hiro-publish/

2

将复制的内容粘贴到 SKILL.md

3

在 Claude Code 中使用 /hiro-publish 或让其自动激活

~/.claude/skills/hiro-publish/SKILL.md
---
name: hiro-publish
description: >-
  Create and manage websites on HIRO host via API.
  Use when the user wants to publish a Figma design, share a document,
  or deploy a static site to a live URL.
allowed-tools: Bash(curl *)
---

# HIRO host — Publish to web

You can create and manage live websites using the HIRO host API.

## Setup

The user must provide their API key. Ask for it if not provided.
Set it as a variable for the session:

```bash
export HIRO_API_KEY="<the user's API key>"
```

## Base URL

```
https://api.hiro.host/api/v1/external/projects
```

## Create a project

POST to the base URL. Supported modes: `figma`, `viewer`, `static`.

**Figma design:**
```bash
curl -s -X POST "$HIRO_BASE/api/v1/external/projects" \
  -H "X-API-Key: $HIRO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"mode": "figma", "figmaUrl": "<figma_url>"}'
```

**Document (viewer):**
```bash
curl -s -X POST "$HIRO_BASE/api/v1/external/projects" \
  -H "X-API-Key: $HIRO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"mode": "viewer", "subdomain": "<optional-name>"}'
```

**Static website:**
```bash
curl -s -X POST "$HIRO_BASE/api/v1/external/projects" \
  -H "X-API-Key: $HIRO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"mode": "static", "subdomain": "<optional-name>", "spaFallback": true}'
```

Omit `subdomain` to auto-generate a random one (e.g. cedar-drift-bloom).

## Update a project

PATCH with the project UID:

```bash
curl -s -X PATCH "$HIRO_BASE/api/v1/external/projects/<project_uid>" \
  -H "X-API-Key: $HIRO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"isActive": false, "password": "secret"}'
```

## Available fields

Create: `mode`, `subdomain`, `figmaUrl`, `isActive`, `locale`, `password`,
`emailCollectionEnabled`, `downloadsDisabled`, `spaFallback`, `actionMenu`.

Update: all of the above except `mode` and `subdomain`, plus `removePassword`.

## Response

Both endpoints return:
```json
{
  "uid": "...",
  "url": "https://<subdomain>.hirohost.site",
  "host": "...",
  "mode": "...",
  "isActive": true,
  ...
}
```

Always show the user the `url` from the response so they can visit their site.

准备好自动化了吗?

注册,从组织设置中获取您的 API 密钥,让您的代理开始发布。