API ReferenceapiaiPOST /v1/conversations/{id}/messages

POST /v1/conversations/\{id\}/messages

Service: ai · operationId: (none)

Required scopes

(no scope declared — review service config)

Path parameters

  • id (string) required

Request body

{
  "type": "object",
  "properties": {
    "role": {
      "type": "string",
      "enum": [
        "user",
        "assistant",
        "system",
        "tool"
      ]
    },
    "content": {
      "type": "string",
      "minLength": 1
    },
    "mode": {
      "type": "string",
      "enum": [
        "append",
        "chat-completion"
      ],
      "default": "append"
    }
  },
  "required": [
    "role",
    "content"
  ]
}

Responses

200 Message appended

{
  "type": "object",
  "properties": {
    "message": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "conversation_id": {
          "type": "string",
          "format": "uuid"
        },
        "role": {
          "type": "string",
          "enum": [
            "user",
            "assistant",
            "system",
            "tool"
          ]
        },
        "content": {
          "type": "string"
        },
        "tool_calls": {
          "type": [
            "array",
            "null"
          ],
          "items": {}
        },
        "token_usage": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "prompt_tokens": {
              "type": "number"
            },
            "completion_tokens": {
              "type": "number"
            },
            "total_tokens": {
              "type": "number"
            }
          },
          "required": [
            "prompt_tokens",
            "completion_tokens",
            "total_tokens"
          ]
        },
        "metadata": {
          "type": "object",
          "additionalProperties": {}
        },
        "created_at": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "conversation_id",
        "role",
        "content",
        "tool_calls",
        "token_usage",
        "metadata",
        "created_at"
      ]
    },
    "assistant_message": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "conversation_id": {
          "type": "string",
          "format": "uuid"
        },
        "role": {
          "type": "string",
          "enum": [
            "user",
            "assistant",
            "system",
            "tool"
          ]
        },
        "content": {
          "type": "string"
        },
        "tool_calls": {
          "type": [
            "array",
            "null"
          ],
          "items": {}
        },
        "token_usage": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "prompt_tokens": {
              "type": "number"
            },
            "completion_tokens": {
              "type": "number"
            },
            "total_tokens": {
              "type": "number"
            }
          },
          "required": [
            "prompt_tokens",
            "completion_tokens",
            "total_tokens"
          ]
        },
        "metadata": {
          "type": "object",
          "additionalProperties": {}
        },
        "created_at": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "conversation_id",
        "role",
        "content",
        "tool_calls",
        "token_usage",
        "metadata",
        "created_at"
      ]
    }
  },
  "required": [
    "message",
    "assistant_message"
  ]
}

404 Conversation not found

{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}

500 Server error

{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}

Example

curl -X POST https://ai.platform.loop.health/v1/conversations/{id}/messages \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ ... }'