# Upload ## Initiate a dataset upload **post** `/api/v1/datasets/upload/initiate` Initiate a dataset upload ### Body Parameters - `file_format: "csv" or "json" or "jsonl" or "parquet"` Format of the file being uploaded - `"csv"` - `"json"` - `"jsonl"` - `"parquet"` - `name: string` Human-readable name for the dataset ### Returns - `upload_url: string` Pre-signed S3 URL — upload the file directly to this URL via HTTP PUT ### Example ```http curl https://api.adaptionlabs.ai/api/v1/datasets/upload/initiate \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $ADAPTION_API_KEY" \ -d '{ "file_format": "csv", "name": "my-training-data" }' ``` #### Response ```json { "upload_url": "https://s3.amazonaws.com/bucket/key?X-Amz-Signature=..." } ``` ## Complete a dataset upload and trigger processing **post** `/api/v1/datasets/upload/complete` Complete a dataset upload and trigger processing ### Body Parameters - `file_format: "csv" or "json" or "jsonl" or "parquet"` Format of the uploaded file - `"csv"` - `"json"` - `"jsonl"` - `"parquet"` - `file_size_bytes: number` Size of the uploaded file in bytes - `name: string` Human-readable name for the dataset - `s3_key: string` S3 object key returned in the pre-signed URL response from /upload/initiate ### Returns - `dataset_id: string` ID of the newly created dataset ### Example ```http curl https://api.adaptionlabs.ai/api/v1/datasets/upload/complete \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $ADAPTION_API_KEY" \ -d '{ "file_format": "csv", "file_size_bytes": 1048576, "name": "my-training-data", "s3_key": "uploads/550e8400-e29b-41d4-a716-446655440000/my-training-data.csv" }' ``` #### Response ```json { "dataset_id": "550e8400-e29b-41d4-a716-446655440000" } ``` ## Complete a file upload and trigger processing **post** `/api/v1/datasets/{dataset_id}/upload/complete` File uploads only. Call after uploading bytes to the presigned URL from POST /datasets. Verifies the file exists in S3, then triggers the preprocessing pipeline. ### Path Parameters - `dataset_id: string` ### Body Parameters - `file_size_bytes: number` Size of the uploaded file in bytes (for verification) - `sha256: optional string` SHA-256 hex digest of the uploaded file (for integrity verification) ### Returns - `dataset_id: string` ID of the dataset - `status: string` Current status of the dataset after completing upload ### Example ```http curl https://api.adaptionlabs.ai/api/v1/datasets/$DATASET_ID/upload/complete \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $ADAPTION_API_KEY" \ -d '{ "file_size_bytes": 1048576, "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" }' ``` #### Response ```json { "dataset_id": "550e8400-e29b-41d4-a716-446655440000", "status": "processing" } ```