# Get build

URL: https://docs.hanzo.ai/docs/openapi/platform/get-build-by-id

> Answers one build: its status, and for a failed build the reason.

`GET /v1/build/{id}`

> [Platform →](https://docs.hanzo.ai/docs/openapi/platform) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                        |
| ------------- | -------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/build/{id}`   |
| **Method**    | `GET`                                  |
| **Operation** | `get_build_by_id`                      |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY` |

Answers one build: its status, and for a failed build the reason.

A build belongs to the organization its credential names, so it is read by the
credential that could have asked for it, and another organization's build is
404 rather than 403: whether an id exists is not said to anyone it is not for.

## Request

1 field.

| Field | In   | Type   | Required | Description                          |
| ----- | ---- | ------ | -------- | ------------------------------------ |
| `id`  | path | string | yes      | ID is the build's id, from the path. |

## Response

| Status    | Body                     | Meaning |
| --------- | ------------------------ | ------- |
| `200`     | platform.runnerBuildResp | ok      |
| `default` | problem-details          | refused |

`200` body — 9 fields.

| Field        | In   | Type      | Always | Description                                                                                                                                                                       |
| ------------ | ---- | --------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `buildJobId` | body | string    | —      | BuildJobID is the queued build's id, and what its progress is read by.                                                                                                            |
| `image`      | body | string    | —      | Image is the ref the image lane will push.                                                                                                                                        |
| `index`      | body | string    | —      | Index is the binaries.json URL the artifact lane will publish.                                                                                                                    |
| `platforms`  | body | string\[] | —      | Platforms are the architectures the image lane will publish, echoed back.                                                                                                         |
| `reason`     | body | string    | —      | Reason is why a failed build failed, as the cluster said it: the solve's error line (`error: failed to solve: ...`), a container waiting on what it cannot have, or the deadline. |
| `runnerPool` | body | string    | —      | RunnerPool is the runner class the build was placed on.                                                                                                                           |
| `status`     | body | string    | —      | Status is `queued` until the build finishes, then `succeeded` or `failed`.                                                                                                        |
| `tags`       | body | string\[] | —      | Tags are the extra tags the image lane will write beside Image, onto the same manifest: the request's, deduplicated.                                                              |
| `target`     | body | string    | —      | Target is the multi-stage build target, echoed back.                                                                                                                              |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

`hanzo` has no subcommand for this operation — the CLI serves only what cloud's live route table confirms. Use HTTP or an SDK.

**SDK**

**.ts**

```ts
import { Configuration, PlatformApi } from 'hanzoai';

const api = new PlatformApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getBuildById({ id: 'id' });
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import PlatformApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = PlatformApi(client).get_build_by_id(id='id')
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.PlatformAPI.GetBuildById(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, platform_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = platform_api::get_build_by_id(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.PlatformApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new PlatformApi(client).getBuildById();
```

**HTTP**

```bash
curl https://api.hanzo.ai/v1/build/<id> \
  -H "Authorization: Bearer $HANZO_API_KEY"
```

**MCP**

MCP reaches **platform** through the `platform` tool, which names its 38 operations with its own verbs — this one among them, under a name only MCP declares. `describe` explains any of them:

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "get_build"
         }
       }
     }'
```

---

[Platform API](https://docs.hanzo.ai/docs/openapi/platform) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
