Create a widget on a dashboard
import requests
url = "https://app.langwatch.ai/api/v1/dashboards/{dashboardId}/widgets"
payload = {
"name": "<string>",
"code": "<string>",
"queries": [
{
"name": "<string>",
"sql": "<string>",
"parameters": [
{
"name": "<string>",
"default": "<string>"
}
]
}
]
}
headers = {
"X-Auth-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Auth-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
code: '<string>',
queries: [
{
name: '<string>',
sql: '<string>',
parameters: [{name: '<string>', default: '<string>'}]
}
]
})
};
fetch('https://app.langwatch.ai/api/v1/dashboards/{dashboardId}/widgets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/v1/dashboards/{dashboardId}/widgets \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '
{
"name": "<string>",
"code": "<string>",
"queries": [
{
"name": "<string>",
"sql": "<string>",
"parameters": [
{
"name": "<string>",
"default": "<string>"
}
]
}
]
}
'{
"id": "<string>",
"name": "<string>",
"definition": {
"version": 123,
"code": "<string>",
"queries": [
{
"name": "<string>",
"sql": "<string>",
"parameters": [
{
"name": "<string>",
"type": "string",
"default": "<string>"
}
]
}
],
"description": "<string>",
"prompt": "<string>",
"source": {
"kind": "catalogue",
"catalogueId": "<string>"
}
},
"createdAt": "<string>",
"updatedAt": "<string>",
"platformUrl": "<string>",
"dashboardId": "<string>",
"gridColumn": 0,
"gridRow": 0,
"colSpan": 0,
"rowSpan": 0
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"meta": {},
"trace_id": "<string>",
"span_id": "<string>",
"trace": {
"traceId": "<string>",
"spanId": "<string>",
"traceUrl": "<string>",
"logsUrl": "<string>"
},
"tips": [
"<string>"
],
"docs_url": "<string>",
"fault": "customer",
"reasons": [
"<unknown>"
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"meta": {},
"trace_id": "<string>",
"span_id": "<string>",
"trace": {
"traceId": "<string>",
"spanId": "<string>",
"traceUrl": "<string>",
"logsUrl": "<string>"
},
"tips": [
"<string>"
],
"docs_url": "<string>",
"fault": "customer",
"reasons": [
"<unknown>"
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"meta": {},
"trace_id": "<string>",
"span_id": "<string>",
"trace": {
"traceId": "<string>",
"spanId": "<string>",
"traceUrl": "<string>",
"logsUrl": "<string>"
},
"tips": [
"<string>"
],
"docs_url": "<string>",
"fault": "customer",
"reasons": [
"<unknown>"
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"meta": {},
"trace_id": "<string>",
"span_id": "<string>",
"trace": {
"traceId": "<string>",
"spanId": "<string>",
"traceUrl": "<string>",
"logsUrl": "<string>"
},
"tips": [
"<string>"
],
"docs_url": "<string>",
"fault": "customer",
"reasons": [
"<unknown>"
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"meta": {},
"trace_id": "<string>",
"span_id": "<string>",
"trace": {
"traceId": "<string>",
"spanId": "<string>",
"traceUrl": "<string>",
"logsUrl": "<string>"
},
"tips": [
"<string>"
],
"docs_url": "<string>",
"fault": "customer",
"reasons": [
"<unknown>"
]
}Dashboards
Create a widget on a dashboard
Saves a React source file and the named LangWatchQL queries it runs as one widget, placed on this dashboard at the next free row. source records where the widget came from; without it, the widget is recorded as made through the API.
POST
/
api
/
v1
/
dashboards
/
{dashboardId}
/
widgets
Create a widget on a dashboard
import requests
url = "https://app.langwatch.ai/api/v1/dashboards/{dashboardId}/widgets"
payload = {
"name": "<string>",
"code": "<string>",
"queries": [
{
"name": "<string>",
"sql": "<string>",
"parameters": [
{
"name": "<string>",
"default": "<string>"
}
]
}
]
}
headers = {
"X-Auth-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Auth-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
code: '<string>',
queries: [
{
name: '<string>',
sql: '<string>',
parameters: [{name: '<string>', default: '<string>'}]
}
]
})
};
fetch('https://app.langwatch.ai/api/v1/dashboards/{dashboardId}/widgets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/v1/dashboards/{dashboardId}/widgets \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '
{
"name": "<string>",
"code": "<string>",
"queries": [
{
"name": "<string>",
"sql": "<string>",
"parameters": [
{
"name": "<string>",
"default": "<string>"
}
]
}
]
}
'{
"id": "<string>",
"name": "<string>",
"definition": {
"version": 123,
"code": "<string>",
"queries": [
{
"name": "<string>",
"sql": "<string>",
"parameters": [
{
"name": "<string>",
"type": "string",
"default": "<string>"
}
]
}
],
"description": "<string>",
"prompt": "<string>",
"source": {
"kind": "catalogue",
"catalogueId": "<string>"
}
},
"createdAt": "<string>",
"updatedAt": "<string>",
"platformUrl": "<string>",
"dashboardId": "<string>",
"gridColumn": 0,
"gridRow": 0,
"colSpan": 0,
"rowSpan": 0
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"meta": {},
"trace_id": "<string>",
"span_id": "<string>",
"trace": {
"traceId": "<string>",
"spanId": "<string>",
"traceUrl": "<string>",
"logsUrl": "<string>"
},
"tips": [
"<string>"
],
"docs_url": "<string>",
"fault": "customer",
"reasons": [
"<unknown>"
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"meta": {},
"trace_id": "<string>",
"span_id": "<string>",
"trace": {
"traceId": "<string>",
"spanId": "<string>",
"traceUrl": "<string>",
"logsUrl": "<string>"
},
"tips": [
"<string>"
],
"docs_url": "<string>",
"fault": "customer",
"reasons": [
"<unknown>"
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"meta": {},
"trace_id": "<string>",
"span_id": "<string>",
"trace": {
"traceId": "<string>",
"spanId": "<string>",
"traceUrl": "<string>",
"logsUrl": "<string>"
},
"tips": [
"<string>"
],
"docs_url": "<string>",
"fault": "customer",
"reasons": [
"<unknown>"
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"meta": {},
"trace_id": "<string>",
"span_id": "<string>",
"trace": {
"traceId": "<string>",
"spanId": "<string>",
"traceUrl": "<string>",
"logsUrl": "<string>"
},
"tips": [
"<string>"
],
"docs_url": "<string>",
"fault": "customer",
"reasons": [
"<unknown>"
]
}{
"type": "<string>",
"code": "<string>",
"message": "<string>",
"retryable": true,
"meta": {},
"trace_id": "<string>",
"span_id": "<string>",
"trace": {
"traceId": "<string>",
"spanId": "<string>",
"traceUrl": "<string>",
"logsUrl": "<string>"
},
"tips": [
"<string>"
],
"docs_url": "<string>",
"fault": "customer",
"reasons": [
"<unknown>"
]
}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.
Path Parameters
Minimum string length:
1Body
application/json
Required string length:
1 - 200Required string length:
1 - 200000Maximum array length:
8Show child attributes
Show child attributes
Required string length:
1 - 2000Required string length:
1 - 2000- Option 1
- Option 2
- Option 3
- Option 4
Show child attributes
Show child attributes
Response
The widget was saved on the dashboard
Show child attributes
Show child attributes
Required range:
-9007199254740991 <= x <= 9007199254740991Required range:
-9007199254740991 <= x <= 9007199254740991Required range:
-9007199254740991 <= x <= 9007199254740991Required range:
-9007199254740991 <= x <= 9007199254740991Last modified on October 27, 2026
Was this page helpful?