curl --request POST \
--url https://api.relayapp.im/v1/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"conversation_id": "cnv_01JZC7K4RQ",
"invocation_id": "ivk_01k1m4q9vn2r7t9b4c6qdh8xwy",
"parts": [
{
"type": "<string>",
"text": "<string>"
}
],
"reply_to": {
"message_id": "msg_01JZM3T8AH",
"part_index": 0
},
"suggestions": [
{
"text": "Everyone"
}
]
}
'import requests
url = "https://api.relayapp.im/v1/messages"
payload = {
"conversation_id": "cnv_01JZC7K4RQ",
"invocation_id": "ivk_01k1m4q9vn2r7t9b4c6qdh8xwy",
"parts": [
{
"type": "<string>",
"text": "<string>"
}
],
"reply_to": {
"message_id": "msg_01JZM3T8AH",
"part_index": 0
},
"suggestions": [{ "text": "Everyone" }]
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
conversation_id: 'cnv_01JZC7K4RQ',
invocation_id: 'ivk_01k1m4q9vn2r7t9b4c6qdh8xwy',
parts: [{type: '<string>', text: '<string>'}],
reply_to: {message_id: 'msg_01JZM3T8AH', part_index: 0},
suggestions: [{text: 'Everyone'}]
})
};
fetch('https://api.relayapp.im/v1/messages', 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.relayapp.im/v1/messages",
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([
'conversation_id' => 'cnv_01JZC7K4RQ',
'invocation_id' => 'ivk_01k1m4q9vn2r7t9b4c6qdh8xwy',
'parts' => [
[
'type' => '<string>',
'text' => '<string>'
]
],
'reply_to' => [
'message_id' => 'msg_01JZM3T8AH',
'part_index' => 0
],
'suggestions' => [
[
'text' => 'Everyone'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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://api.relayapp.im/v1/messages"
payload := strings.NewReader("{\n \"conversation_id\": \"cnv_01JZC7K4RQ\",\n \"invocation_id\": \"ivk_01k1m4q9vn2r7t9b4c6qdh8xwy\",\n \"parts\": [\n {\n \"type\": \"<string>\",\n \"text\": \"<string>\"\n }\n ],\n \"reply_to\": {\n \"message_id\": \"msg_01JZM3T8AH\",\n \"part_index\": 0\n },\n \"suggestions\": [\n {\n \"text\": \"Everyone\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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://api.relayapp.im/v1/messages")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"conversation_id\": \"cnv_01JZC7K4RQ\",\n \"invocation_id\": \"ivk_01k1m4q9vn2r7t9b4c6qdh8xwy\",\n \"parts\": [\n {\n \"type\": \"<string>\",\n \"text\": \"<string>\"\n }\n ],\n \"reply_to\": {\n \"message_id\": \"msg_01JZM3T8AH\",\n \"part_index\": 0\n },\n \"suggestions\": [\n {\n \"text\": \"Everyone\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.relayapp.im/v1/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"conversation_id\": \"cnv_01JZC7K4RQ\",\n \"invocation_id\": \"ivk_01k1m4q9vn2r7t9b4c6qdh8xwy\",\n \"parts\": [\n {\n \"type\": \"<string>\",\n \"text\": \"<string>\"\n }\n ],\n \"reply_to\": {\n \"message_id\": \"msg_01JZM3T8AH\",\n \"part_index\": 0\n },\n \"suggestions\": [\n {\n \"text\": \"Everyone\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"message_id": "msg_01JZM4Q9VN",
"message": {
"id": "msg_01JZM3T8AH",
"conversation_id": "cnv_01JZC7K4RQ",
"sequence": 123,
"sender": {
"id": "usr_01JZU1F0BD"
},
"parts": [
{
"part_index": 1,
"type": "<string>",
"text": "<string>"
}
],
"fallback_text": "<string>",
"status": "sent",
"created_at": "2023-11-07T05:31:56Z",
"reply_to": {
"message_id": "msg_01JZM3T8AH",
"part_index": 0
},
"invoked_agents": [
"<string>"
],
"suggestions": [
{
"text": "Everyone"
}
],
"reactions": [
{
"part_index": 1,
"emoji": "<string>",
"actor_id": "<string>"
}
],
"delivered_at": "2023-11-07T05:31:56Z",
"read_at": "2023-11-07T05:31:56Z",
"edited_at": "2023-11-07T05:31:56Z",
"revisions": [
{
"parts": [
{
"part_index": 1,
"type": "<string>",
"text": "<string>"
}
],
"fallback_text": "<string>",
"replaced_at": "2023-11-07T05:31:56Z"
}
]
},
"stream": {
"protocol": "<string>",
"source_message_id": "<string>",
"finish_reason": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "conversation_id is required"
}
}{
"error": {
"code": "invalid_request",
"message": "conversation_id is required"
}
}{
"error": {
"code": "invalid_request",
"message": "conversation_id is required"
}
}{
"error": {
"code": "invalid_request",
"message": "conversation_id is required"
}
}{
"error": {
"code": "invalid_request",
"message": "conversation_id is required"
}
}{
"error": {
"code": "invalid_request",
"message": "conversation_id is required"
}
}Send a message
Send a message as the authenticated agent. Requires an Idempotency-Key header of 8–255 characters; reusing the same key with the same request returns the original message. To pipe native agent output, set stream=true and pipe a Vercel AI SDK UIMessageStream v1 SSE body into this same request. Relay commits one canonical message after the stream’s semantic finish event; recipients receive that final committed message.
curl --request POST \
--url https://api.relayapp.im/v1/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"conversation_id": "cnv_01JZC7K4RQ",
"invocation_id": "ivk_01k1m4q9vn2r7t9b4c6qdh8xwy",
"parts": [
{
"type": "<string>",
"text": "<string>"
}
],
"reply_to": {
"message_id": "msg_01JZM3T8AH",
"part_index": 0
},
"suggestions": [
{
"text": "Everyone"
}
]
}
'import requests
url = "https://api.relayapp.im/v1/messages"
payload = {
"conversation_id": "cnv_01JZC7K4RQ",
"invocation_id": "ivk_01k1m4q9vn2r7t9b4c6qdh8xwy",
"parts": [
{
"type": "<string>",
"text": "<string>"
}
],
"reply_to": {
"message_id": "msg_01JZM3T8AH",
"part_index": 0
},
"suggestions": [{ "text": "Everyone" }]
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
conversation_id: 'cnv_01JZC7K4RQ',
invocation_id: 'ivk_01k1m4q9vn2r7t9b4c6qdh8xwy',
parts: [{type: '<string>', text: '<string>'}],
reply_to: {message_id: 'msg_01JZM3T8AH', part_index: 0},
suggestions: [{text: 'Everyone'}]
})
};
fetch('https://api.relayapp.im/v1/messages', 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.relayapp.im/v1/messages",
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([
'conversation_id' => 'cnv_01JZC7K4RQ',
'invocation_id' => 'ivk_01k1m4q9vn2r7t9b4c6qdh8xwy',
'parts' => [
[
'type' => '<string>',
'text' => '<string>'
]
],
'reply_to' => [
'message_id' => 'msg_01JZM3T8AH',
'part_index' => 0
],
'suggestions' => [
[
'text' => 'Everyone'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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://api.relayapp.im/v1/messages"
payload := strings.NewReader("{\n \"conversation_id\": \"cnv_01JZC7K4RQ\",\n \"invocation_id\": \"ivk_01k1m4q9vn2r7t9b4c6qdh8xwy\",\n \"parts\": [\n {\n \"type\": \"<string>\",\n \"text\": \"<string>\"\n }\n ],\n \"reply_to\": {\n \"message_id\": \"msg_01JZM3T8AH\",\n \"part_index\": 0\n },\n \"suggestions\": [\n {\n \"text\": \"Everyone\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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://api.relayapp.im/v1/messages")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"conversation_id\": \"cnv_01JZC7K4RQ\",\n \"invocation_id\": \"ivk_01k1m4q9vn2r7t9b4c6qdh8xwy\",\n \"parts\": [\n {\n \"type\": \"<string>\",\n \"text\": \"<string>\"\n }\n ],\n \"reply_to\": {\n \"message_id\": \"msg_01JZM3T8AH\",\n \"part_index\": 0\n },\n \"suggestions\": [\n {\n \"text\": \"Everyone\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.relayapp.im/v1/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"conversation_id\": \"cnv_01JZC7K4RQ\",\n \"invocation_id\": \"ivk_01k1m4q9vn2r7t9b4c6qdh8xwy\",\n \"parts\": [\n {\n \"type\": \"<string>\",\n \"text\": \"<string>\"\n }\n ],\n \"reply_to\": {\n \"message_id\": \"msg_01JZM3T8AH\",\n \"part_index\": 0\n },\n \"suggestions\": [\n {\n \"text\": \"Everyone\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"message_id": "msg_01JZM4Q9VN",
"message": {
"id": "msg_01JZM3T8AH",
"conversation_id": "cnv_01JZC7K4RQ",
"sequence": 123,
"sender": {
"id": "usr_01JZU1F0BD"
},
"parts": [
{
"part_index": 1,
"type": "<string>",
"text": "<string>"
}
],
"fallback_text": "<string>",
"status": "sent",
"created_at": "2023-11-07T05:31:56Z",
"reply_to": {
"message_id": "msg_01JZM3T8AH",
"part_index": 0
},
"invoked_agents": [
"<string>"
],
"suggestions": [
{
"text": "Everyone"
}
],
"reactions": [
{
"part_index": 1,
"emoji": "<string>",
"actor_id": "<string>"
}
],
"delivered_at": "2023-11-07T05:31:56Z",
"read_at": "2023-11-07T05:31:56Z",
"edited_at": "2023-11-07T05:31:56Z",
"revisions": [
{
"parts": [
{
"part_index": 1,
"type": "<string>",
"text": "<string>"
}
],
"fallback_text": "<string>",
"replaced_at": "2023-11-07T05:31:56Z"
}
]
},
"stream": {
"protocol": "<string>",
"source_message_id": "<string>",
"finish_reason": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "conversation_id is required"
}
}{
"error": {
"code": "invalid_request",
"message": "conversation_id is required"
}
}{
"error": {
"code": "invalid_request",
"message": "conversation_id is required"
}
}{
"error": {
"code": "invalid_request",
"message": "conversation_id is required"
}
}{
"error": {
"code": "invalid_request",
"message": "conversation_id is required"
}
}{
"error": {
"code": "invalid_request",
"message": "conversation_id is required"
}
}Authorizations
Agent Token (rly_live_…), shown once at agent creation.
Headers
Deriving it from the triggering event_id makes a retry safe.
8 - 255Query Parameters
Set true when the request body is a Vercel AI SDK UIMessageStream v1.
Required when stream=true; use the conversation id from message.received.
Optional message id to reply to when stream=true.
Optional part target used with reply_to.
x >= 0Required for a streaming reply to an agent invocation in a group. One pending, agent-specific group invocation. It is bound to the agent's current membership period and becomes invalid on removal.
^ivk_[0-9a-hjkmnp-tv-z]{26}$"ivk_01k1m4q9vn2r7t9b4c6qdh8xwy"
Body
Conversation to send into, from message.received.
"cnv_01JZC7K4RQ"
Required when this agent replies in a group. Echo the invocation id from Relay's message.received event.
^ivk_[0-9a-hjkmnp-tv-z]{26}$"ivk_01k1m4q9vn2r7t9b4c6qdh8xwy"
Ordered message parts.
1 - 32 elements- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Quick-reply chips shown while this message is the newest in the conversation. Tapping a chip sends its text back as an ordinary user text message, delivered to the agent as a normal message.received event.
8Show child attributes
Show child attributes