Skip to main content
POST
/
api
/
v1
/
files
/
upload
Request Upload Url
import requests

url = "https://www.datalab.to/api/v1/files/upload"

payload = {
    "filename": "<string>",
    "content_type": "<string>",
    "processing_location": "<string>"
}
headers = {
    "X-API-Key": "<api-key>",
    "Content-Type": "application/json"
}

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

print(response.text)
curl --request POST \
  --url https://www.datalab.to/api/v1/files/upload \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "filename": "<string>",
  "content_type": "<string>",
  "processing_location": "<string>"
}
'
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    filename: '<string>',
    content_type: '<string>',
    processing_location: '<string>'
  })
};

fetch('https://www.datalab.to/api/v1/files/upload', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
package main

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

func main() {

	url := "https://www.datalab.to/api/v1/files/upload"

	payload := strings.NewReader("{\n  \"filename\": \"<string>\",\n  \"content_type\": \"<string>\",\n  \"processing_location\": \"<string>\"\n}")

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

	req.Header.Add("X-API-Key", "<api-key>")
	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))

}
{
  "file_id": 123,
  "upload_url": "<string>",
  "reference": "<string>",
  "expires_in": 3600
}
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>"
    }
  ]
}

Authorizations

X-API-Key
string
header
required

Cookies

wos-session
string
datalab_active_team
string

Body

application/json

Request to get a presigned upload URL.

filename
string
required

Original filename (used for storage path and metadata)

content_type
string
required

MIME type of the file

processing_location
string | null

Optional residency region override (e.g. us, eu). When provided, the direct-upload URL is issued for storage in that region.

Response

Successful Response

Response with presigned PUT URL for direct storage upload.

file_id
integer
required

Unique file ID (use this to confirm upload)

upload_url
string
required

Presigned PUT URL to upload the file to

reference
string
required

File reference in datalab://file-{id} format

expires_in
integer
default:3600

URL expiry time in seconds