Skip to main content
POST
/
v1
/
files
Request a signed URL for file upload
curl --request POST \
  --url https://api.turbofiles.io/v1/files \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/vnd.api+json' \
  --data '
{
  "data": {
    "type": "files",
    "attributes": {
      "size": 504233
    }
  }
}
'
import requests

url = "https://api.turbofiles.io/v1/files"

payload = { "data": {
"type": "files",
"attributes": { "size": 504233 }
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/vnd.api+json"
}

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

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/vnd.api+json'},
body: JSON.stringify({data: {type: 'files', attributes: {size: 504233}}})
};

fetch('https://api.turbofiles.io/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.turbofiles.io/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([
'data' => [
'type' => 'files',
'attributes' => [
'size' => 504233
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/vnd.api+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.turbofiles.io/v1/files"

payload := strings.NewReader("{\n \"data\": {\n \"type\": \"files\",\n \"attributes\": {\n \"size\": 504233\n }\n }\n}")

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

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/vnd.api+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.turbofiles.io/v1/files")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/vnd.api+json")
.body("{\n \"data\": {\n \"type\": \"files\",\n \"attributes\": {\n \"size\": 504233\n }\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.turbofiles.io/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/vnd.api+json'
request.body = "{\n \"data\": {\n \"type\": \"files\",\n \"attributes\": {\n \"size\": 504233\n }\n }\n}"

response = http.request(request)
puts response.read_body
{
  "jsonapi": {
    "version": "1.1"
  },
  "data": {
    "type": "files",
    "id": "8fhd83jpk",
    "attributes": {
      "size": 504233,
      "created_at": "2023-11-07T05:31:56Z",
      "updated_at": "2023-11-07T05:31:56Z"
    },
    "links": {
      "self": "<string>",
      "upload": "<string>",
      "download": "<string>"
    }
  },
  "links": {
    "self": "<string>"
  }
}

Authorizations

Authorization
string
header
required

Authentication token must be provided in the Authorization header using the Bearer scheme. Example: Authorization: Bearer your-api-key-or-token

Body

application/vnd.api+json
data
object
required

Response

201 - application/vnd.api+json

Created successfully

jsonapi
object
required
data
object
required