> ## Documentation Index
> Fetch the complete documentation index at: https://www.macaly.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Get status

> Poll the status of a chat workflow

Poll the status of a chat workflow. Useful for checking if a chat has finished processing without needing to maintain a streaming connection.

## Request

```
GET /api/chat/{chatId}/status
```

### Headers

| Header          | Required | Description         |
| --------------- | -------- | ------------------- |
| `Authorization` | Yes      | `Bearer macaly_...` |

### Path Parameters

| Parameter | Type   | Description                                |
| --------- | ------ | ------------------------------------------ |
| `chatId`  | string | The chat ID returned from `POST /api/chat` |

### Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl https://www.macaly.com/api/chat/abc123/status \
    -H "Authorization: Bearer macaly_abc123..."
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    `https://www.macaly.com/api/chat/${chatId}/status`,
    {
      headers: {
        'Authorization': 'Bearer macaly_abc123...',
      },
    }
  );

  const data = await response.json();
  console.log(data.status);
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      f'https://www.macaly.com/api/chat/{chat_id}/status',
      headers={
          'Authorization': 'Bearer macaly_abc123...',
      },
  )

  data = response.json()
  print(data['status'])
  ```
</CodeGroup>

## Response

```json theme={null}
{
  "chatId": "abc123",
  "url": "https://www.macaly.com/chat/abc123",
  "status": "completed",
  "result": {
    "content": "Here's what I built for you..."
  }
}
```

### Response Fields

| Field            | Type   | Description                                     |
| ---------------- | ------ | ----------------------------------------------- |
| `chatId`         | string | The chat ID                                     |
| `url`            | string | URL to view the chat in browser                 |
| `status`         | string | Current workflow status (see below)             |
| `result.content` | string | Final assistant message (only when `completed`) |
| `error.message`  | string | Error description (only when `failed`)          |

### Status Values

| Status               | Description                     |
| -------------------- | ------------------------------- |
| `running`            | Workflow is currently executing |
| `completed`          | Finished successfully           |
| `failed`             | Encountered an error            |
| `cancelled`          | Workflow was manually cancelled |
| `no_active_workflow` | No workflow found for this chat |

## Status Codes

| Status | Description                       |
| ------ | --------------------------------- |
| 200    | Success                           |
| 401    | Invalid or missing API key        |
| 403    | Chat does not belong to your team |
| 404    | Chat not found                    |

## Polling Pattern

```bash theme={null}
while true; do
  STATUS=$(curl -s https://www.macaly.com/api/chat/$CHAT_ID/status \
    -H "Authorization: Bearer macaly_...")

  echo "Status: $(echo $STATUS | jq -r .status)"

  if echo "$STATUS" | grep -q '"status":"completed"'; then
    echo "Done!"
    break
  fi

  sleep 2
done
```

## Next Steps

Once status is `completed`, you can:

1. **Deploy the app** using [`POST /api/chat/{chatId}/deploy`](/en/api/deploy)
