Skip to content

Upload Dataset File

Upload a single file to the dataset with a specific user context.

POST /datasets


file binary Required

The file to upload. This endpoint accepts a single file per request using multipart/form-data.
To upload multiple files, make multiple requests to this endpoint.

userContext string Required

User context for scoping the file, as a JSON-encoded string. The context determines the ownership and isolation boundary—commonly used for multi-tenant scenarios.
Pass your context object through JSON.stringify() before sending.
For example: JSON.stringify({userId: 123}) ensures this file is scoped to that specific user.
Only requests providing the matching context can retrieve or delete this file.

notes string

Optional description or notes about the dataset.


Request
import Inconvo from "@inconvoai/node";
import fs from "fs";
const inconvo = new Inconvo({
apiKey: process.env.INCONVO_API_KEY
});
const result = await inconvo.datasets.upload({
file: fs.createReadStream("./sales_report_q4.csv"),
userContext: JSON.stringify({ userId: 123 })
});
console.log(result);
Response
{
"file": {
"name": "sales_report_q4.csv",
"path": "org_f7344f00-d169-48be-8fb6-57b0643214ea/agt_82dd40ea-9703-4cd7-b43d-6f1ed644341d/userId:123/sales_report_q4.csv",
"size": 2048576
}
}
curl -X POST "https://app.inconvo.ai/api/v1/datasets" \
-H "Authorization: Bearer $INCONVO_API_KEY" \
-F "file=@./sales_report_q4.csv" \
-F "userContext={\"userId\": 123}"
Response
{
"file": {
"name": "sales_report_q4.csv",
"path": "org_f7344f00-d169-48be-8fb6-57b0643214ea/agt_82dd40ea-9703-4cd7-b43d-6f1ed644341d/userId:123/sales_report_q4.csv",
"size": 2048576
}
}