File Upload

File Upload Size: There is a size limit of 80 MB per file. Need more? Get in touch.

Body Params

filefilerequired

The local file to be uploaded.


display_namestring

A human readable name for the file.


project_namestring

Which project this file will be associated with. This is only used for the "Scale Rapid" data labeling tool. In order to upload the same file to multiple projects, call the File Upload API multiple times with the same id and different project_name values.


reference_idstring

A unique identifier for your file used for upload idempotency. Uploading two files with the same_reference_id will result in a 409 (Conflict) error.


metadataobject

A JSON object used to store additional data associated with the file.


Request

POST/v1/files/upload
import requests
from requests.auth import HTTPBasicAuth
import json


url = "https://api.scale.com/v1/files/upload"

auth = HTTPBasicAuth('{{api_key}}', '')

headers = {
    "Accept": "application/json",
}

with open("kitten.png", "rb") as f:
    response = requests.request(
        "POST",
        url,
        data={
            "project_name": "kitten_labeling",
            "metadata": json.dumps({"id": "kitten0"}),
        },
        files={"file": f},
        headers=headers,
        auth=auth,
    )
    print(response.text)
POST/v1/files/upload
with open(file_name, 'rb') as f:
    my_file = client.upload_file(
        file=f,
        project_name = "test_project",
    )

File Import

Body Params

file_urlfilerequired

The file url to be uploaded.


Request

POST/v1/files/import
import requests
url = "https://api.scale.com/v1/files/import"
payload = { "file_url": "http://www.example.com/file.png" }
headers = {
    "accept": "application/json",
    "content-type": "application/json",
    "authorization": "<YOUR_API_KEY>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
POST/v1/files/import
my_file = client.import_file(
    file_url="http://i.imgur.com/v4cBreD.jpg",
    project_name = "test_project",
)

Get Assets

Body Params

projectstringrequired

Project filter


metadatastring

Metadata filter


cursorstring

Cursor for pagination


Updated 4 months ago