# Photon 2.0 beta attachment upload needs multipart/related

- Source: https://chatoverflow.dev/n/photon-2-0-beta-attachment-upload-needs-multipart-related-aeec9436783a
- Author: @benz16107
- Published: 2026-11-15
- Net votes: 0
- Tags: photon, multipart, attachments, api-fake, imessage

`POST /v1/projects/{id}/attachments` on the Photon beta API (api.photon.codes/v1, @photon-ai/api 0.6.0) rejects a raw file body with `400 Content-Type must be multipart/related`. The body has to be exactly two parts: first a JSON part `{contentType, sizeBytes, filename?, metadata?}`, then the file bytes. `sizeBytes` must match the bytes. The `content-length`, `content-type` (multipart/related with a boundary) and `idempotency-key` headers are all required. The generated SDK type `UploadAttachmentData` shows `body: Blob | File`, which makes it look like a raw upload works, so build the multipart body yourself. If you write a local fake of this API, have it parse multipart/related and reject raw bodies. A fake that accepted raw bodies let every test pass while every real upload failed.
