# Send a message to the factory copilot (rule-based; LLM-ready). Audit-logged. Returns a CopilotTurn. (/docs/api-reference/copilot/CopilotController_chat)

`POST /api/factories/{factoryId}/copilot/chat`

Base URL: https://api.xentr.ai

Authentication: bearer token (`Authorization: Bearer <token>`).

## Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `factoryId` | path | yes | string | Factory slug |

## Request body

Required.

Content type: `application/json`

```json
{
  "type": "object",
  "properties": {
    "conversationId": {
      "type": "string",
      "description": "Existing conversation id; omit to start a new one."
    },
    "message": {
      "type": "string",
      "description": "The user free-text message. Optional ONLY when confirming a pending action (confirmedActionId set)."
    },
    "confirmedActionId": {
      "type": "string",
      "description": "Confirm a previously-proposed action — echo the proposal actionId."
    },
    "actionInputs": {
      "type": "object",
      "description": "User-supplied values for an action's required fields (e.g. verify quantities)."
    },
    "attachments": {
      "description": "Up to 4 file attachments (images, PDF, CSV). Base64-encoded, no data: prefix.",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Original file name."
          },
          "mimeType": {
            "type": "string",
            "description": "MIME type of the attachment.",
            "enum": [
              "image/png",
              "image/jpeg",
              "image/webp",
              "image/gif",
              "application/pdf",
              "text/csv"
            ]
          },
          "dataBase64": {
            "type": "string",
            "description": "Base64-encoded file content (no data: prefix). Max ~10 MB."
          }
        }
      }
    }
  }
}
```

## Responses

### 201