cURL
curl -X POST "https://app.cotool.ai/api/agents/:agentId/run-sync" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"inputs":null,"attachments":[{"fileId":"string","fileName":"string","size":0,"fileType":"image","previewText":"string"}]}'import requests
url = "https://app.cotool.ai/api/agents/{agentId}/run-sync"
payload = {
"inputs": {},
"attachments": [
{
"fileId": "<string>",
"fileName": "<string>",
"size": 123,
"previewText": "<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({
inputs: {},
attachments: [{fileId: '<string>', fileName: '<string>', size: 123, previewText: '<string>'}]
})
};
fetch('https://app.cotool.ai/api/agents/{agentId}/run-sync', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://app.cotool.ai/api/agents/{agentId}/run-sync")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"inputs\": {},\n \"attachments\": [\n {\n \"fileId\": \"<string>\",\n \"fileName\": \"<string>\",\n \"size\": 123,\n \"previewText\": \"<string>\"\n }\n ]\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.cotool.ai/api/agents/{agentId}/run-sync"
payload := strings.NewReader("{\n \"inputs\": {},\n \"attachments\": [\n {\n \"fileId\": \"<string>\",\n \"fileName\": \"<string>\",\n \"size\": 123,\n \"previewText\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"finalAssistantMessage": "<string>",
"allToolCallsMade": [
{
"type": "tool-call",
"toolCallId": "<string>",
"toolName": "<string>",
"args": "<unknown>"
}
],
"allToolResultsReceived": [
{
"type": "tool-result",
"toolCallId": "<string>",
"toolName": "<string>",
"result": "<unknown>",
"isError": true
}
],
"messages": [
{
"role": "system",
"content": "<string>"
}
],
"structuredOutputResult": "<string>"
}{
"error": "<string>",
"issues": [
{}
]
}{
"error": "<string>"
}{
"error": "<string>",
"missingPerms": [
"<string>"
]
}{
"error": "<string>"
}Agents
Run agent synchronously
Execute an agent run in a blocking manner and return the complete result once finished.
POST
/
api
/
agents
/
{agentId}
/
run-sync
cURL
curl -X POST "https://app.cotool.ai/api/agents/:agentId/run-sync" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"inputs":null,"attachments":[{"fileId":"string","fileName":"string","size":0,"fileType":"image","previewText":"string"}]}'import requests
url = "https://app.cotool.ai/api/agents/{agentId}/run-sync"
payload = {
"inputs": {},
"attachments": [
{
"fileId": "<string>",
"fileName": "<string>",
"size": 123,
"previewText": "<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({
inputs: {},
attachments: [{fileId: '<string>', fileName: '<string>', size: 123, previewText: '<string>'}]
})
};
fetch('https://app.cotool.ai/api/agents/{agentId}/run-sync', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://app.cotool.ai/api/agents/{agentId}/run-sync")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"inputs\": {},\n \"attachments\": [\n {\n \"fileId\": \"<string>\",\n \"fileName\": \"<string>\",\n \"size\": 123,\n \"previewText\": \"<string>\"\n }\n ]\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.cotool.ai/api/agents/{agentId}/run-sync"
payload := strings.NewReader("{\n \"inputs\": {},\n \"attachments\": [\n {\n \"fileId\": \"<string>\",\n \"fileName\": \"<string>\",\n \"size\": 123,\n \"previewText\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"finalAssistantMessage": "<string>",
"allToolCallsMade": [
{
"type": "tool-call",
"toolCallId": "<string>",
"toolName": "<string>",
"args": "<unknown>"
}
],
"allToolResultsReceived": [
{
"type": "tool-result",
"toolCallId": "<string>",
"toolName": "<string>",
"result": "<unknown>",
"isError": true
}
],
"messages": [
{
"role": "system",
"content": "<string>"
}
],
"structuredOutputResult": "<string>"
}{
"error": "<string>",
"issues": [
{}
]
}{
"error": "<string>"
}{
"error": "<string>",
"missingPerms": [
"<string>"
]
}{
"error": "<string>"
}Authorizations
API Key authentication for programmatic access. Include your API key in the Authorization header as: Bearer your_api_key_here
Path Parameters
Unique identifier of the agent to execute
Body
application/json
Response
Successful response
Complete result of synchronous agent execution
The final text response from the assistant
All tool calls made during the agent run
Show child attributes
Show child attributes
All tool results received during the agent run
Show child attributes
Show child attributes
Complete message history from the agent run
- Option 1
- Option 2
- Option 3
- Option 4
Show child attributes
Show child attributes
Structured output generated after the run, if available
Was this page helpful?
⌘I