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

# POST /api/v1/chat

> Send a user message to your assistant and receive a reply.

The main way to talk to your Promptify assistant is via `POST /api/v1/chat`.

## Request

* **Method**: `POST`
* **Path**: `/api/v1/chat`
* **Auth**: `Authorization: Bearer <access_token>`
* **Body**:

```json theme={null}
{
  "message": "How do I reset my password?",
  "conversationId": "optional-conversation-id"
}
```

### Example – cURL

```bash theme={null}
curl -X POST https://app.promptify.one/api/v1/chat \
  -H "Authorization: Bearer $PROMPTIFY_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "How do I reset my password?"
  }'
```

### Example – JavaScript (fetch)

```ts theme={null}
const res = await fetch("https://app.promptify.one/api/v1/chat", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.PROMPTIFY_ACCESS_TOKEN!}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    message: "How do I reset my password?",
  }),
});

const data = await res.json();
console.log(data.reply, data.model);
```

### Example – Python

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

token = os.environ["PROMPTIFY_ACCESS_TOKEN"]

resp = requests.post(
    "https://app.promptify.one/api/v1/chat",
    headers={
        "Authorization": f"Bearer {token}",
        "Content-Type": "application/json",
    },
    json={"message": "How do I reset my password?"},
)

data = resp.json()
print(data["reply"], data["model"])
```

## Response

On success (`200 OK`):

```json theme={null}
{
  "reply": "Here’s how you can reset your password…",
  "model": "ft:gpt-4o-mini:promptify:customer-success:2025-01-01",
  "isFineTuned": true,
  "usage": {
    "promptTokens": 123,
    "completionTokens": 45,
    "totalTokens": 168
  },
  "latencyMs": 732
}
```

Errors are returned in a structured form:

```json theme={null}
{
  "error": {
    "code": "NO_ASSISTANT",
    "message": "No assistant configured. Complete onboarding first."
  }
}
```
