Python
import requests
url = "https://app.langwatch.ai/api/dataset/attachments"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {"X-Auth-Token": "<api-key>"}
response = requests.post(url, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {'X-Auth-Token': '<api-key>'}};
options.body = form;
fetch('https://app.langwatch.ai/api/dataset/attachments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/dataset/attachments \
--header 'Content-Type: multipart/form-data' \
--header 'X-Auth-Token: <api-key>' \
--form file='@example-file'{
"url": "<string>",
"name": "<string>",
"mediaType": "<string>",
"sizeBytes": 123
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}Datasets
Create Attachments
Upload a file for an image or file column and get the reference a cell holds. The project is named by the projectId query parameter; the file goes in the file multipart field, with an optional datasetId field.
POST
/
api
/
dataset
/
attachments
Python
import requests
url = "https://app.langwatch.ai/api/dataset/attachments"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {"X-Auth-Token": "<api-key>"}
response = requests.post(url, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {'X-Auth-Token': '<api-key>'}};
options.body = form;
fetch('https://app.langwatch.ai/api/dataset/attachments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/dataset/attachments \
--header 'Content-Type: multipart/form-data' \
--header 'X-Auth-Token: <api-key>' \
--form file='@example-file'{
"url": "<string>",
"name": "<string>",
"mediaType": "<string>",
"sizeBytes": 123
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}Authorizations
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.
Query Parameters
The project the file is stored for.
Body
multipart/form-data
Response
The reference the cell holds, and the file's metadata.
Last modified on September 22, 2026
Was this page helpful?