Skip to contentSkip to page list

Docs

Create an upload for an image or file cell

Answers the address to PUT the file to. After the PUT, confirm the upload at POST /api/v1/stored-objects/uploads/{objectId}/confirmation, then write /api/files/{projectId}/{objectId}/{filename} into the cell.

POST/api/v1/dataset/attachments/uploads
Request and response examples
request.py
import osimport requests​origin = "https://app.langwatch.ai"path = "/api/v1/dataset/attachments/uploads"api_key = os.environ["LANGWATCH_API_KEY"]headers = {    "X-Auth-Token": api_key,    "Content-Type": "application/json",}payload = {}​response = requests.post(    origin + path,    headers=headers,    json=payload,)print(response.json())

Success

application/json · Generated from schema

{  "objectId": "string",  "uploadUrl": "string",  "method": "PUT",  "headers": {},  "expiresAt": "string"}
api-reference/datasets/create-an-upload-for-an-image-or-file-cell

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.

Request body

application/json · Required

filenamestringrequired

The file name the reference will carry.

At least 1 character
mediaTypestringrequired

The media type of the file.

At least 1 characterUp to 127 charactersPattern ^[\u0020-\u007e]+$
byteLengthintegerrequired

The size of the file, in bytes.

Minimum 0Maximum 9007199254740991

Responses

201

Success

application/json

objectIdstringrequired
At least 1 character
uploadUrlstring (uri)required
methodstringrequired
Always"PUT"
headersobject
expiresAtstringrequired
At least 1 character
413

The file is larger than the organization's limit.

415

The media type is not accepted.

429

Too many uploads for this project in one minute.

Documentation