Skip to main content
PUT
/
emails
/
attachment-uploads
/
{upload_id}
Upload bytes to an attachment upload URL
curl --request PUT \
  --url https://smtp.sendmux.ai/api/v1/emails/attachment-uploads/{upload_id} \
  --header 'Content-Length: <content-length>' \
  --header 'Content-Type: application/octet-stream' \
  --header 'X-Sendmux-Upload-Token: <x-sendmux-upload-token>' \
  --data '"<string>"'
import requests

url = "https://smtp.sendmux.ai/api/v1/emails/attachment-uploads/{upload_id}"

payload = "<string>"
headers = {
    "X-Sendmux-Upload-Token": "<x-sendmux-upload-token>",
    "Content-Length": "<content-length>",
    "Content-Type": "application/octet-stream"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'PUT',
  headers: {
    'X-Sendmux-Upload-Token': '<x-sendmux-upload-token>',
    'Content-Length': '<content-length>',
    'Content-Type': 'application/octet-stream'
  },
  body: JSON.stringify('<string>')
};

fetch('https://smtp.sendmux.ai/api/v1/emails/attachment-uploads/{upload_id}', 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/attachment-uploads/{upload_id}"

	payload := strings.NewReader("\"<string>\"")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("X-Sendmux-Upload-Token", "<x-sendmux-upload-token>")
	req.Header.Add("Content-Length", "<content-length>")
	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"
  }
}

Headers

X-Sendmux-Upload-Token
string
required

Short-lived upload token returned by POST /emails/attachment-uploads.

Content-Length
integer<int64>
required

Exact number of bytes in the binary request body.

Required range: x >= 1

Path Parameters

upload_id
string
required

Upload intent ID returned by POST /emails/attachment-uploads.

Pattern: ^upl_[a-z0-9]{24}$

Body

application/octet-stream

The body is of type file.

Response

Attachment uploaded successfully

ok
enum<boolean>
required
Available options:
true
meta
object
required
data
object
required