Skip to main content
POST
/
v1
/
files
Generate presigned upload URL
curl --request POST \
  --url https://api.sandbox.busha.so/v1/files \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "category": "generic",
  "file_type": "application/pdf",
  "file_name": "document.pdf",
  "document_id": "123",
  "key_only": false
}
'
import requests

url = "https://api.sandbox.busha.so/v1/files"

payload = {
"category": "generic",
"file_type": "application/pdf",
"file_name": "document.pdf",
"document_id": "123",
"key_only": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
category: 'generic',
file_type: 'application/pdf',
file_name: 'document.pdf',
document_id: '123',
key_only: false
})
};

fetch('https://api.sandbox.busha.so/v1/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.busha.so/v1/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'category' => 'generic',
'file_type' => 'application/pdf',
'file_name' => 'document.pdf',
'document_id' => '123',
'key_only' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.sandbox.busha.so/v1/files"

payload := strings.NewReader("{\n \"category\": \"generic\",\n \"file_type\": \"application/pdf\",\n \"file_name\": \"document.pdf\",\n \"document_id\": \"123\",\n \"key_only\": false\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.sandbox.busha.so/v1/files")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"category\": \"generic\",\n \"file_type\": \"application/pdf\",\n \"file_name\": \"document.pdf\",\n \"document_id\": \"123\",\n \"key_only\": false\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.sandbox.busha.so/v1/files")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"category\": \"generic\",\n \"file_type\": \"application/pdf\",\n \"file_name\": \"document.pdf\",\n \"document_id\": \"123\",\n \"key_only\": false\n}"

response = http.request(request)
puts response.read_body
{
  "status": "success",
  "message": "message for success",
  "data": {
    "upload_url": "https://s3.amazonaws.com/bucket/key?signature=...",
    "public_link": "https://cdn.busha.co/generic/123/document.pdf",
    "expires_at": "2024-01-01T00:00:00Z"
  }
}

Authorizations

Authorization
string
header
required

Bearer Authentication

Headers

X-BU-PROFILE-ID
string

User profile header

Example:

"BUS_YOK8tp5Zga01qOKEsqp07"

Body

application/json

Request parameters for presigned URL

category
enum<string>
default:generic
required
Available options:
generic,
avatar,
document,
usd_payment_proof,
checkout-logo,
business-logo,
compliance-docs,
index
file_type
string
Example:

"application/pdf"

file_name
string
Example:

"document.pdf"

document_id
string
Example:

"123"

key_only
boolean
default:false

Response

Successful response

General response Values

status
enum<string>
required
Available options:
success,
error
Example:

"success"

message
string
required
Example:

"message for success"

data
object
required