Download attachment
Downloads an attachment from a conversation. Supports both attachments received from leads (replies) and attachments sent by the user (manual messages). The file is fetched on-demand from the email provider (Gmail or Outlook) and proxied through this endpoint. No files are stored on SendKit servers.
Supported providers: Gmail (OAuth), Outlook/Microsoft 365 (OAuth). SMTP/IMAP mailbox attachments are not supported. Sent attachments are only downloadable if provider attachment IDs were captured at send time.
The response is the raw binary file with appropriate Content-Type and Content-Disposition headers.
curl -X GET "https://api.sendkit.ai/v1/inbox/example_string/attachments/42" \
-H "Content-Type: application/json" \
-H "X-Api-Key: YOUR_API_KEY"
import requests
import json
url = "https://api.sendkit.ai/v1/inbox/example_string/attachments/42"
headers = {
"Content-Type": "application/json",
"X-Api-Key": "YOUR_API_KEY"
}
response = requests.get(url, headers=headers)
print(response.json())
const response = await fetch("https://api.sendkit.ai/v1/inbox/example_string/attachments/42", {
method: "GET",
headers: {
"Content-Type": "application/json",
"X-Api-Key": "YOUR_API_KEY"
}
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
)
func main() {
req, err := http.NewRequest("GET", "https://api.sendkit.ai/v1/inbox/example_string/attachments/42", nil)
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-Api-Key", "YOUR_API_KEY")
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/example_string/attachments/42')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri)
request['Content-Type'] = 'application/json'
request['X-Api-Key'] = 'YOUR_API_KEY'
response = http.request(request)
puts response.body
{}
{
"error": "Bad Request",
"message": "The request contains invalid parameters or malformed data",
"code": 400,
"details": [
{
"field": "email",
"message": "Invalid email format"
}
]
}
{
"error": "Unauthorized",
"message": "Authentication required. Please provide a valid API token",
"code": 401
}
{
"error": "Not Found",
"message": "The requested resource was not found",
"code": 404
}
{
"error": "Error",
"message": "Failed to fetch from email provider",
"code": 502
}
/v1/inbox/{conversationId}/attachments/{attachmentIndex}Platform API key (sk_user_...) or Workspace API key (sk_...)
Conversation ID (the inbox thread ID)
Zero-based index of the attachment across all reply and sent messages.
Use the downloadUrl from the GET /v1/inbox/{conversationId} response to get the correct index.
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_...)
Path Parameters
Conversation ID (the inbox thread ID)
Zero-based index of the attachment across all reply and sent messages.
Use the downloadUrl from the GET /v1/inbox/{conversationId} response to get the correct index.
Responses
Attachment file binary
Last updated 4 days ago
Built with Documentation.AI