Skip to main content
Creates or updates the current user’s bot. The platform supports one bot per user today - the route is an upsert keyed on the session’s userId.

Request

Body

The LLM API key is not part of this body and must not be sent here. It’s envelope-encrypted at rest via a separate endpoint and never rides in a chat body. See BYO-key flow.

Behaviour

The route runs in a single Drizzle transaction:
  1. Update the user’s llm_provider and llm_model columns.
  2. Look up an existing bot for the user.
  3. If present, UPDATE it; return 200 OK.
  4. Otherwise INSERT; return 201 Created.

Responses

201 Created (first save)

Dates serialize as ISO-8601 YYYY-MM-DDThh:mm:ss.sssZ.

200 OK (subsequent saves)

Same shape, updatedAt advances.

400 Bad Request - invalid JSON

400 Bad Request - validation failure

401 Unauthorized

When no session cookie is attached or the session is invalid.

cURL

Notes

  • loadingMessages is set server-side at INSERT time from a default JSON literal. It is not part of the request body.
  • isActive defaults to true; bot enable/disable is managed from the dashboard.
  • Multi-bot support is planned (see the Roadmap).