# Retrieve a chat

`GET https://stylor.ai/api/v1/chat/{chatId}`

- Authentication: private API key, sent as `Authorization: Bearer sgpt-sk-…::…`
- Rate-limit resource: `api.v1.chat.retrieve`
- Demo key: not accepted
- Deprecated: yes
- Web page: https://stylor.ai/guides/rest/v1/retrieve-chat

> **Retired.** This endpoint answers `410 Gone` and no longer works.
> It is documented for reference only; use the v2 agent API's
> [Chat](https://stylor.ai/guides/rest/v2/agent-chat.md) instead.

Fetch one chat with its complete message history. Assistant messages
include their slots; once you have called **Search** for a slot, its
`results` array holds the products that were attached, and once you
have generated compositions, `compositions` holds their ids.

While a streamed reply is still being generated, the trailing assistant
message is a placeholder whose `output_status` part carries
`generating: true`; the flag disappears when generation completes or
fails.

## Example request

```bash
curl -X GET "https://stylor.ai/api/v1/chat/YOUR_CHAT_ID" \
  -H "Authorization: Bearer $STYLOR_API_KEY"
```

## Path parameters

- `chatId` (string (uuid), required): The chat's id (a UUID). Surrounding whitespace is trimmed.

## Responses

### 200

The chat.

Content type `application/json`:

- `chat` (Chat, required): A conversation between a shopper and the stylist, as returned by Retrieve a chat.
  - `chatId` (string (uuid), required): Unique id of the chat. [example `"3f0c2a4e-8b1d-4c6a-9e2f-7a5b1c0d9e88"`]
  - `messages` (array<ChatMessage>, required): The ordered message thread. User turns come first; each stylist turn is an `assistant` message with three content parts.
    - `role` (string, required): Who wrote the message. `system` messages are passed to the model verbatim. [one of `"user"`, `"assistant"`, `"system"`; example `"user"`]
    - `content` (string | array<ChatMessageContentPart>, required): Plain text, or an array of content parts.
      - Option 1: string
      - Option 2: array<ChatMessageContentPart>
        - `type` (string, required): The kind of part. `input_*` parts are written by the shopper; `output_*` parts by the stylist. [one of `"input_text"`, `"input_image"`, `"output_text"`, `"output_slots"`, `"output_status"`]
        - `text` (string): The text. Required for `input_text` and `output_text`. [example `"I need a smart-casual outfit for a rooftop dinner."`]
        - `image_url` (string): Image reference for `input_image`. A public URL, a `data:` URI, or a Stylor image-delivery URL. [example `"https://example.com/inspiration.jpg"`]
        - `slots` (array<ChatSearchSlot | ChatOutfitCompositionsSlot>): The stylist's slots. Required for `output_slots`.
        - `status` (string): Outcome of the turn. Required for `output_status`. `needs_clarification` means the stylist asked a follow-up question and `slots` is empty. [one of `"resolved"`, `"needs_clarification"`]
        - `generating` (boolean): Server-managed, read-only. Present as `true` on the `output_status` part of an assistant message whose streamed reply is still in progress. Dropped from any message you send back in.
  - `createdAt` (string (date-time), required): When the chat was created. [example `"2026-09-12T14:03:11.412Z"`]
  - `updatedAt` (string (date-time), required): When the chat was last written to (a new message, slot results, or compositions). [example `"2026-09-12T14:09:48.907Z"`]

Example:

```json
{
  "chat": {
    "chatId": "3f0c2a4e-8b1d-4c6a-9e2f-7a5b1c0d9e88",
    "createdAt": "2026-09-12T14:03:11.412Z",
    "updatedAt": "2026-09-12T14:09:48.907Z",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "input_text",
            "text": "I need a smart-casual outfit for a rooftop dinner, budget around $300."
          }
        ]
      },
      {
        "role": "assistant",
        "content": [
          {
            "type": "output_text",
            "text": "For a rooftop dinner I'd pair a silk slip dress with a cropped leather jacket and strappy heels."
          },
          {
            "type": "output_slots",
            "slots": [
              {
                "id": "8066a68a-a39e-4d3e-993a-3887f6245032",
                "type": "search",
                "slot": "dress",
                "query": "black silk slip dress",
                "filters": {
                  "fit": [
                    "slim"
                  ],
                  "pattern": [
                    "solid"
                  ],
                  "material": [
                    "silk"
                  ],
                  "color_family": [
                    "black"
                  ],
                  "color_rgb": [
                    20,
                    20,
                    20
                  ],
                  "family": [
                    "dress"
                  ],
                  "exclude_terms": [
                    "maxi"
                  ],
                  "boost_terms": [
                    "silk"
                  ],
                  "minPrice": null,
                  "maxPrice": 180
                },
                "results": [
                  {
                    "itemId": "2f9d8c7b-6a5e-4d3c-b2a1-0f9e8d7c6b5a",
                    "description": "Black silk slip dress with cowl neck, midi length, slim fit, $165",
                    "displayOrder": 0
                  },
                  {
                    "itemId": "4e1a2b3c-5d6f-4a7b-8c9d-0e1f2a3b4c5d",
                    "description": "Satin bias-cut slip dress in onyx, adjustable straps, $149",
                    "displayOrder": 1
                  }
                ]
              },
              {
                "id": "5b2e9f40-3c7d-4e1a-9f6b-8d0c2a4e6f17",
                "type": "outfit_compositions",
                "results": [],
                "compositions": [
                  "9a8b7c6d-5e4f-4a3b-2c1d-0e9f8a7b6c5d"
                ]
              }
            ]
          },
          {
            "type": "output_status",
            "status": "resolved"
          }
        ]
      }
    ]
  }
}
```

## Errors

Every error is a JSON object with an `error` string. Match on the status code; the message is written for people.

| Status | Message | When |
| --- | --- | --- |
| 404 | Chat not found or you do not have permission to access it. | No chat with that id belongs to the organization. |
| 410 | This endpoint has been retired (v1/chat/[chatId]). | Always, for API callers. This check runs before authentication and consumes no quota. |
| 422 | A valid chatId is required. | The path segment is only whitespace (for example `%20`). |

### Shared authentication, quota and rate-limit errors

| Status | Message | When |
| --- | --- | --- |
| 401 | API key missing. | The `Authorization` header is absent, is not `Bearer <key>`, or the key does not have three dash-separated segments. |
| 401 | Authentication failed: public key is invalid or not recognized. | A public-key endpoint was called with a key that does not exist. |
| 401 | Authentication failed: private key provided instead of a public key. | A public-key endpoint was called with an `sgpt-sk-…` key. |
| 401 | Authentication failed: token is not recognized. | A private-key endpoint was called with a key whose lookup segment does not exist. |
| 401 | Authentication failed: private key is invalid. | A private-key endpoint was called with a key whose secret does not match. |
| 401 | Authentication failed: public key provided instead of a private key. | A private-key endpoint was called with an `sgpt-pk-…` key. |
| 401 | Authentication failed: bearer token format is invalid. | A private key was sent without its `::` lookup segment. |
| 401 | Authentication failed: API key could not be read. Regenerate the key. | The key's embedded organization data could not be decrypted or parsed. |
| 403 | Demo mode is not available for private-key routes. Demos are only supported with public API keys. | The demo key was sent to a private-key endpoint. |
| 403 | Demo mode is not supported on this API route. Check the documentation for available demo endpoints. | The demo key was sent to a public-key endpoint that opts out of demo mode. |
| 403 | No active subscription for this organization. | The organization that owns the key has no active subscription. |
| 403 | No quota found for organization "<organizationId>". | The organization has no quota record for the current billing period. |
| 403 | No entitlement for "<resource>". | The plan's quota template has no entry for this endpoint. |
| 403 | Access denied to "<resource>". | The plan's quota template turns this endpoint off. |
| 429 | Monthly quota exceeded for "<resource>" (<quota>/<quota> used). | The billing-period quota for this endpoint is exhausted. `Retry-After` gives the seconds until the period resets. |
| 429 | RPM limit exceeded for "<resource>" (<used>/<limit> used). | More than the allowed requests per minute were sent. `Retry-After` is 60. |
| 500 | Internal server error. | An unexpected failure on the server. The message is always this string; details are logged, never returned. Quota consumed by the request is refunded, as it is for every 5xx response. |
