cURL
curl --request POST \
--url https://api.z.ai/api/v1/agents/async-result \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "<string>",
"async_id": "<string>"
}
'import requests
url = "https://api.z.ai/api/v1/agents/async-result"
payload = {
"agent_id": "<string>",
"async_id": "<string>"
}
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>', async_id: '<string>'})
};
fetch('https://api.z.ai/api/v1/agents/async-result', 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/async-result")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"<string>\",\n \"async_id\": \"<string>\"\n}")
.asString();{
"status": "<string>",
"agent_id": "<string>",
"async_id": "<string>",
"choices": [
{
"index": 123,
"finish_reason": "<string>",
"message": [
{
"role": "<string>",
"content": [
{
"type": "<string>",
"video_url": "<string>"
}
]
}
]
}
]
}{
"status": "<string>",
"agent_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}Agent API
Retrieve Result
This endpoint is used to query the result of an asynchronous request.
POST
/
v1
/
agents
/
async-result
cURL
curl --request POST \
--url https://api.z.ai/api/v1/agents/async-result \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "<string>",
"async_id": "<string>"
}
'import requests
url = "https://api.z.ai/api/v1/agents/async-result"
payload = {
"agent_id": "<string>",
"async_id": "<string>"
}
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>', async_id: '<string>'})
};
fetch('https://api.z.ai/api/v1/agents/async-result', 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/async-result")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"<string>\",\n \"async_id\": \"<string>\"\n}")
.asString();{
"status": "<string>",
"agent_id": "<string>",
"async_id": "<string>",
"choices": [
{
"index": 123,
"finish_reason": "<string>",
"message": [
{
"role": "<string>",
"content": [
{
"type": "<string>",
"video_url": "<string>"
}
]
}
]
}
]
}{
"status": "<string>",
"agent_id": "<string>",
"error": {
"code": "<string>",
"message": "<string>"
}
}Authorizations
Headers
Config desired response language for HTTP requests.
Available options:
en-US,en Example:
"en-US,en"
Body
application/json
Response
Processing successful
pending (processing), success (completed), failed (failed).
Agent ID
Asynchronous task ID.
Agent output.
Hide child attributes
Hide child attributes
Result index.
Reason for model inference termination. Can be ‘stop’, ‘tool_calls’, ‘length’, ‘sensitive’, or ‘network_error’.
Was this page helpful?