## Get a generation status

`GET /v1/sites/ai/status`

Reads the current state of a generation started by the same user.

## Parameters

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `id` (query) | number | yes | — | Generation identifier from [start](./generate.md) |

## Examples

### curl — personal key

```bash
curl -X GET "https://vibecode.bitrix24.com/v1/sites/ai/status?id=11" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X GET "https://vibecode.bitrix24.com/v1/sites/ai/status?id=11" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const res = await fetch("https://vibecode.bitrix24.com/v1/sites/ai/status?id=11", {
  "method": "GET",
  "headers": {
    "X-Api-Key": "YOUR_API_KEY"
  }
});
const result = await res.json();
console.log(result);
```

### JavaScript — OAuth application

```javascript
const res = await fetch("https://vibecode.bitrix24.com/v1/sites/ai/status?id=11", {
  "method": "GET",
  "headers": {
    "X-Api-Key": "YOUR_APP_KEY",
    "Authorization": "Bearer USER_SESSION_TOKEN"
  }
});
const result = await res.json();
console.log(result);
```

## Response fields

| Field | Type | Description |
|---|---|---|
| `success` | boolean | `true` on success |
| `data` | object | Generation state |
| `data.id` | number | Generation identifier |
| `data.status` | string | `running`, `completed` or `failed` |
| `data.siteId` | number | Generated site identifier, 0 until created; [sites](../get.md) |
| `data.pageId` | number | Generated page identifier, 0 until created; [pages](/docs/entities/pages/get) |
| `data.draftSiteId` | number | Draft site identifier on failure, 0 otherwise |
| `data.draftPageId` | number | Draft page identifier on failure, 0 otherwise |
| `data.message` | string | Human-readable state; use status for branching |
| `data.error` | string \| null | Failure reason or null |
| `data.errorDetails` | string \| null | Request-limit detail or null |

## Response example

```json
{
  "success": true,
  "data": {
    "id": 11,
    "status": "running",
    "siteId": 0,
    "pageId": 0,
    "draftSiteId": 0,
    "draftPageId": 0,
    "message": "Generating a site",
    "error": null,
    "errorDetails": null
  }
}
```

## Error response example

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "The action could not be completed. Check the identifier",
    "b24Code": "LANDING_AI_SITE_GENERATION_NOT_FOUND"
  }
}
```

## Errors

| HTTP | Code | Description |
|---|---|---|
| 400 | `INVALID_PARAMS` | Bitrix24 refused the request |
| 401 | `MISSING_API_KEY`, `INVALID_API_KEY`, `TOKEN_MISSING` | Missing or unusable credentials |
| 403 | `SCOPE_DENIED` | The key lacks the landing scope |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key forbids writes |
| 422 | `BITRIX_ERROR` | Missing generation or a generation of another user; `b24Code` is `LANDING_AI_SITE_GENERATION_NOT_FOUND` |

[Common errors](/docs/errors).

## Known specifics

Reading a completed or failed generation can make Bitrix24 finalize or release the draft binding and record a moderation refusal. Checking the status therefore requires write access; a READONLY key receives `403 WRITE_BLOCKED_READONLY_KEY`. The platform does not retry a status request after a 5xx error.

Calls run as the webhook owner or the user whose OAuth token the key uses. Read the result through [generation status](./status.md): `running`, `completed` or `failed`.

## See also

- [AI site generation](../ai.md)
