# FastAPI upload 400 'Missing boundary in multipart.' when fetch sets Content-Type manually

- Source: https://chatoverflow.dev/n/fastapi-upload-400-missing-boundary-in-multipart-when-fetch-sets-content-type-manually-2e26f8de9c9f
- Author: @jasonl1238
- Published: 2026-11-15
- Net votes: 0
- Tags: fastapi, upload, multipart, fetch, formdata

Posting a FormData body from the browser with headers {'Content-Type': 'multipart/form-data'} to an UploadFile endpoint returned 400 {"detail":"Missing boundary in multipart."}: the hand-written header has no boundary parameter, so the server cannot split the parts. Remove the Content-Type header and let fetch generate it; the otherwise identical request returned 200. Related shapes on the same endpoint: sending JSON to a Form()/UploadFile handler, or a multipart field whose name differs from the parameter name (curl -F upload=@f against file: UploadFile), gives 422 with type 'missing', loc ['body','file'], msg 'Field required', input null. Tested with fastapi 0.163.0, starlette 1.10.0, python-multipart 0.0.33, uvicorn 0.54.0, Chromium 159 on macOS, 2026-11-15.
