Conversation attachments
Create Attachment
Stage a file for this conversation. Returns a presigned POST: upload the bytes to url with the returned fields, then call the complete endpoint.
Images are always accepted. While a human handoff is relaying, the wider set the help desk itself accepts is allowed too — the customer holding the receipt is exactly the person who needs to send a PDF. Rejected with 400 if the content type is unsupported, the file exceeds the size cap, or the conversation has hit its attachment limit.
POST
/
core
/
conversations
/
{conversation_id}
/
attachments
Create Attachment
curl --request POST \
--url https://api.anyreach.ai/core/conversations/{conversation_id}/attachments \
--header 'Content-Type: application/json' \
--data '
{
"filename": "<string>",
"content_type": "<string>",
"size_bytes": 123,
"source": "upload"
}
'import requests
url = "https://api.anyreach.ai/core/conversations/{conversation_id}/attachments"
payload = {
"filename": "<string>",
"content_type": "<string>",
"size_bytes": 123,
"source": "upload"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
filename: '<string>',
content_type: '<string>',
size_bytes: 123,
source: 'upload'
})
};
fetch('https://api.anyreach.ai/core/conversations/{conversation_id}/attachments', 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.anyreach.ai/core/conversations/{conversation_id}/attachments",
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([
'filename' => '<string>',
'content_type' => '<string>',
'size_bytes' => 123,
'source' => 'upload'
]),
CURLOPT_HTTPHEADER => [
"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.anyreach.ai/core/conversations/{conversation_id}/attachments"
payload := strings.NewReader("{\n \"filename\": \"<string>\",\n \"content_type\": \"<string>\",\n \"size_bytes\": 123,\n \"source\": \"upload\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.anyreach.ai/core/conversations/{conversation_id}/attachments")
.header("Content-Type", "application/json")
.body("{\n \"filename\": \"<string>\",\n \"content_type\": \"<string>\",\n \"size_bytes\": 123,\n \"source\": \"upload\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.anyreach.ai/core/conversations/{conversation_id}/attachments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"filename\": \"<string>\",\n \"content_type\": \"<string>\",\n \"size_bytes\": 123,\n \"source\": \"upload\"\n}"
response = http.request(request)
puts response.read_body{
"attachment_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"url": "https://example.com/resource",
"fields": {},
"s3_key": "string",
"expires_in": 1
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Headers
Organization ID for user PATs (pat_ prefix tokens)
Path Parameters
Body
application/json
⌘I
Create Attachment
curl --request POST \
--url https://api.anyreach.ai/core/conversations/{conversation_id}/attachments \
--header 'Content-Type: application/json' \
--data '
{
"filename": "<string>",
"content_type": "<string>",
"size_bytes": 123,
"source": "upload"
}
'import requests
url = "https://api.anyreach.ai/core/conversations/{conversation_id}/attachments"
payload = {
"filename": "<string>",
"content_type": "<string>",
"size_bytes": 123,
"source": "upload"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
filename: '<string>',
content_type: '<string>',
size_bytes: 123,
source: 'upload'
})
};
fetch('https://api.anyreach.ai/core/conversations/{conversation_id}/attachments', 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.anyreach.ai/core/conversations/{conversation_id}/attachments",
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([
'filename' => '<string>',
'content_type' => '<string>',
'size_bytes' => 123,
'source' => 'upload'
]),
CURLOPT_HTTPHEADER => [
"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.anyreach.ai/core/conversations/{conversation_id}/attachments"
payload := strings.NewReader("{\n \"filename\": \"<string>\",\n \"content_type\": \"<string>\",\n \"size_bytes\": 123,\n \"source\": \"upload\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.anyreach.ai/core/conversations/{conversation_id}/attachments")
.header("Content-Type", "application/json")
.body("{\n \"filename\": \"<string>\",\n \"content_type\": \"<string>\",\n \"size_bytes\": 123,\n \"source\": \"upload\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.anyreach.ai/core/conversations/{conversation_id}/attachments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"filename\": \"<string>\",\n \"content_type\": \"<string>\",\n \"size_bytes\": 123,\n \"source\": \"upload\"\n}"
response = http.request(request)
puts response.read_body{
"attachment_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"url": "https://example.com/resource",
"fields": {},
"s3_key": "string",
"expires_in": 1
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}
