Send a follow-up message to a task
curl --request POST \
--url https://agents.nanonets.com/api/v1/tasks/{task_id}/message \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "<string>"
}
'import requests
url = "https://agents.nanonets.com/api/v1/tasks/{task_id}/message"
payload = { "message": "<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({message: '<string>'})
};
fetch('https://agents.nanonets.com/api/v1/tasks/{task_id}/message', 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://agents.nanonets.com/api/v1/tasks/{task_id}/message",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'message' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://agents.nanonets.com/api/v1/tasks/{task_id}/message"
payload := strings.NewReader("{\n \"message\": \"<string>\"\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))
}HttpResponse<String> response = Unirest.post("https://agents.nanonets.com/api/v1/tasks/{task_id}/message")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://agents.nanonets.com/api/v1/tasks/{task_id}/message")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"task_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"message": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}{
"error": "Invalid agent_id format"
}{
"error": "Invalid agent_id format"
}{
"error": "Invalid agent_id format"
}{
"error": "Invalid agent_id format"
}{
"error": "Invalid agent_id format"
}Tasks
Send task message
Append a user message to an existing task. Used when an agent is in
waiting_for_input (it called ask_user) or when continuing a conversational
task. The orchestrator queues a new_message event so the agent can resume.
The message is processed asynchronously — poll GET /v1/tasks/{task_id} to
observe the status change.
POST
/
api
/
v1
/
tasks
/
{task_id}
/
message
Send a follow-up message to a task
curl --request POST \
--url https://agents.nanonets.com/api/v1/tasks/{task_id}/message \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "<string>"
}
'import requests
url = "https://agents.nanonets.com/api/v1/tasks/{task_id}/message"
payload = { "message": "<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({message: '<string>'})
};
fetch('https://agents.nanonets.com/api/v1/tasks/{task_id}/message', 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://agents.nanonets.com/api/v1/tasks/{task_id}/message",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'message' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://agents.nanonets.com/api/v1/tasks/{task_id}/message"
payload := strings.NewReader("{\n \"message\": \"<string>\"\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))
}HttpResponse<String> response = Unirest.post("https://agents.nanonets.com/api/v1/tasks/{task_id}/message")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://agents.nanonets.com/api/v1/tasks/{task_id}/message")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"task_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"message": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}{
"error": "Invalid agent_id format"
}{
"error": "Invalid agent_id format"
}{
"error": "Invalid agent_id format"
}{
"error": "Invalid agent_id format"
}{
"error": "Invalid agent_id format"
}Authorizations
Workspace API key issued from the web app. Pass as
Authorization: Bearer YOUR_API_KEY.
Path Parameters
UUID of the task.
Body
application/json
Text to deliver to the agent as a user message.
Response
Message accepted and queued for the agent.
ID of the newly created task message.
Lifecycle status of a task.
pending— created, not yet picked upqueued— held back by admission control (agent at concurrent-task limit)running— being processed by the workerwaiting_for_input— agent calledask_user; reply withPOST /tasks/{id}/messageawaiting_review— agent is paused for human approval of a sensitive stepcompleted— terminal: finished successfullyfailed— terminal: errored outstopped— terminal: cancelled by a user or system
Available options:
pending, queued, running, waiting_for_input, awaiting_review, completed, failed, stopped Human-readable acknowledgement.