curl --request POST \
--url https://smtp.sendmux.ai/api/v1/emails/attachments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Length: <content-length>' \
--header 'Content-Type: application/octet-stream' \
--data '"<string>"'import requests
url = "https://smtp.sendmux.ai/api/v1/emails/attachments"
payload = "<string>"
headers = {
"Content-Length": "<content-length>",
"Authorization": "Bearer <token>",
"Content-Type": "application/octet-stream"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Content-Length': '<content-length>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/octet-stream'
},
body: JSON.stringify('<string>')
};
fetch('https://smtp.sendmux.ai/api/v1/emails/attachments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://smtp.sendmux.ai/api/v1/emails/attachments"
payload := strings.NewReader("\"<string>\"")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Length", "<content-length>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/octet-stream")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"ok": true,
"meta": {
"request_id": "req_clxxxxxxxxxxxxxxxxxxxxxxxxx"
},
"data": {
"attachment_id": "att_tz4a98xxat96iws9zmbrgj3a",
"filename": "analysis.pdf",
"content_type": "application/pdf",
"size_bytes": 20480,
"expires_at": "2026-07-07T08:15:00.000Z"
}
}{
"ok": false,
"error": {
"code": "validation_error",
"message": "<string>",
"retryable": true,
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"field": "to.email",
"code": "invalid_string",
"message": "<string>"
}
]
},
"meta": {
"request_id": "req_clxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}{
"ok": false,
"error": {
"code": "validation_error",
"message": "<string>",
"retryable": true,
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"field": "to.email",
"code": "invalid_string",
"message": "<string>"
}
]
},
"meta": {
"request_id": "req_clxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}{
"ok": false,
"error": {
"code": "validation_error",
"message": "<string>",
"retryable": true,
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"field": "to.email",
"code": "invalid_string",
"message": "<string>"
}
]
},
"meta": {
"request_id": "req_clxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}{
"ok": false,
"error": {
"code": "validation_error",
"message": "<string>",
"retryable": true,
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"field": "to.email",
"code": "invalid_string",
"message": "<string>"
}
]
},
"meta": {
"request_id": "req_clxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}{
"ok": false,
"error": {
"code": "validation_error",
"message": "<string>",
"retryable": true,
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"field": "to.email",
"code": "invalid_string",
"message": "<string>"
}
]
},
"meta": {
"request_id": "req_clxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}{
"ok": false,
"error": {
"code": "validation_error",
"message": "<string>",
"retryable": true,
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"field": "to.email",
"code": "invalid_string",
"message": "<string>"
}
]
},
"meta": {
"request_id": "req_clxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}{
"ok": false,
"error": {
"code": "validation_error",
"message": "<string>",
"retryable": true,
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"field": "to.email",
"code": "invalid_string",
"message": "<string>"
}
]
},
"meta": {
"request_id": "req_clxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}{
"ok": false,
"error": {
"code": "validation_error",
"message": "<string>",
"retryable": true,
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"field": "to.email",
"code": "invalid_string",
"message": "<string>"
}
]
},
"meta": {
"request_id": "req_clxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}Upload an attachment
Upload binary attachment bytes and receive a temporary attachment_id for use in attachments[]. Requires email.send permission.
curl --request POST \
--url https://smtp.sendmux.ai/api/v1/emails/attachments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Length: <content-length>' \
--header 'Content-Type: application/octet-stream' \
--data '"<string>"'import requests
url = "https://smtp.sendmux.ai/api/v1/emails/attachments"
payload = "<string>"
headers = {
"Content-Length": "<content-length>",
"Authorization": "Bearer <token>",
"Content-Type": "application/octet-stream"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Content-Length': '<content-length>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/octet-stream'
},
body: JSON.stringify('<string>')
};
fetch('https://smtp.sendmux.ai/api/v1/emails/attachments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://smtp.sendmux.ai/api/v1/emails/attachments"
payload := strings.NewReader("\"<string>\"")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Length", "<content-length>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/octet-stream")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"ok": true,
"meta": {
"request_id": "req_clxxxxxxxxxxxxxxxxxxxxxxxxx"
},
"data": {
"attachment_id": "att_tz4a98xxat96iws9zmbrgj3a",
"filename": "analysis.pdf",
"content_type": "application/pdf",
"size_bytes": 20480,
"expires_at": "2026-07-07T08:15:00.000Z"
}
}{
"ok": false,
"error": {
"code": "validation_error",
"message": "<string>",
"retryable": true,
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"field": "to.email",
"code": "invalid_string",
"message": "<string>"
}
]
},
"meta": {
"request_id": "req_clxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}{
"ok": false,
"error": {
"code": "validation_error",
"message": "<string>",
"retryable": true,
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"field": "to.email",
"code": "invalid_string",
"message": "<string>"
}
]
},
"meta": {
"request_id": "req_clxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}{
"ok": false,
"error": {
"code": "validation_error",
"message": "<string>",
"retryable": true,
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"field": "to.email",
"code": "invalid_string",
"message": "<string>"
}
]
},
"meta": {
"request_id": "req_clxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}{
"ok": false,
"error": {
"code": "validation_error",
"message": "<string>",
"retryable": true,
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"field": "to.email",
"code": "invalid_string",
"message": "<string>"
}
]
},
"meta": {
"request_id": "req_clxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}{
"ok": false,
"error": {
"code": "validation_error",
"message": "<string>",
"retryable": true,
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"field": "to.email",
"code": "invalid_string",
"message": "<string>"
}
]
},
"meta": {
"request_id": "req_clxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}{
"ok": false,
"error": {
"code": "validation_error",
"message": "<string>",
"retryable": true,
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"field": "to.email",
"code": "invalid_string",
"message": "<string>"
}
]
},
"meta": {
"request_id": "req_clxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}{
"ok": false,
"error": {
"code": "validation_error",
"message": "<string>",
"retryable": true,
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"field": "to.email",
"code": "invalid_string",
"message": "<string>"
}
]
},
"meta": {
"request_id": "req_clxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}{
"ok": false,
"error": {
"code": "validation_error",
"message": "<string>",
"retryable": true,
"param": "<string>",
"doc_url": "<string>",
"errors": [
{
"field": "to.email",
"code": "invalid_string",
"message": "<string>"
}
]
},
"meta": {
"request_id": "req_clxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}Authorizations
Sendmux API key (smx_...)
Headers
Optional client-generated key to make the request idempotent for 24 hours. Replays under the same key return the cached response; a reused key with a different body returns 409 idempotency_conflict.
255Exact number of bytes in the binary request body.
x >= 1Query Parameters
Filename to associate with the uploaded attachment.
1 - 255MIME type override for the uploaded attachment.
255Body
The body is of type file.
Response
Attachment uploaded successfully
true Hide child attributes
Hide child attributes
Temporary attachment ID to use in email attachments[].
^att_[a-z0-9]{24}$"att_tz4a98xxat96iws9zmbrgj3a"
Stored attachment filename
"analysis.pdf"
Stored attachment MIME type
"application/pdf"
Stored attachment byte size
20480
ISO timestamp when this temporary attachment reference expires.
"2026-07-07T08:15:00.000Z"
Was this page helpful?