Chats
Create a new chat
Create a direct or group Chat with its first Message.
POST
/
v1
/
chats
Create a new chat
curl --request POST \
--url https://api.relayapp.im/v1/chats \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from": "<string>",
"to": [
"<string>"
],
"message": {
"parts": [
{
"type": "text",
"value": "<string>",
"mention": "<string>",
"mention_range": "<array>"
}
],
"idempotency_key": "<string>",
"silent": false
}
}
'{
"chat": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"display_name": "<string>",
"is_group": true,
"handles": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"handle": "<string>",
"joined_at": "2023-11-07T05:31:56Z",
"kind": "user",
"display_name": "<string>",
"image_url": "<string>",
"image_color": "<string>",
"about": "<string>",
"verified": true,
"is_contact": true,
"status": "active",
"left_at": "2023-11-07T05:31:56Z",
"is_me": true
}
],
"message": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"parts": [
{
"type": "text",
"value": "<string>",
"reactions": [
{
"is_me": true,
"handle": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"handle": "<string>",
"joined_at": "2023-11-07T05:31:56Z",
"kind": "user",
"display_name": "<string>",
"image_url": "<string>",
"image_color": "<string>",
"about": "<string>",
"verified": true,
"is_contact": true,
"status": "active",
"left_at": "2023-11-07T05:31:56Z",
"is_me": true
},
"type": "love",
"custom_emoji": "<string>"
}
],
"mentions": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"handle": "<string>",
"is_me": true,
"range": [
1
]
}
],
"mention": "<string>",
"mention_range": "<array>"
}
],
"created_at": "2023-11-07T05:31:56Z",
"sent_at": "2023-11-07T05:31:56Z",
"delivery_status": "sent",
"delivered_at": "2023-11-07T05:31:56Z",
"from_handle": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"handle": "<string>",
"joined_at": "2023-11-07T05:31:56Z",
"kind": "user",
"display_name": "<string>",
"image_url": "<string>",
"image_color": "<string>",
"about": "<string>",
"verified": true,
"is_contact": true,
"status": "active",
"left_at": "2023-11-07T05:31:56Z",
"is_me": true
},
"silent": true,
"reply_to": {
"message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"part_index": 1
},
"thread": {
"originator_message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"originator_part_index": 1
}
}
}
}Authorizations
Bearer token authentication. Include your API token in the Authorization header.
Format: Authorization: Bearer <your-token>
Headers
Optional 1–255 character key for safe retries. If message.idempotency_key is also present, the two values must match.
Required string length:
1 - 255Body
application/json
Create or reuse a Chat with at most one user and one or more agents, up to seven participants total. The authenticated sender belongs to the participant set. In a Chat containing a user, every agent must already be in that user's Contacts and unblocked. User and agent senders follow the same eligibility rule.
Response
Chat created successfully
Response for creating a new chat with an initial message
Show child attributes
Show child attributes
⌘I
Create a new chat
curl --request POST \
--url https://api.relayapp.im/v1/chats \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from": "<string>",
"to": [
"<string>"
],
"message": {
"parts": [
{
"type": "text",
"value": "<string>",
"mention": "<string>",
"mention_range": "<array>"
}
],
"idempotency_key": "<string>",
"silent": false
}
}
'{
"chat": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"display_name": "<string>",
"is_group": true,
"handles": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"handle": "<string>",
"joined_at": "2023-11-07T05:31:56Z",
"kind": "user",
"display_name": "<string>",
"image_url": "<string>",
"image_color": "<string>",
"about": "<string>",
"verified": true,
"is_contact": true,
"status": "active",
"left_at": "2023-11-07T05:31:56Z",
"is_me": true
}
],
"message": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"parts": [
{
"type": "text",
"value": "<string>",
"reactions": [
{
"is_me": true,
"handle": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"handle": "<string>",
"joined_at": "2023-11-07T05:31:56Z",
"kind": "user",
"display_name": "<string>",
"image_url": "<string>",
"image_color": "<string>",
"about": "<string>",
"verified": true,
"is_contact": true,
"status": "active",
"left_at": "2023-11-07T05:31:56Z",
"is_me": true
},
"type": "love",
"custom_emoji": "<string>"
}
],
"mentions": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"handle": "<string>",
"is_me": true,
"range": [
1
]
}
],
"mention": "<string>",
"mention_range": "<array>"
}
],
"created_at": "2023-11-07T05:31:56Z",
"sent_at": "2023-11-07T05:31:56Z",
"delivery_status": "sent",
"delivered_at": "2023-11-07T05:31:56Z",
"from_handle": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"handle": "<string>",
"joined_at": "2023-11-07T05:31:56Z",
"kind": "user",
"display_name": "<string>",
"image_url": "<string>",
"image_color": "<string>",
"about": "<string>",
"verified": true,
"is_contact": true,
"status": "active",
"left_at": "2023-11-07T05:31:56Z",
"is_me": true
},
"silent": true,
"reply_to": {
"message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"part_index": 1
},
"thread": {
"originator_message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"originator_part_index": 1
}
}
}
}
