API_KEY='live_...'
PARAMS='dataset_id=my_dataset_123&limit=1'
curl --request GET \
--url "https://api.scale.com/v2/datasets/tasks?$PARAMS" \
--header "Authorization: Bearer $API_KEY"{
"tasks": [
{
"$ref": "#/components/examples/SampleDatasetTask/value"
}
],
"next_token": "imatoken123"
}{
"status_code": 500,
"error": "An error has occurred."
}Tasks
Get Multiple Dataset Tasks
Retrieve multiple Dataset Tasks from a Dataset or Delivery.
GET
/
v2
/
datasets
/
tasks
API_KEY='live_...'
PARAMS='dataset_id=my_dataset_123&limit=1'
curl --request GET \
--url "https://api.scale.com/v2/datasets/tasks?$PARAMS" \
--header "Authorization: Bearer $API_KEY"{
"tasks": [
{
"$ref": "#/components/examples/SampleDatasetTask/value"
}
],
"next_token": "imatoken123"
}{
"status_code": 500,
"error": "An error has occurred."
}Authentication
Authentication
Every request sent to Scale’s API requires authentication. In short, your API Key is the Bearer token. See the Authentication section for more details.
Pagination
Pagination
Remember to handle pagination when downloading large sets of tasks.
limit).
If your request returns more tasks than your specified limit, API response will also contain a next_token until you reach to the last page.You can set the next_token in your next request to continue downloading tasks from the next page.Required query parameters
You are expected to provide one of the following to start downloading tasks:- Dataset (
dataset_id) - Delivery (
delivery_id)
Example Code
Download All Tasks From a Dataset as JSONL
Download All Tasks From a Dataset as JSONL
# Downloads all tasks from a dataset
import json
import requests
API_KEY = 'live_...'
DATASET_ID = 'MY DATASET ID'
def get_tasks_by_dataset(dataset_id: str):
tasks = []
params = {
"dataset_id": dataset_id,
}
should_fetch = True
while should_fetch:
response = requests.request(
"GET",
url="https://api.scale.com/v2/datasets/tasks",
params=params,
headers={
"Accept": "application/json",
"Authorization": f"Bearer {API_KEY}",
},
)
json_resp = response.json()
next_token = json_resp.get('next_token')
if next_token:
params['next_token'] = next_token
else:
should_fetch = False
tasks.extend(json_resp['tasks'])
return tasks
if __name__ == "__main__":
tasks = get_tasks_by_dataset(DATASET_ID)
with open(f'dataset_{DATASET_ID}_tasks.jsonl', 'w+') as f:
for task in tasks:
json.dump(task, f)
f.write('\n')
Authorizations
bearerAuthbasicAuth
Your API Key is the Bearer token. See the Authentication section to learn how to access your key.
Query Parameters
Scale's unique identifier for the dataset. Unique identifier for a dataset
Example:
"dataset_abc123"
Scale's unique identifier for the delivery. A unique identifier for the delivery.
Example:
"delivery_abc123"
A timestamp formatted as an ISO 8601 date-time string.
A timestamp formatted as an ISO 8601 date-time string.
Limit the number of entities returned.
Required range:
1 <= x <= 100A token used to retrieve the next page of results if there are more. You can find the next_token in your last request

