Skip to main content
POST
/
external
/
v1
/
ai
/
agent_graph
/
invoke_sync
Invoke (Sync)
curl --request POST \
  --url https://api.example.com/external/v1/ai/agent_graph/invoke_sync
import requests

url = "https://api.example.com/external/v1/ai/agent_graph/invoke_sync"

response = requests.post(url)

print(response.text)
const options = {method: 'POST'};

fetch('https://api.example.com/external/v1/ai/agent_graph/invoke_sync', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/external/v1/ai/agent_graph/invoke_sync",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.example.com/external/v1/ai/agent_graph/invoke_sync"

req, _ := http.NewRequest("POST", url, nil)

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.example.com/external/v1/ai/agent_graph/invoke_sync")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/external/v1/ai/agent_graph/invoke_sync")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
{
  "response.sessionId": "<string>",
  "response.responseEvents": [
    {}
  ]
}
Use this endpoint when you want the agent’s complete reply in a single JSON response rather than a streaming NDJSON body. Useful for server-to-server integrations where streaming is inconvenient. You must initialise a session before calling this endpoint.

Endpoint

POST https://api.connectly.ai/external/v1/ai/agent_graph/invoke_sync

Request body

Same as Invoke (Stream) — businessId, clientKey, sessionId, optional agentId, and inputEvents with the same supported event types.

Response

response.sessionId
string
The session ID for this conversation.
response.responseEvents
array
All agent response events returned in a single array. Each element contains exactly one event key:

Example

POST /external/v1/ai/agent_graph/invoke_sync HTTP/1.1
Host: api.connectly.ai
x-api-key: YOUR_API_KEY
Content-Type: application/json

{
  "businessId": "your-business-id",
  "clientKey": "customer-123",
  "sessionId": "your-session-id",
  "inputEvents": [
    {
      "messageEvent": {
        "role": "USER",
        "content": { "textContent": { "text": "What are your store hours?" } }
      }
    }
  ]
}
{
  "response": {
    "sessionId": "your-session-id",
    "responseEvents": [
      {
        "messageEvent": {
          "role": "ASSISTANT",
          "content": { "textContent": { "text": "We're open Monday–Friday, 9am–6pm." } }
        }
      }
    ]
  }
}