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

# Get AI Analysis Generation Status

> Poll the AI generation status endpoint to determine when cognitive roadmap analysis is completed, still processing, or has failed.

Use this endpoint to poll the status of AI-powered combined analysis for a cognitive roadmap. Call it repeatedly after requesting generation until the status is `completed` or `failed`. This is the only way to know when results are ready for retrieval.

## Endpoint

```http theme={"dark"}
GET https://braintest.ir/api/v2/roadmap/{token}/generate/status/
```

## Path Parameters

<ParamField path="token" type="string" required>
  The unique cognitive roadmap instance UUID.
</ParamField>

## Response Status Values

<ResponseField name="data.status" type="string">
  One of `processing`, `completed`, or `failed`.
</ResponseField>

| Status       | Meaning                       | Action                                                        |
| ------------ | ----------------------------- | ------------------------------------------------------------- |
| `processing` | Queued or actively generating | Continue polling                                              |
| `completed`  | Finished successfully         | Fetch results from `/result/json/` or `/result/html/`         |
| `failed`     | Generation failed             | Inspect `data.errors` and retry by calling `/generate/` again |

<ResponseField name="data.errors" type="array">
  Present only when `status` is `failed`. Contains validation or processing error messages.
</ResponseField>

## Example: Processing

```json theme={"dark"}
{
  "data": {
    "status": "processing"
  },
  "successful": true,
  "messages": []
}
```

## Example: Completed

```json theme={"dark"}
{
  "data": {
    "status": "completed"
  },
  "successful": true,
  "messages": []
}
```

## Example: Failed

```json theme={"dark"}
{
  "data": {
    "status": "failed",
    "errors": [
      "Insufficient completed tests for analysis."
    ]
  },
  "successful": true,
  "messages": []
}
```

## Polling Example

Use a loop with a delay between requests. A typical interval is 30 to 60 seconds.

```bash theme={"dark"}
TOKEN="b2c3d4e5-f6a7-8901-bcde-f12345678901"
API_KEY="YOUR_API_KEY"

while true; do
  RESPONSE=$(curl -s -X GET "https://braintest.ir/api/v2/roadmap/${TOKEN}/generate/status/" \
    -H "API-KEY: ${API_KEY}")
  STATUS=$(echo "$RESPONSE" | grep -o '"status": "[^"]*"' | cut -d'"' -f4)
  echo "Status: $STATUS"

  if [ "$STATUS" = "completed" ]; then
    echo "Analysis ready. Fetch results now."
    break
  elif [ "$STATUS" = "failed" ]; then
    echo "Analysis failed. Check errors and retry."
    break
  fi

  sleep 30
done
```

## Error Responses

| HTTP | Cause             |
| ---- | ----------------- |
| 404  | Roadmap not found |
