{"id":1098,"url":"https://forum.supero.dev/t/uploading-a-file-and-attaching-it-to-a-record-1098","title":"Uploading a file and attaching it to a record","type":"question","status":"solved","category":{"slug":"api-sdk-cli","name":"API, SDKs & CLI"},"tags":["files-media","python-sdk"],"author":{"handle":"supero-support","name":"Supero Support","team":true},"created":"2026-12-04T02:40:29.705Z","updated":"2026-12-04T02:40:29.705Z","upvotes":0,"error_text":null,"environment":{"client":null,"sdk_version":null,"deploy_target":null},"body_markdown":"The upload returns a `file_id`. How do I get the PDF onto the vehicle's `inspection_report` field?","answers":[{"id":"7c6a5453-5699-46de-aac9-569cef8836fc","url":"https://forum.supero.dev/t/uploading-a-file-and-attaching-it-to-a-record-1098#post-7c6a5453-5699-46de-aac9-569cef8836fc","author":{"handle":"supero-dx","name":"Supero DX team","team":true},"accepted":true,"official":false,"outdated":false,"sdk_version":null,"upvotes":0,"created":"2026-12-04T02:40:29.705Z","updated":"2026-12-04T02:40:29.705Z","body_markdown":"Over REST it's two calls: upload, then write the whole file reference from the 201 body onto the record with an ordinary update. Store the object, not the bare `file_id`.\n\n```bash\nREF=$(curl -s -X POST https://api.supero.dev/api/v1/files/acme/upload \\\n  -H \"X-API-Key: $SUPERO_API_KEY\" -F \"file=@inspection.pdf\")\ncurl -X PUT https://api.supero.dev/api/v1/crud/acme/vehicle/$VEHICLE_UUID \\\n  -H \"X-API-Key: $SUPERO_API_KEY\" -H \"Content-Type: application/json\" \\\n  -d \"{\\\"inspection_report\\\": $REF}\"\n```\n\nThe SDKs do both in one call, `org.files.attach(vehicle_uuid, \"vehicle\", \"inspection_report\", \"inspection.pdf\")` in Python, and delete the uploaded file if the record write fails. On a `list: true` gallery field `attach` appends; over REST you read the array, append the reference and write the whole array back.\n\nTwo limits catch people. The API takes up to 25 MB per file, but both SDKs refuse images over 10 MB locally before sending. Audio and video aren't on the allowed list and get a 400 `Unsupported file type`.","comments":[]}],"licence":"CC BY-SA 4.0 (code: MIT-0)"}