Skip to main content
POST
/
mailbox
/
attachment-uploads
Create a presigned mailbox attachment upload
curl --request POST \
  --url https://app.sendmux.ai/api/v1/mailbox/attachment-uploads \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "content_type": "application/pdf",
  "filename": "<string>",
  "size_bytes": 2
}
'
import requests

url = "https://app.sendmux.ai/api/v1/mailbox/attachment-uploads"

payload = {
"content_type": "application/pdf",
"filename": "<string>",
"size_bytes": 2
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({content_type: 'application/pdf', filename: '<string>', size_bytes: 2})
};

fetch('https://app.sendmux.ai/api/v1/mailbox/attachment-uploads', 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://app.sendmux.ai/api/v1/mailbox/attachment-uploads"

payload := strings.NewReader("{\n \"content_type\": \"application/pdf\",\n \"filename\": \"<string>\",\n \"size_bytes\": 2\n}")

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

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
{
  "meta": {
    "request_id": "req_clxxxxxxxxxxxxxxxxxxxxxxxxx"
  },
  "ok": true,
  "data": {
    "expires_at": "2023-11-07T05:31:56Z",
    "headers": {
      "Content-Length": "<string>",
      "Content-Type": "<string>"
    },
    "max_size_bytes": 123,
    "method": "PUT",
    "upload_id": "<string>",
    "upload_url": "https://app.sendmux.ai/api/v1/mailbox/attachment-uploads/upl_123?upload_token=..."
  }
}
{
"error": {
"code": "invalid_parameter",
"message": "<string>",
"retryable": false,
"doc_url": "<string>",
"errors": [
{
"code": "invalid_string",
"field": "recipient.email",
"message": "<string>"
}
],
"param": "<string>"
},
"meta": {
"request_id": "req_clxxxxxxxxxxxxxxxxxxxxxxxxx"
},
"ok": false
}
{
"error": {
"code": "invalid_parameter",
"message": "<string>",
"retryable": false,
"doc_url": "<string>",
"errors": [
{
"code": "invalid_string",
"field": "recipient.email",
"message": "<string>"
}
],
"param": "<string>"
},
"meta": {
"request_id": "req_clxxxxxxxxxxxxxxxxxxxxxxxxx"
},
"ok": false
}
{
"error": {
"code": "invalid_parameter",
"message": "<string>",
"retryable": false,
"doc_url": "<string>",
"errors": [
{
"code": "invalid_string",
"field": "recipient.email",
"message": "<string>"
}
],
"param": "<string>"
},
"meta": {
"request_id": "req_clxxxxxxxxxxxxxxxxxxxxxxxxx"
},
"ok": false
}

Authorizations

Authorization
string
header
required

Sendmux API key. Use a root API key for Management API routes, or a mailbox credential for Mailbox API routes. Obtain keys from the dashboard under API Keys.

Query Parameters

mailbox_id
string

Mailbox public ID to target when the credential grants access to more than one mailbox. Omit when the credential is scoped to exactly one mailbox.

Body

application/json
content_type
string
required

Content-Type that must be sent on the later PUT request.

Example:

"application/pdf"

filename
string
required

Filename to use when sending the uploaded attachment.

size_bytes
integer
required

Exact byte length that must be sent on the later PUT request.

Required range: x >= 1

Response

Attachment upload URL created

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