Skip to main content
POST
/
v1
/
agents
/
conversation
cURL
curl --request POST \
  --url https://api.z.ai/api/v1/agents/conversation \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "agent_id": "<string>",
  "conversation_id": "<string>",
  "custom_variables": {
    "include_pdf": true,
    "pages": [
      {
        "position": 123,
        "width": 123,
        "height": 123
      }
    ]
  }
}
'
import requests

url = "https://api.z.ai/api/v1/agents/conversation"

payload = {
"agent_id": "<string>",
"conversation_id": "<string>",
"custom_variables": {
"include_pdf": True,
"pages": [
{
"position": 123,
"width": 123,
"height": 123
}
]
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_id: '<string>',
conversation_id: '<string>',
custom_variables: {include_pdf: true, pages: [{position: 123, width: 123, height: 123}]}
})
};

fetch('https://api.z.ai/api/v1/agents/conversation', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
HttpResponse<String> response = Unirest.post("https://api.z.ai/api/v1/agents/conversation")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"<string>\",\n \"conversation_id\": \"<string>\",\n \"custom_variables\": {\n \"include_pdf\": true,\n \"pages\": [\n {\n \"position\": 123,\n \"width\": 123,\n \"height\": 123\n }\n ]\n }\n}")
.asString();
{
  "conversation_id": "<string>",
  "agent_id": "<string>",
  "choices": [
    {
      "message": [
        {
          "role": "<string>",
          "content": [
            {
              "type": "<string>",
              "tag_cn": "<string>",
              "tag_en": "<string>",
              "file_url": "<string>",
              "image_url": "<string>"
            }
          ]
        }
      ]
    }
  ],
  "error": {
    "code": "<string>",
    "message": "<string>"
  }
}
{
"code": 123,
"message": "<string>"
}

Authorizations

Authorization
string
header
required

Use the following format for authentication: Bearer

Headers

Accept-Language
enum<string>
default:en-US,en

Config desired response language for HTTP requests.

Available options:
en-US,en
Example:

"en-US,en"

Body

application/json
agent_id
string

Agent ID

conversation_id
string

Conversation ID

custom_variables
object

Custom variables

Response

Processing successful

conversation_id
string

Conversation ID

agent_id
string

Agent ID

choices
object[]

Agent output.

error
object