# Get Dataset Upload URL GET https://api.prolific.com/api/v1/data-collection/datasets/{dataset_id}/upload-url/{filename} This endpoint generates a presigned URL that allows you to upload a file directly to S3. After receiving the presigned URL, you should make a PUT request to the returned URL with your file data. **Upload Process:** 1. Call this endpoint to get a presigned URL for your file 2. Use the returned URL to upload your file directly to S3 via a PUT request 3. Monitor the dataset status to know when processing is complete Reference: https://beta-docs.prolific.com/api-reference/ai-task-builder/get-dataset-upload-url ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Get Dataset Upload URL version: endpoint_aiTaskBuilder.getDatasetUploadUrl paths: /api/v1/data-collection/datasets/{dataset_id}/upload-url/{filename}: get: operationId: get-dataset-upload-url summary: Get Dataset Upload URL description: > This endpoint generates a presigned URL that allows you to upload a file directly to S3. After receiving the presigned URL, you should make a PUT request to the returned URL with your file data. **Upload Process:** 1. Call this endpoint to get a presigned URL for your file 2. Use the returned URL to upload your file directly to S3 via a PUT request 3. Monitor the dataset status to know when processing is complete tags: - - subpackage_aiTaskBuilder parameters: - name: dataset_id in: path description: The ID of the dataset to upload files to required: true schema: type: string - name: filename in: path description: The name of the file to upload required: true schema: type: string - name: Authorization in: header description: Header authentication of the form `undefined ` required: true schema: type: string responses: '201': description: Presigned URL generated successfully content: application/json: schema: $ref: >- #/components/schemas/AI Task Builder_getDatasetUploadUrl_Response_201 '400': description: Bad request (e.g., invalid dataset ID or filename) content: {} '403': description: Forbidden (e.g., user does not have access to the workspace) content: {} '404': description: Dataset not found content: {} components: schemas: ApiV1DataCollectionDatasetsDatasetIdUploadUrlFilenameGetResponsesContentApplicationJsonSchemaHttpMethod: type: string enum: - value: PUT AI Task Builder_getDatasetUploadUrl_Response_201: type: object properties: dataset_id: type: string format: uuid description: The ID of the dataset expires_at: type: string format: date-time description: When the presigned URL expires http_method: $ref: >- #/components/schemas/ApiV1DataCollectionDatasetsDatasetIdUploadUrlFilenameGetResponsesContentApplicationJsonSchemaHttpMethod description: HTTP method to use with the presigned URL upload_url: type: string description: The presigned URL to use for uploading the file ``` ## SDK Code Examples ```python import requests url = "https://api.prolific.com/api/v1/data-collection/datasets/dataset_id/upload-url/filename" headers = {"Authorization": ""} response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.prolific.com/api/v1/data-collection/datasets/dataset_id/upload-url/filename'; const options = {method: 'GET', headers: {Authorization: ''}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/data-collection/datasets/dataset_id/upload-url/filename" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/data-collection/datasets/dataset_id/upload-url/filename") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = '' response = http.request(request) puts response.read_body ``` ```java HttpResponse response = Unirest.get("https://api.prolific.com/api/v1/data-collection/datasets/dataset_id/upload-url/filename") .header("Authorization", "") .asString(); ``` ```php request('GET', 'https://api.prolific.com/api/v1/data-collection/datasets/dataset_id/upload-url/filename', [ 'headers' => [ 'Authorization' => '', ], ]); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.prolific.com/api/v1/data-collection/datasets/dataset_id/upload-url/filename"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", ""); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Authorization": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/data-collection/datasets/dataset_id/upload-url/filename")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```