> ## 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

> Kontrollera statusen för en chatts arbetsflöde

Kontrollerar statusen för en chatts arbetsflöde. Användbart när du vill veta om en chatt är klar utan att hålla en streamanslutning öppen.

## Anrop

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

### Headers

| Header | Obligatorisk | Beskrivning |
| - | - | - |
| `Authorization` | Ja | `Bearer macaly_...` |

### Sökvägsparametrar

| Parameter | Typ | Beskrivning |
| - | - | - |
| `chatId` | string | Chatt-ID som returnerades av `POST /api/chat` |

### Exempelanrop

<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>

## Svar

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

### Svarsfält

| Fält | Typ | Beskrivning |
| - | - | - |
| `chatId` | string | Chatt-ID |
| `url` | string | URL för att öppna chatten i webbläsaren |
| `status` | string | Arbetsflödets aktuella status (se nedan) |
| `result.content` | string | Assistentens slutliga meddelande (bara vid `completed`) |
| `error.message` | string | Felbeskrivning (bara vid `failed`) |

### Statusvärden

| Status | Beskrivning |
| - | - |
| `running` | Arbetsflödet körs just nu |
| `completed` | Slutfördes utan fel |
| `failed` | Ett fel uppstod |
| `cancelled` | Arbetsflödet avbröts manuellt |
| `no_active_workflow` | Inget arbetsflöde hittades för den här chatten |

## Statuskoder

| Status | Beskrivning |
| - | - |
| 200 | Lyckades |
| 401 | Ogiltig eller saknad API-nyckel |
| 403 | Chatten tillhör inte ditt team |
| 404 | Chatten hittades inte |

## Mönster för upprepad kontroll

```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
```

## Nästa steg

När statusen är `completed` kan du:

1. **Publicera appen** med [`POST /api/chat/{chatId}/deploy`](/docs/sv/api/deploy)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.