Upload a new document for a contact (multipart)
curl --request POST \
--url https://your-instance.example.com/api/contacts/{contactId}/documents/upload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'documentType=ID Proof' \
--form 'notes=Driver license front + back' \
--form file='@example-file'import requests
url = "https://your-instance.example.com/api/contacts/{contactId}/documents/upload"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"documentType": "ID Proof",
"notes": "Driver license front + back"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('documentType', 'ID Proof');
form.append('notes', 'Driver license front + back');
form.append('file', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://your-instance.example.com/api/contacts/{contactId}/documents/upload', 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://your-instance.example.com/api/contacts/{contactId}/documents/upload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"documentType\"\r\n\r\nID Proof\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"notes\"\r\n\r\nDriver license front + back\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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://your-instance.example.com/api/contacts/{contactId}/documents/upload"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"documentType\"\r\n\r\nID Proof\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"notes\"\r\n\r\nDriver license front + back\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://your-instance.example.com/api/contacts/{contactId}/documents/upload")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"documentType\"\r\n\r\nID Proof\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"notes\"\r\n\r\nDriver license front + back\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/contacts/{contactId}/documents/upload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"documentType\"\r\n\r\nID Proof\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"notes\"\r\n\r\nDriver license front + back\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"success": true,
"document": {
"_id": "64f0a1b2c3d4e5f6a7b8ca40",
"storageKey": "org/64f0a1b2c3d4e5f6a7b8c9d3/contact/64f0a1b2c3d4e5f6a7b8c9d0/2026/id-proof.pdf",
"filename": "id-proof.pdf",
"contentType": "application/pdf",
"documentType": "ID Proof"
}
}{
"error": "Attachment not found",
"message": "Attachment not found"
}{
"error": "Attachment not found",
"message": "Attachment not found"
}{
"error": "Attachment not found",
"message": "Attachment not found"
}{
"error": "Attachment not found",
"message": "Attachment not found"
}Contacts
Upload a new document for a contact (multipart)
Accepts a multipart/form-data upload (max 25 MB) and stores it in R2 under a deterministic per-contact key, then attaches the resulting document record to the contact. documentType must match an entry in the organization’s configured documentTypes.
POST
/
api
/
contacts
/
{contactId}
/
documents
/
upload
Upload a new document for a contact (multipart)
curl --request POST \
--url https://your-instance.example.com/api/contacts/{contactId}/documents/upload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'documentType=ID Proof' \
--form 'notes=Driver license front + back' \
--form file='@example-file'import requests
url = "https://your-instance.example.com/api/contacts/{contactId}/documents/upload"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"documentType": "ID Proof",
"notes": "Driver license front + back"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('documentType', 'ID Proof');
form.append('notes', 'Driver license front + back');
form.append('file', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://your-instance.example.com/api/contacts/{contactId}/documents/upload', 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://your-instance.example.com/api/contacts/{contactId}/documents/upload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"documentType\"\r\n\r\nID Proof\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"notes\"\r\n\r\nDriver license front + back\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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://your-instance.example.com/api/contacts/{contactId}/documents/upload"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"documentType\"\r\n\r\nID Proof\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"notes\"\r\n\r\nDriver license front + back\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://your-instance.example.com/api/contacts/{contactId}/documents/upload")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"documentType\"\r\n\r\nID Proof\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"notes\"\r\n\r\nDriver license front + back\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/contacts/{contactId}/documents/upload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"documentType\"\r\n\r\nID Proof\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"notes\"\r\n\r\nDriver license front + back\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"success": true,
"document": {
"_id": "64f0a1b2c3d4e5f6a7b8ca40",
"storageKey": "org/64f0a1b2c3d4e5f6a7b8c9d3/contact/64f0a1b2c3d4e5f6a7b8c9d0/2026/id-proof.pdf",
"filename": "id-proof.pdf",
"contentType": "application/pdf",
"documentType": "ID Proof"
}
}{
"error": "Attachment not found",
"message": "Attachment not found"
}{
"error": "Attachment not found",
"message": "Attachment not found"
}{
"error": "Attachment not found",
"message": "Attachment not found"
}{
"error": "Attachment not found",
"message": "Attachment not found"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
multipart/form-data
Response
Document uploaded
Available options:
true Show child attributes
Show child attributes
Example:
{
"_id": "64f0a1b2c3d4e5f6a7b8ca40",
"storageKey": "org/64f0a1b2c3d4e5f6a7b8c9d3/contact/64f0a1b2c3d4e5f6a7b8c9d0/2026/id-proof.pdf",
"filename": "id-proof.pdf",
"contentType": "application/pdf",
"size": 184320,
"documentType": "ID Proof",
"uploadedAt": "2026-05-12T10:00:00.000Z",
"uploadedBy": "64f0a1b2c3d4e5f6a7b8c9d4",
"notes": "Driver license, front + back",
"signedUrl": "https://example-r2.signed/.../id-proof.pdf?X-Amz-Expires=600"
}
⌘I