> This page is for version v1 (default).
> For other versions, use one of these documentation indexes:
> - v1 (default): https://docs.butterix.com/llms.txt
> - v0: https://docs.butterix.com/v0/llms.txt

> For the MDX source of any page, append .mdx to the page URL.
> For a complete documentation index, see https://docs.butterix.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.butterix.com/_mcp/server.
> If something on this page is wrong or missing, POST JSON {"page": "<page URL>", "message": "<what is wrong>"} to https://docs.butterix.com/_biti/feedback/agent.

# 获取部署

`GET /deployments/{id}`

部署详情与构建日志。构建进行中时 `log` 是实时日志。

Base URL: https://api.butterix.com/v1

Authentication: bearer token in Authorization header or API key in cookie `biti_session`

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes |  |

## Example request

```bash
curl https://api.butterix.com/v1/deployments/dpl_01jd8x2k7q \
     -H "Authorization: Bearer <token>"
```

## Responses

### 200

部署

Content type: `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string | no |  |
| `siteId` | string | no |  |
| `kind` | enum | no | Allowed: `production`, `preview`. |
| `status` | enum | no | Allowed: `queued`, `building`, `ready`, `failed`, `canceled`. |
| `source` | string | no | `cli`（上传）、`hosted`（托管仓库）或 `git` |
| `branch` | string | no |  |
| `commitSha` | string | no |  |
| `message` | string | no |  |
| `createdBy` | object | no | 触发者；用 API Key 触发时是创建密钥的人 |
| `createdBy.id` | string | no |  |
| `createdBy.name` | string | no |  |
| `apiKey` | object | no | 用 API Key（CLI / CI）触发时，密钥的名称与首尾 |
| `apiKey.name` | string | no |  |
| `apiKey.prefix` | string | no | 密钥前 10 个字符 |
| `apiKey.suffix` | string | no | 密钥末尾 10 个字符 |
| `error` | string | no | 失败原因 |
| `pageCount` | integer | no |  |
| `sizeBytes` | integer | no |  |
| `durationMs` | integer | no |  |
| `url` | URL | no | 成功后才有。生产部署是站点地址，预览部署是 `<site>--<id 后 8 位>` 子域名 |
| `isCurrent` | boolean | no | 是否为当前生产部署 |
| `createdAt` | integer | no |  |
| `finishedAt` | integer | no |  |
| `log` | string | no | 构建日志 |

### 404

资源不存在，或你没有访问权限

Content type: `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | string | yes | 人类可读的错误信息 |
| `code` | string | no | 机器可读的错误码（部分接口提供） |

### Example response (200)

```json
{
  "id": "dpl_01jd8x2k7q",
  "siteId": "site_2m4k8p",
  "kind": "production",
  "status": "queued",
  "source": "git",
  "branch": "main",
  "commitSha": "9fceb02d0ae598e95dc970b74767f19372d61af8",
  "message": "docs: 更新快速开始",
  "createdBy": {
    "id": "string",
    "name": "string"
  },
  "apiKey": {
    "name": "GitHub Actions",
    "prefix": "biti_a1B2c",
    "suffix": "Kd82mQx0Zt"
  },
  "error": "string",
  "pageCount": 94,
  "sizeBytes": 5832110,
  "durationMs": 6120,
  "url": "https://acme-payments--8x2k7q-sites.butterix.com",
  "isCurrent": true,
  "createdAt": 1,
  "finishedAt": 1,
  "log": "string"
}
```
