Skip to content

Update Model Preference POST


Overview

Updates the user's preferred AI model setting.

Endpoint URL

POST /api/users/:userId/model-preference

Endpoint Data

Parameter Description Type Required
userId The user's unique identifier String Yes
This endpoint has no query parameters.
Property Description Type Required
modelId The model identifier to set as preferred String Yes
Example Body
{
  "modelId": "gpt-4"
}

Example Request

curl -X POST "http://localhost:3026/api/users/user-123/model-preference" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -b cookies.txt \
  --data '{
    "modelId": "gpt-4"
  }'

Example Response

HTTP/1.1 200 OK
Content-Type: application/json

{
  "data": {
    "userId": "user-123",
    "modelId": "gpt-4"
  }
}

Response Fields

Field Type Description
userId String User identifier
modelId String Updated preferred model identifier

Error Responses

Status Code Error Description
400 Bad Request Invalid model ID
401 Unauthorized Invalid or missing session
403 Forbidden Cannot update another user's preferences