How to Upload Files to BoltonSea API

As a backend or full-stack developer, I am sure you are aware that working with files is an inevitable part of the job. From handling uploads and downloads to processing data. File management is a common requirement in many applications.

file upload into cloud

Here is a tutorial that demonstrates how to upload media to a BoltonSea API.

Prerequisite

This is a guide to help you create an API key with CREATE access for your BoltonSea account. This key is essential for tasks such as uploading new content to the platform.

  1. Sign In or Sign Up: First, navigate to the BoltonSea platform and either sign in to your existing account or create a new one if you haven't already.

  2. Create API Key: Once logged in, proceed to the section for API key management.

    • Click the user badge (top right of the screen), navigate to Profile -> API KEY
  3. Grant CREATE Access: When creating your new API key, ensure that you explicitly grant it "CREATE" access. This is crucial as it provides the necessary permissions for the key to create content, such as uploading new content, within the platform.

Following the creation of the API key, we will need to proceed with thorough testing using a live working code. This will allow us to validate its functionality, performance, and integration capabilities under real-world conditions.

Create API_KEY Prompt
Illustration: Showing the prompt to create a new API_KEY

Code to Implement File Upload

I'm sharing the sample code below to test our file upload feature.

import requests
url = "https://api.boltonsea.com/media"
payload = {'media_group_id': '113', 'account_id': '140'}
files=[
('file',('generic_icon.svg', open('/Users/jaine/Desktop/generic_icon.svg', 'rb'), 'image/svg+xml'))
]
headers = {
'X-API-KEY': '00-000E4XXLL555B33EF22222FB...'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)

File Upload Reponse

Below is the response received from the upload API action. It has returned a JSON response containing the necessary properties to identify and utilize the uploaded file.

{
"id": 26,
"width": 0,
"height": 0,
"maintain_aspect_ratio": false,
"is_parent_file": true,
"mime_type": "image/svg+xml",
"private_url": "https://api.boltonsea.com/media/file/140/2025/10/wuobaliax4lyf1ey.svg",
"public_url": "https://io.boltonsea.com/static_files/140/2025/10/wuobaliax4lyf1ey.svg",
"original_file_name": "generic_icon.svg",
"file_size": 738,
"created_on": "2025-10-16T16:21:48.748+00:00"
}

Should you have any inquiries regarding Users or require additional assistance, please contact us through the contact-us page.