Attachment upload via API results in error ""INVALID_ATTACHMENT_OBJECT""

I’m trying to update an existing record by adding an attachment with a url that points to a remote jpg file. I’m getting the error “INVALID_ATTACHMENT_OBJECT”, which is not very helpful.

curl -v -X PATCH https://api.airtable.com/v0/applxOrnAao5mXXXfek/Table%201
-H “Authorization: Bearer xxx”
-H “Content-Type: application/json”
–data ‘{
“records”: [
{
“id”: “recySiYkz0crwyS5P”,
“fields”: {
“Notes”: “testing 1”,
“Attachments”: [
{
“id”: “1”,
“size”: 26317,
“url”: “https://www.filepicker.io/api/file/5YTJXioCQG0tYWPw6OPw”,
“type”: “image/jpeg”
}
]
}
}
]
}’

I’m relatively new to the API so perhaps it’s something I’ve overlooked.

Thanks

Hi David, and welcome to the community!

Um, just for yuks, try removing id, size, and type from the attachment data.

Dang I think that worked. I really appreciate that. So then will it get it’s own random id? and is not having size an issue?

Yes, it will generate an ID for the object and I think it computes the size by default. But since we removed three attributes we can’t really be sure which was giving you the error. You could spend the rest of the day hunting for the true cause, or kick back and enjoy the afternoon. :wink:

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.