curl --request POST \
--url https://api.punchrescue.com/api/public/v1/orgs/{org_id}/emergencies/{emergency_id}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"content": "<string>",
"author": {
"name": "<string>"
},
"attachments": [
{
"src": "<string>",
"type": "<string>",
"caption": "<string>"
}
]
}
'import requests
url = "https://api.punchrescue.com/api/public/v1/orgs/{org_id}/emergencies/{emergency_id}/messages"
payload = {
"content": "<string>",
"author": { "name": "<string>" },
"attachments": [
{
"src": "<string>",
"type": "<string>",
"caption": "<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({
content: '<string>',
author: {name: '<string>'},
attachments: [{src: '<string>', type: '<string>', caption: '<string>'}]
})
};
fetch('https://api.punchrescue.com/api/public/v1/orgs/{org_id}/emergencies/{emergency_id}/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.punchrescue.com/api/public/v1/orgs/{org_id}/emergencies/{emergency_id}/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([
'content' => '<string>',
'author' => [
'name' => '<string>'
],
'attachments' => [
[
'src' => '<string>',
'type' => '<string>',
'caption' => '<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://api.punchrescue.com/api/public/v1/orgs/{org_id}/emergencies/{emergency_id}/messages"
payload := strings.NewReader("{\n \"content\": \"<string>\",\n \"author\": {\n \"name\": \"<string>\"\n },\n \"attachments\": [\n {\n \"src\": \"<string>\",\n \"type\": \"<string>\",\n \"caption\": \"<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))
}HttpResponse<String> response = Unirest.post("https://api.punchrescue.com/api/public/v1/orgs/{org_id}/emergencies/{emergency_id}/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"content\": \"<string>\",\n \"author\": {\n \"name\": \"<string>\"\n },\n \"attachments\": [\n {\n \"src\": \"<string>\",\n \"type\": \"<string>\",\n \"caption\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.punchrescue.com/api/public/v1/orgs/{org_id}/emergencies/{emergency_id}/messages")
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 \"content\": \"<string>\",\n \"author\": {\n \"name\": \"<string>\"\n },\n \"attachments\": [\n {\n \"src\": \"<string>\",\n \"type\": \"<string>\",\n \"caption\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"messageId": "<string>",
"conversationId": "<string>",
"content": "<string>",
"source": "<string>",
"createdAt": "<string>",
"attachments": [
{
"attachmentId": "<string>",
"kind": "<string>",
"mimeType": "<string>",
"url": "<string>",
"source": "<string>",
"sizeBytes": 123,
"caption": "<string>",
"width": 123,
"height": 123
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Post a message to an emergency's conversation
Required permission: write.
Accepts optional attachments. Each item carries its value under src (or the
accepted aliases content / url / data) and, optionally, type and
caption. A bare string, or a single item outside a list, is accepted too.
src takes one of two forms:
- Inline bytes — a
data:URI or bare base64. Decoded, verified against their own magic bytes, and written to S3 before the message row, so a storage failure never leaves a message with a broken image in the chat. A declaredtypeis ignored here: the bytes decide. - A link — an
https://URL. Stored as given and never fetched: the operator’s browser loads it directly, so Rescue neither hosts nor guarantees it, and a URL that expires will stop rendering.typeis the only type signal a link has; without it the type is guessed from the file extension and otherwise falls back to a plain link. Only https, a public host and the default port are accepted.
Rejections carry a stable code in detail.error (see AttachmentRejectReason).
Retries of a message whose attachments are all inline bytes are safe: an identical payload re-posted inside the dedupe window returns the original message instead of creating a second one. Text-only messages are not deduplicated — repeated posts each create a message, as they always have. Neither are messages carrying a link: a link is identified by its URL, and the media behind a URL can change, so collapsing a re-post would hide a new frame rather than a duplicate. Retry a link post only if you want a second message.
The conversation is created on demand, so a message posted immediately after the emergency is declared is accepted rather than rejected with a retry.
curl --request POST \
--url https://api.punchrescue.com/api/public/v1/orgs/{org_id}/emergencies/{emergency_id}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"content": "<string>",
"author": {
"name": "<string>"
},
"attachments": [
{
"src": "<string>",
"type": "<string>",
"caption": "<string>"
}
]
}
'import requests
url = "https://api.punchrescue.com/api/public/v1/orgs/{org_id}/emergencies/{emergency_id}/messages"
payload = {
"content": "<string>",
"author": { "name": "<string>" },
"attachments": [
{
"src": "<string>",
"type": "<string>",
"caption": "<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({
content: '<string>',
author: {name: '<string>'},
attachments: [{src: '<string>', type: '<string>', caption: '<string>'}]
})
};
fetch('https://api.punchrescue.com/api/public/v1/orgs/{org_id}/emergencies/{emergency_id}/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.punchrescue.com/api/public/v1/orgs/{org_id}/emergencies/{emergency_id}/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([
'content' => '<string>',
'author' => [
'name' => '<string>'
],
'attachments' => [
[
'src' => '<string>',
'type' => '<string>',
'caption' => '<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://api.punchrescue.com/api/public/v1/orgs/{org_id}/emergencies/{emergency_id}/messages"
payload := strings.NewReader("{\n \"content\": \"<string>\",\n \"author\": {\n \"name\": \"<string>\"\n },\n \"attachments\": [\n {\n \"src\": \"<string>\",\n \"type\": \"<string>\",\n \"caption\": \"<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))
}HttpResponse<String> response = Unirest.post("https://api.punchrescue.com/api/public/v1/orgs/{org_id}/emergencies/{emergency_id}/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"content\": \"<string>\",\n \"author\": {\n \"name\": \"<string>\"\n },\n \"attachments\": [\n {\n \"src\": \"<string>\",\n \"type\": \"<string>\",\n \"caption\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.punchrescue.com/api/public/v1/orgs/{org_id}/emergencies/{emergency_id}/messages")
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 \"content\": \"<string>\",\n \"author\": {\n \"name\": \"<string>\"\n },\n \"attachments\": [\n {\n \"src\": \"<string>\",\n \"type\": \"<string>\",\n \"caption\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"messageId": "<string>",
"conversationId": "<string>",
"content": "<string>",
"source": "<string>",
"createdAt": "<string>",
"attachments": [
{
"attachmentId": "<string>",
"kind": "<string>",
"mimeType": "<string>",
"url": "<string>",
"source": "<string>",
"sizeBytes": 123,
"caption": "<string>",
"width": 123,
"height": 123
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Target organization id (from the route path)
Emergency id
Body
4000Show child attributes
Show child attributes
Attachments to post with the message. Accepts a list or a single item; each item is either an object with src (plus optional type, caption) or the bare value string. src takes a data: URI, bare base64, or an https:// URL. At most 5 per message. attachment is accepted as a singular alias for this field.
5Show child attributes
Show child attributes