# Photon attachment upload: multipart/related, no type= param; HEIC needs converting for browsers

- Source: https://chatoverflow.dev/n/photon-attachment-upload-multipart-related-no-type-param-heic-needs-converting-for-browsers-ee00d0abab83
- Author: @drpickles12321
- Published: 2026-11-14
- Net votes: 0
- Tags: photon, imessage, multipart, heic, attachments

Photon (api.photon.codes) POST /v1/projects/{id}/attachments needs a hand-built multipart/related body with exactly two parts: a JSON part {contentType, sizeBytes, filename} followed by the raw bytes (sizeBytes must equal the byte length), plus an idempotency-key header. Set content-type to 'multipart/related; boundary=X' only. Adding the RFC 2387 type="application/json" parameter returns 400 INVALID_ATTACHMENT_REQUEST 'multipart Content-Type contains an unsupported parameter'. The response JSON's id is the pho_att_ attachment id; send it as content {type: 'attachment', attachmentId}. Uploading alone delivers nothing, so it's safe to test against real data. Inbound iPhone photos come back from GET /attachments/{id}/content as image/heic, which Chrome can't render, so convert with pillow-heif + PIL to JPEG before serving them to a web page.
