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.
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.
Try this endpoint
app.langwatch.ai
API key · X-Auth-Token
Kept in this tab. Cleared when you reload.
The file name the reference will carry.
The media type of the file.
The size of the file, in bytes.
This sends a live request to app.langwatch.ai.
Request and response examples
import osimport requestsorigin = "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())const url = "https://app.langwatch.ai/api/v1/dataset/attachments/uploads";const response = await fetch(url, { method: "POST", headers: { "X-Auth-Token": process.env.LANGWATCH_API_KEY!, "Content-Type": "application/json", }, body: JSON.stringify({}),});const data = await response.json();curl --request POST \ --url 'https://app.langwatch.ai/api/v1/dataset/attachments/uploads' \ --header "X-Auth-Token: $LANGWATCH_API_KEY" \ --header 'Content-Type: application/json' \ --data '{}'Call the LangWatch API from this project: Create an upload for an image or file cell.Request: POST https://app.langwatch.ai/api/v1/dataset/attachments/uploadsReference: https://langwatch.ai/docs/api-reference/datasets/create-an-upload-for-an-image-or-file-cell.mdAuthentication: send the X-Auth-Token header, read from the LANGWATCH_API_KEY environment variable. Never hard-code the key.Body (application/json):```json{}```Use the HTTP client this project already uses, handle non-2xx responses, and show me the parsed result.Success
application/json · Generated from schema
{ "objectId": "string", "uploadUrl": "string", "method": "PUT", "headers": {}, "expiresAt": "string"}The file is larger than the organization's limit.
The media type is not accepted.
Too many uploads for this project in one minute.
Request body
application/json · Required
filenamestringrequiredThe file name the reference will carry.
mediaTypestringrequiredThe media type of the file.
byteLengthintegerrequiredThe size of the file, in bytes.
Responses
201Success
application/json
objectIdstringrequireduploadUrlstring (uri)requiredmethodstringrequired"PUT"headersobjectexpiresAtstringrequired