Hello everyone,
We’re excited to announce that our Upload API now supports the ability to make POST requests for file uploads with the ability to specify the name
for your file and also select a destination folder using the Folder ID
.
Prerequisites:
Before we get started, make sure you have the following:
- A Builder account with Developer or Admin permissions. This is necessary to create a Private API Key.
- Private API Key. You can generate one by Creating a Private API Key.
To enhance the organization of your resources, you can now use folders to structure your files. These can be accessed conveniently from the Sidebar menu.
Now, let’s dive in and see how it’s done.
1. Uploading a File by Specifying Only the File Name:
When making a request, use the query parameter name
with the value <filename>.<extension>
(e.g., Mustang.jpg).
Here’s a sample request using cURL:
curl --location 'https://builder.io/api/v1/upload?name=fileName.ext' \
--header 'Content-Type: image/png' \
--header 'Authorization: Bearer <Private API Key>' \
--data-binary '@/path/to/your-file.ext'
It’s recommended to always include the name parameter when uploading a file.
2. Uploading a File to a Specific Folder:
To upload a file to a designated folder, follow these steps:
-
Create a new folder or select an existing one to obtain the Folder ID. You can find the Folder ID by hovering over the folder and clicking on the edit icon.
In the Edit Asset Folder popup, you’ll find the Folder ID.
With the Folder ID in hand, you can now create a sample request with both the name
and folder
parameters:
curl --location 'https://builder.io/api/v1/upload?folder=<FOLDER_ID_HERE>&name=fileName.ext \
--header 'Content-Type: image/png' \
--header 'Authorization: Bearer <Private API Key>' \
--data-binary '@/path/to/your-file.ext'
For more detailed examples and code samples, check out our documentation.
Enjoy seamless file uploading with our enhanced Upload API!
Happy POSTing!