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>"
}Agent API
Conversation History
This endpoint is used to query the agent conversation history.Only support slides_glm_agent
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
Headers
Config desired response language for HTTP requests.
Available options:
en-US,en Example:
"en-US,en"
Body
application/json
Agent ID
Conversation ID
Custom variables
Hide child attributes
Hide child attributes
Response
Processing successful
Conversation ID
Agent ID
Agent output.
Hide child attributes
Hide child attributes
Hide child attributes
Hide child attributes
Role: fixed as assistant.
Content metadata
Hide child attributes
Hide child attributes
Response Content type: file_url、image_url
CN Tag.
EN Tag.
Output file_url content when type is file_url
Output image_url content when type is image_url
Was this page helpful?
⌘I