Skip to contentSkip to page list

Docs

Upload a file

Upload a file (CSV, JSON, JSONL) to an existing dataset. upload the file as a stored object with the purpose dataset_import, then create the dataset from it.

POST/api/v1/dataset/{slugOrId}/upload
Request and response examples
request.py
import osimport requestsimport json​origin = "https://app.langwatch.ai"path = "/api/v1/dataset/<slugOrId>/upload"api_key = os.environ["LANGWATCH_API_KEY"]headers = {    "X-Auth-Token": api_key,    "Content-Type": "application/json",}​# Supply your request body in payload.jsonwith open("payload.json") as file:    payload = json.load(file)​response = requests.post(    origin + path,    headers=headers,    json=payload,)print(response.json())

Success

application/json · Generated from schema

{  "datasetId": "string",  "recordsCreated": 0}
api-reference/datasets/action-upload

Authorization

X-Auth-Tokenstringheaderrequired

Project API key for sending traces and accessing project-scoped resources. Format: sk-lw-... (no underscore). Obtain one by creating a project via the Admin API or the LangWatch UI.

Path parameters

slugOrIdstringrequired

Request body

multipart/form-data · Required

filestring (binary)required

Responses

200

Success

application/json

datasetIdstringrequired
recordsCreatedintegerrequired
Minimum 0Maximum 9007199254740991

Documentation