> ## Documentation Index
> Fetch the complete documentation index at: https://sendmux.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload bytes to an attachment upload URL

> Upload the exact binary bytes for a previously-created attachment upload URL. This operation uses the short-lived upload token header returned by POST /emails/attachment-uploads, not a Sendmux API key.



## OpenAPI

````yaml https://smtp.sendmux.ai/api/v1/openapi.json put /emails/attachment-uploads/{upload_id}
openapi: 3.1.0
info:
  title: Sendmux Sending API
  version: 1.0.0
  description: >-
    Send emails programmatically via the Sendmux email infrastructure. Every
    response carries an `X-Request-Id` header; errors include a `retryable`
    flag. 429 and 503 responses include `Retry-After`. Mutating endpoints accept
    an `Idempotency-Key` header for safe retries.
servers:
  - url: https://smtp.sendmux.ai/api/v1
    description: Production
security:
  - BearerAuth: []
paths:
  /emails/attachment-uploads/{upload_id}:
    put:
      tags:
        - Attachments
      summary: Upload bytes to an attachment upload URL
      description: >-
        Upload the exact binary bytes for a previously-created attachment upload
        URL. This operation uses the short-lived upload token header returned by
        POST /emails/attachment-uploads, not a Sendmux API key.
      operationId: sendingCompleteAttachmentUpload
      parameters:
        - name: X-Sendmux-Upload-Token
          in: header
          required: true
          schema:
            type: string
          description: >-
            Short-lived upload token returned by POST
            /emails/attachment-uploads.
        - name: Content-Length
          in: header
          required: true
          schema:
            type: integer
            format: int64
            minimum: 1
          description: Exact number of bytes in the binary request body.
          example: 20480
        - name: upload_id
          in: path
          required: true
          schema:
            type: string
            pattern: ^upl_[a-z0-9]{24}$
          description: Upload intent ID returned by POST /emails/attachment-uploads.
      requestBody:
        required: true
        content:
          application/octet-stream:
            schema:
              type: string
              format: binary
      responses:
        '201':
          description: Attachment uploaded successfully
          headers:
            Location:
              description: Canonical URL for the temporary uploaded attachment metadata.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AttachmentUploadResponse'
        '400':
          description: Missing or invalid upload headers
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Upload token missing, invalid, or expired
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Upload intent not found or expired
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: Upload already completed with different content
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '413':
          description: Uploaded bytes do not match the expected size
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Attachment validation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Attachment storage temporarily unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security: []
components:
  schemas:
    AttachmentUploadResponse:
      allOf:
        - $ref: '#/components/schemas/SuccessEnvelope'
        - type: object
          properties:
            data:
              $ref: '#/components/schemas/AttachmentUploadData'
          required:
            - data
      unevaluatedProperties: false
    ErrorResponse:
      type: object
      properties:
        ok:
          type: boolean
          enum:
            - false
        error:
          $ref: '#/components/schemas/ErrorDetail'
        meta:
          $ref: '#/components/schemas/Meta'
      required:
        - ok
        - error
        - meta
      additionalProperties: false
    SuccessEnvelope:
      type: object
      properties:
        ok:
          type: boolean
          enum:
            - true
        meta:
          $ref: '#/components/schemas/Meta'
      required:
        - ok
        - meta
    AttachmentUploadData:
      type: object
      properties:
        attachment_id:
          type: string
          pattern: ^att_[a-z0-9]{24}$
          description: Temporary attachment ID to use in email attachments[].
          example: att_tz4a98xxat96iws9zmbrgj3a
        filename:
          type: string
          description: Stored attachment filename
          example: analysis.pdf
        content_type:
          type: string
          description: Stored attachment MIME type
          example: application/pdf
        size_bytes:
          type: integer
          description: Stored attachment byte size
          example: 20480
        expires_at:
          type: string
          format: date-time
          description: ISO timestamp when this temporary attachment reference expires.
          example: '2026-07-07T08:15:00.000Z'
      required:
        - attachment_id
        - filename
        - content_type
        - size_bytes
        - expires_at
      additionalProperties: false
    ErrorDetail:
      type: object
      properties:
        code:
          type: string
          description: Machine-readable error code
          example: validation_error
        message:
          type: string
          description: Human-readable error description
        param:
          type: string
          description: Parameter that caused the error
        doc_url:
          type: string
          format: uri
          description: Link to error documentation
        retryable:
          type: boolean
          description: >-
            True when the client may safely retry the same request. 429 and 5xx
            default true; 4xx default false.
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ErrorIssue'
          description: Accumulated per-field issues (validation errors)
      required:
        - code
        - message
        - retryable
      additionalProperties: false
    Meta:
      type: object
      properties:
        request_id:
          type: string
          description: Unique request identifier
          example: req_clxxxxxxxxxxxxxxxxxxxxxxxxx
      required:
        - request_id
      additionalProperties: false
    ErrorIssue:
      type: object
      properties:
        field:
          type: string
          description: Dot-path to the failing field
          example: to.email
        code:
          type: string
          description: Issue code from the validator
          example: invalid_string
        message:
          type: string
          description: Human-readable issue message
      required:
        - field
        - code
        - message
      additionalProperties: false
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Sendmux API key (smx_...)

````