# Sessions, Profile & Limits

Chat sessions are persistent, named, durable records — messages survive restarts and can be reloaded any time. A session belongs to the authenticated user; other users cannot read, modify, or delete it.

**Endpoints:**

| Method | Path | Description |
|--------|------|-------------|
| `GET` | `/api/trainer/history` | Load a conversation's message history |
| `POST` | `/api/trainer/sessions` | Create a named chat session (`{ "title": "Leg day planning" }`, max 255 chars) |
| `GET` | `/api/trainer/sessions` | List the user's sessions, most recently active first |
| `PATCH` | `/api/trainer/sessions/:id` | Rename a session |
| `DELETE` | `/api/trainer/sessions/:id` | Delete a session (also clears its in-progress planning state) |
| `GET` | `/api/trainer/profile` | Get the stored fitness profile (`404` if none yet) |
| `PUT` | `/api/trainer/profile` | Create or update the fitness profile |

**History** (`GET /api/trainer/history?session_id=…&limit=50`, limit capped at 100) — use it to restore chat UI state on app startup. Assistant messages carry `metadata.intent`, `metadata.action`, and — when the turn produced a plan — the full `metadata.workout_plan`, so you can re-render plans from history alone. If the user has no sessions yet the response is `{ "messages": [] }`; it never creates a session.

```json
{
  "conversation_id": "9c1e37a2-…",
  "title": "New Chat",
  "messages": [
    { "role": "user", "content": "make me a chest workout", "created_at": "2026-07-14T10:00:00Z" },
    {
      "role": "assistant",
      "content": "Here's your chest workout! …",
      "metadata": { "intent": "CREATE_WORKOUT", "action": "WORKOUT_UPDATED", "workout_plan": { } },
      "created_at": "2026-07-14T10:00:05Z"
    }
  ]
}
```

**Rate limits:**

| Limit | Scope | On exceed |
|-------|-------|-----------|
| 50 workout generations / day | per user (resets at UTC midnight) | `429` |
| 50 refinements / workout | per workout plan | `429` — confirm the current plan or start a new workout |
| 50 chat sessions | per user | `400` on session create |
| Company-level daily quota | per company | `429` |

Undo/redo do **not** count against the refinement limit. Higher limits are available — [contact KinesteX](/#contact-form).

---
Source: https://www.kinestex.com/docs/trainer-api/trainer-api-sessions · Index: https://www.kinestex.com/llms.txt
