Get presigned URL for attachment upload
Returns a presigned URL for direct client upload to R2 cloud storage.
The presigned URL expires after 5 minutes. Use the returned url and key when
sending a reply with attachments. Max file size is 10MB.
Allowed content types: image/jpeg, image/png, image/gif, image/webp,
application/pdf, application/msword,
application/vnd.openxmlformats-officedocument.wordprocessingml.document,
application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,
text/plain, text/csv
curl -X POST "https://api.sendkit.ai/v1/inbox/attachments/upload" \
-H "Content-Type: application/json" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"filename": "proposal.pdf",
"contentType": "application/pdf",
"fileSize": 245760
}'
import requests
import json
url = "https://api.sendkit.ai/v1/inbox/attachments/upload"
headers = {
"Content-Type": "application/json",
"X-Api-Key": "YOUR_API_KEY",
"Authorization": "Bearer YOUR_API_TOKEN"
}
data = {
"filename": "proposal.pdf",
"contentType": "application/pdf",
"fileSize": 245760
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.sendkit.ai/v1/inbox/attachments/upload", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Api-Key": "YOUR_API_KEY",
"Authorization": "Bearer YOUR_API_TOKEN"
},
body: JSON.stringify({
"filename": "proposal.pdf",
"contentType": "application/pdf",
"fileSize": 245760
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"filename": "proposal.pdf",
"contentType": "application/pdf",
"fileSize": 245760
}`)
req, err := http.NewRequest("POST", "https://api.sendkit.ai/v1/inbox/attachments/upload", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-Api-Key", "YOUR_API_KEY")
req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.sendkit.ai/v1/inbox/attachments/upload')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['X-Api-Key'] = 'YOUR_API_KEY'
request['Authorization'] = 'Bearer YOUR_API_TOKEN'
request.body = '{
"filename": "proposal.pdf",
"contentType": "application/pdf",
"fileSize": 245760
}'
response = http.request(request)
puts response.body
{
"success": true,
"data": {
"presignedUrl": "https://r2.example.com/inbox-attachments/ws123/1717200000000-proposal.pdf?X-Amz-Signature=...",
"url": "https://cdn.example.com/inbox-attachments/ws123/1717200000000-proposal.pdf",
"key": "inbox-attachments/ws123/1717200000000-proposal.pdf",
"filename": "proposal.pdf",
"contentType": "application/pdf"
}
}
/v1/inbox/attachments/upload
Platform API key (sk_user_...) or Workspace API key (sk_...)
The media type of the request body
Name of the file to upload
MIME type of the file
File size in bytes (max 10MB = 10485760 bytes)
Request Preview
Response
Response will appear here after sending the request
Authentication
API Key for authentication. Platform API key (sk_user_...) or Workspace API key (sk_...)
Bearer token. API key as Bearer token
Body
Name of the file to upload
MIME type of the file
image/jpegimage/pngimage/gifimage/webpapplication/pdfapplication/mswordapplication/vnd.openxmlformats-officedocument.wordprocessingml.documentapplication/vnd.ms-excelapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheettext/plaintext/csvFile size in bytes (max 10MB = 10485760 bytes)
Responses
Last updated today
Built with Documentation.AI