How to Download Task Source for All Tasks in a Label Studio Project?

Answer:

Yes, downloading task sources for all tasks in a project is possible using the Label Studio API or SDK.

Method 1: Using the Label Studio API

Use the /api/projects/{id}/export endpoint. To include tasks without annotations, append the download_all_tasks=true parameter. Here’s a command example using curl:

curl -X GET "https://<your-label-studio-url>/api/projects/{project_id}/export?exportType=JSON&download_all_tasks=true" -H "Authorization: Token {your_api_token}" --output tasks.json

Method 2: Using the Label Studio SDK

For the Python SDK, utilize the export_tasks method as follows:

from label_studio_sdk import Client

# Initialize the client
ls = Client(url='https://<your-label-studio-url>', api_key='your_api_key')

# Get the project
project = ls.get_project(project_id)

# Export tasks
tasks = project.export_tasks(export_type='JSON', download_all_tasks=True)

Replace placeholders with your actual Label Studio URL, project ID, and API key. If performance issues arise due to numerous tasks, consider exporting in snapshots or in paginated batches.