Help

Re: Is it possible to upload attachments?

Solved
Jump to Solution
3562 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Bryan_McBride
4 - Data Explorer
4 - Data Explorer

Looking over the API documentation, it appears that attachments require a url key, so they must already be available on a web server. Is it possible to upload local files to Airtable via the API? I’d like to build my own form that POSTs to Airtable and uploads an image as an attachment, but it doesn’t look like this is currently possible. Am I missing something?

Thanks!

38 Replies 38

I’ve done a ton of work with cloudinary API and used their widget. It’s very well done and works well. I’ve also pushed attachments to Airtable using the API (as a url). So I have no doubt its possible on both sides. You would just need to build it into your application. If you provide more details on your specific scenario I can give more specifics on how to approach it. Feel free to ping me at dan@openside.com

Thanks, I will shoot you an email.

I want to thank you so much Dan for suggesting cloudinary. I have got this up and running beautifully and the images are uploading to Airtable. I will be writing up a blog post with the code to help others and will post the link here for anyone who needs help.

Chinara_James
6 - Interface Innovator
6 - Interface Innovator

As promised, my write up of my solution.

Getting Started with the Airtable API | Chinara James

Airtable is an easy way to get a database up and running for a side project or to quickly prototype an idea for app. I have used it to manage track projects, expenses, client contacts and more.

Looks great Chinara, good job! You should post this to the Show & Tell forum as well.

Dan @ Openside

Ok will do. Hope they don’t mind the duplication.

Andrew_Smith
4 - Data Explorer
4 - Data Explorer

Thank you Chinara and +1 for adding this functionality to the API!!

I use Cloudinary which comes with its own set of image processing APIs. Free tier is great.

Erik_Jung
4 - Data Explorer
4 - Data Explorer

Is it possible to use a data URI for the attachment.url value when updating attachment fields? I am was hoping for something like this to work as a compromise to not being able to send the file directly:

PATCH https://api.airtable.com/v0/.../rec00000001
{
  "fields": {
    "myAttachmentField": [{
      "id": "xxxxxxxxx",
      "filename": "file.json",
      "url": "data:application/json;charset=utf-8;base64,..."
    }]
  }
}

But this yields the INVALID_ATTACHMENT_OBJECT error.

I’d like to secure this process.

Is there a specific range of server IPs from which the image will be retrieved? Are there any guarantees on timing between when I make the create record POST request to Airtable and when the image will be fetched (e.g. no more than 5 minutes)?

I’m thinking of generating S3/Cloudfront Signed URLs with a short expiration just for Airtable to fetch it.

Ideally, if you could provide us with your AWS account number, we could set up a bucket policy that only allows your AWS services to access our buckets. It shouldn’t take much work to support this on your end. Cloudinary has an example of this workflow.
https://cloudinary.com/documentation/upload_images#how_to_set_read_access_on_a_private_amazon_s3_buc...

draou_mohssin
4 - Data Explorer
4 - Data Explorer

It’s january 2021, and this feature is not available yet :confused:

Bertha_Kgokong
4 - Data Explorer
4 - Data Explorer

There is an easier solution that does not involve third parties. You can simply save all your documents in a folder - that you then host on a http-server. Use a service like nginx to serve that folder over http, or even https. Then as you save the documents, you also pass the http/s address to the Airtable API - I tested it and it works, will write a code snipet for python in a tutorial soon . . . . . NOTE: I found, you should not immediately delete the files, maybe create a function to delete the files from your server after a couple of seconds, to prevent clutter.

Ah nice! Saas that requires you to also run your own server in parallel, and host all documents in public view :slightly_smiling_face:

Hi! No news for this Upload feature? Thanks

paul_shorey
4 - Data Explorer
4 - Data Explorer

The weird thing about using Cloudinary though, is that Cloudinary is a much better image management solution than Airtable. But, using it as an intermediary, Airtable will copy the file to their own server, and display it as an attachment. So when you go to edit your Airtable, you will be able to delete or re-upload a different image. But unfortunately, this will not sync/update to your Cloudinary. So your Cloudinary will still have the original image. This may become confusing. Alternative is to use Cloudinary, and upload the URL to Airtable as plain text. Then, you will remember that Cloudinary is the source of truth.

Cloudinary has a strict limit of 10mb per file. Or 20mb if you pay for the premium account. So that is something to keep in mind.

I’d like to find some image/file hosting service that is free, disposable, and has no maximum file size, to use as an intermediary. Ideally, it will delete the files I upload to it after some time. Then, I can just use Airtable to manually edit/re-upload the files, after they have been uploaded via the API.

Cloudinary is superior because it lets you resize/optimize/crop images. But, here’s a great trick… CloudFlare also has this, for $20/mo. It lets you pass in any image, from any domain, to their URL, and it will resize/optimize/crop it for you just like Cloudinary does.

Wondering what people think, if this makes sense? I too was hoping to manage all my data, content, and files/images in Airtable.

Partyborn
6 - Interface Innovator
6 - Interface Innovator

Did anyone find a solution in the meantime?

EvgenyL
4 - Data Explorer
4 - Data Explorer

We are really missing this feature. Uploading file using 3d-party service is very inconvenient. Could you please rise the priority of this feature in your backlog? Thank you.

Eugene_Ng
4 - Data Explorer
4 - Data Explorer

Hi, I tried to build an App in Thunkable that can upload pictures into Airtable. I’m thankful I found this post. I’ll be very grateful if this can be done natively. Thank you.

ng010105
6 - Interface Innovator
6 - Interface Innovator

HERE IS The working solution

curl -X PATCH "https://api.airtable.com/v0/{baseId}/{tableId}/{recordId}" \ -H "Authorization: Bearer {YOUR_TOKEN}" \ -H "Content-Type: application/json" \ --data "{\"fields\": {\"attachment1\":[ {\"url\": \"https://www.redcross.org.hk/sites/redcross/files/index_top/Agency%20website%202880x1900%20%20bilingu..."}]}}"

att.PNG

 

https://support.airtable.com/docs/finding-airtable-record-ids