Data Hub
Files

Create a run file record

Requires scope `files:create`. PAT only; browser sessions are rejected. A token that registered a watcher may act only on instruments whose active watcher it registered, and gets 403 for any other. The location must be the file's own: `s3_key` must be `<instrumentId>/<runId>/<filename>`, using the run ID as stored, `filename` can't contain `/`, and `s3_bucket` must be Data Hub's raw bucket for a `raw` file or its processed bucket for a `processed` one. Any other location gets `400`. `source_file_id` is for a `processed` file and names the raw file of this run that it was made from; any other value gets `400`. An existing processed file that has no source yet is linked to it; one that has a source keeps it. A processed file made from a deleted raw file is saved deleted, and when the key belongs to a deleted processed file, that file is saved again as the new output. `409` means the run is deleted, or another file already uses that key or path.

POST
/instruments/{instrumentId}/runs/{runId}/files

Requires scope files:create. PAT only; browser sessions are rejected. A token that registered a watcher may act only on instruments whose active watcher it registered, and gets 403 for any other. The location must be the file's own: s3_key must be <instrumentId>/<runId>/<filename>, using the run ID as stored, filename can't contain /, and s3_bucket must be Data Hub's raw bucket for a raw file or its processed bucket for a processed one. Any other location gets 400. source_file_id is for a processed file and names the raw file of this run that it was made from; any other value gets 400. An existing processed file that has no source yet is linked to it; one that has a source keeps it. A processed file made from a deleted raw file is saved deleted, and when the key belongs to a deleted processed file, that file is saved again as the new output. 409 means the run is deleted, or another file already uses that key or path.

Authorization

bearerAuth
AuthorizationBearer <token>

Personal access tokens begin with dhub_… and are restricted by their assigned scopes.

In: header

Path Parameters

instrumentId*string
runId*string

The run ID. Spaces at the start or end are ignored.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/instruments/plate-reader/runs/run-2026-001/files" \  -H "Content-Type: application/json" \  -d '{    "s3_bucket": "string",    "s3_key": "string",    "filename": "string"  }'
{  "id": 0,  "instrument_run_id": "09e81fd0-3875-4ea7-a8b5-166f38633c23",  "filename": "string",  "relative_path": "string",  "s3_bucket": "string",  "s3_key": "string",  "content_type": "string",  "size_bytes": 0,  "category": "raw",  "status": "detected",  "metadata": {    "property1": null,    "property2": null  },  "error_message": "string",  "detected_at": "2019-08-24T14:15:22Z",  "upload_requested_at": "2019-08-24T14:15:22Z",  "uploaded_at": "2019-08-24T14:15:22Z",  "processed_at": "2019-08-24T14:15:22Z",  "processing_started_at": "2019-08-24T14:15:22Z",  "created_at": "2019-08-24T14:15:22Z",  "file_created_at": "2019-08-24T14:15:22Z",  "deleted_at": "2019-08-24T14:15:22Z"}
{  "id": 0,  "instrument_run_id": "09e81fd0-3875-4ea7-a8b5-166f38633c23",  "filename": "string",  "relative_path": "string",  "s3_bucket": "string",  "s3_key": "string",  "content_type": "string",  "size_bytes": 0,  "category": "raw",  "status": "detected",  "metadata": {    "property1": null,    "property2": null  },  "error_message": "string",  "detected_at": "2019-08-24T14:15:22Z",  "upload_requested_at": "2019-08-24T14:15:22Z",  "uploaded_at": "2019-08-24T14:15:22Z",  "processed_at": "2019-08-24T14:15:22Z",  "processing_started_at": "2019-08-24T14:15:22Z",  "created_at": "2019-08-24T14:15:22Z",  "file_created_at": "2019-08-24T14:15:22Z",  "deleted_at": "2019-08-24T14:15:22Z"}
{  "error": {    "code": "string",    "message": "string",    "details": {      "property1": null,      "property2": null    }  }}
{  "error": {    "code": "string",    "message": "string",    "details": {      "property1": null,      "property2": null    }  }}
{  "error": {    "code": "string",    "message": "string",    "details": {      "property1": null,      "property2": null    }  }}
{  "error": {    "code": "string",    "message": "string",    "details": {      "property1": null,      "property2": null    }  }}
{  "error": {    "code": "string",    "message": "string",    "details": {      "property1": null,      "property2": null    }  }}