Completion Messages

Send Completion Message

Changed on

Available for: Text Generator apps.

Sends a request to a text-generation app and returns the generated text.

post/completion-messages

Request

  • Base URL
    https://api.dify.ai/v1
  • URL
    https://api.dify.ai/v1/completion-messages
  • Auth
    HTTP bearer

Request body

CompletionRequest required(unresolved $ref)

Response

Successful response. The content type and structure depend on the response_mode parameter in the request.

  • If response_mode is blocking, returns application/json with a CompletionResponse object.
  • If response_mode is streaming, returns text/event-stream with a stream of ChunkCompletionEvent objects.
answerstring

Complete response content.

created_atinteger

Message creation timestamp (Unix epoch seconds).

eventstring

Event type, fixed as message.

idstring uuid

Unique ID of this response event.

message_idstring uuid

Unique message ID. Use this as the message_id parameter when calling feedback or suggested questions endpoints.

modestring

App mode, fixed as completion.

task_idstring uuid

Task ID for request tracking and the Stop Completion Message Generation API.

Changes

    • info

      added the optional property /// to the response with the status

    • info

      added the optional property /// to the response with the status

    • info

      added the optional property /// to the response with the status