Uploading a .csv file to Supabase

I’m having trouble uploading a file to Supabase. I’m getting a ‘400 Bad Request’ error. I’ve tried lots of permutations but nothing seems to work.

I did manage to get a Raw text file uploaded - which was by importing a CURL request. This a local path to the .csv file in it, that Postman converted to text. So, it seems to be a configuration issue in Postman but I can’t nail it down.

I assumed it would be trivial to do but I must be missing a beat here. Any suggestions?

Hey @colinpmiles :wave:,

Welcome to the Postman community :postman:

Are you following some public documentation that’s telling you the structure of the request?

Without that or seeing how you’re building your request, it’s going to be difficult for anyone to help here.

Hi Danny

Yes, I’m following the public documentation as far as it goes.

https://myProjectID.supabase.co/storage/v1/object/stage1route/marinasNEW.csv

I’m using an apiKey and a Bearer token in the header and I’ve tried various Content-Types

Just getting a Bad Request every time…

Sharing that same documentation with us, would make it alot easier for us to see :smiley:

My apologies:

Which API operation within those instructions are you trying to follow?

I can’t find anything related to CSV’s.

The REST API also has the following format.

https://<project_ref>.supabase.co/rest/v1/

Where your previous post appears to be pointing to a storage end point.

I can’t find anything related to storage on that site.

Are you sure you are looking at the correct instructions?

Hi Mike

As far as I can tell, the documents are incomplete e.g.

It seems that an appended endpoint is required to the storage bucket.

In theory, it should allow me to upload any file. My .csv file was just for testing purposes.

They have a Swagger page: Swagger UI

But that hasn’t helped either.

Copilot tells me this:

curl -X POST “https://.supabase.co/storage/v1/object//.csv”
–data-binary “@/path/to/your/file.csv”
-H “apikey: ”
-H “Authorization: Bearer ”

I went back to the original CURL request from CoPilot on Windows and replaced the keys once again, imported it into Postman, switched to binary in the Body column and ran it again. Whatever bug there was, I couldn’t see it. But it’s working now.

Thanks guys!

1 Like

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