Skip to main content
GET
/
v2
/
datasets
/
delivery
API_KEY='live_...'
DELIVERY_ID='delivery_abc123'
curl --request GET \
--url "https://api.scale.com/v2/datasets/delivery?delivery_id=$DELIVERY_ID" \
--header "Authorization: Bearer $API_KEY"
{
  "delivery": {
    "id": "delivery_abc123",
    "name": "My Delivery - 2024-01-15",
    "delivered_at": "2024-01-15T10:30:00Z",
    "metadata": {
      "task_count": 100,
      "turn_count": 100
    },
    "dataset": "dataset_abc123"
  },
  "tasks": [
    {
      "task_id": "task_123",
      "delivery": "delivery_123",
      "dataset": "dataset_123",
      "response": {
        "key_1": "value_1",
        "key_2": "value_2"
      }
    }
  ],
  "next_token": "imatoken123"
}
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.

Required query parameters

You are expected to provide the following to find a delivery:
  • delivery_id Delivery IDs are globally unique and can be used to retrieve a specific delivery.

Example Code

# Downloads all tasks from a delivery
import json
import requests


API_KEY = 'live_...'
delivery_id = 'delivery_123'

def get_tasks_by_delivery(delivery_id: str):
    tasks = []
    params = {
        "delivery_id": delivery_id,
    }

    should_fetch = True

    while should_fetch:
        response = requests.request(
            "GET",
            url="https://api.scale.com/v2/datasets/delivery",
            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_delivery(delivery_id)

    with open(f'{delivery_id}.jsonl', 'w+') as f:
        for task in tasks:
            json.dump(task, f)
            f.write('\n')

Authorizations

Authorization
string
header
required

Your API Key is the Bearer token. See the Authentication section to learn how to access your key.

Query Parameters

delivery_id
string

Scale's unique identifier for the delivery.

Example:

"delivery_abc123"

limit
integer

Limit the number of entities returned.

Required range: 1 <= x <= 100
next_token
string

A token used to retrieve the next page of results if there are more. You can find the next_token in your last request.

expand
enum<string>[]

List of fields to expand in the response.

Response

List of delivered dataset tasks.

tasks
object[]
required
delivery

Delivery ID or Delivery associated with the task. Unique identifier for a delivery

Example:

"delivery_abc123"

next_token
string

A token used to retrieve the next page of results if there are more. You can find the next_token in your last request

I