v1

latestOpenAPI 3.0.02026-07-174565114.3 KB
v1

Generate suggestions for a message

Generate AI-powered suggestions for the next action based on the thread context. Suggestions are persisted and can be retrieved later via the list endpoint. Calling this endpoint replaces any existing suggestions for the message.

post/v1/threads/{threadId}/messages/{messageId}/suggestions

Path parameters

threadIdstring required
Example:thr_abc123xyz

Thread ID

messageIdstring required
Example:msg_xyz789abc

Message ID

Request body

userKeystring

Identifier for a user in your system. Required if no bearer token is provided.

maxSuggestionsnumber

Maximum number of suggestions to generate (1-10)

Example request

{
  "availableComponents": [
    {
      "name": "WeatherCard",
      "description": "Displays weather information for a location",
      "propsSchema": {
        "type": "object",
        "properties": {
          "temperature": {
            "type": "number"
          },
          "location": {
            "type": "string"
          },
          "unit": {
            "type": "string",
            "enum": [
              "celsius",
              "fahrenheit"
            ]
          }
        },
        "required": [
          "temperature",
          "location"
        ]
      }
    }
  ]
}

Response

Suggestions generated successfully

nextCursorstring

Cursor for the next page of results

hasMoreboolean required

Whether there are more results

Example response

{
  "suggestions": [
    {
      "id": "sug_123456789",
      "messageId": "msg_123456789",
      "title": "Add error handling",
      "detailedSuggestion": "Add try-catch block to handle potential API errors",
      "description": "Add try-catch block to handle potential API errors",
      "metadata": {
        "category": "error-handling",
        "priority": "high"
      }
    }
  ]
}