Skip to main content

Lens API

This page documents the 11 gateway endpoints tagged Lens in the gateway's OpenAPI document. Every example targets a gateway on http://localhost:4000 and authenticates with the SPANWAY_API_KEY environment variable, which holds the master key or a virtual key that has access to the route. Request and response fields are taken from the schema the running gateway publishes at /openapi.json, and the same document is bundled with this site as openapi.json.

MethodPathSummary
GET/lens/serviceIs the Lens service connected
GET/lensForward a request to the Lens service
POST/lensForward a request to the Lens service
PUT/lensForward a request to the Lens service
PATCH/lensForward a request to the Lens service
DELETE/lensForward a request to the Lens service
GET/lens/{path}Forward a request to the Lens service
POST/lens/{path}Forward a request to the Lens service
PUT/lens/{path}Forward a request to the Lens service
PATCH/lens/{path}Forward a request to the Lens service
DELETE/lens/{path}Forward a request to the Lens service

Endpoints​

GET /lens/service​

Is the Lens service connected

Tell whether this gateway can reach the Lens service. configured is true once SPANWAY_LENS_URL is set, connected once Lens answered with the contract version the gateway speaks, and url is the public address the Admin UI opens. The Admin UI shows its setup panel while connected is false. Any signed in user or key may call it.

Docs (https://docs.spanway.ai/docs/proxy/lens/overview)

Example request:

curl -X GET "http://localhost:4000/lens/service" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200Whether the gateway reaches Lens and what Lens reports about itselfapplication/json ServiceConnection
401No valid key or Admin UI session was presentedapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
urlstringYesUrl
connectedbooleanYesConnected
statusServiceStatusYes
configuredbooleanNoConfigured
releasestringNoRelease

GET /lens​

Forward a request to the Lens service

Pass the request on to the Lens service under /lens/<path>, with a 30 second identity token for the caller in place of their gateway credential, so Lens applies its own team and role rules. The body and query string travel unchanged, only content-type, x-lens-contract and idempotency-key are forwarded from the request headers, and the paths under evals and datasets need a license with the evals feature. Every successful change (POST, PUT, PATCH or DELETE, except the read-only searches) writes an audit row naming the caller, the method and the Lens path, never the request body. The Lens API reference lists every path, its methods and what it does.

Docs (https://docs.spanway.ai/docs/proxy/lens/api)

Parameters:

NameInTypeRequiredDescription
pathquerystringNo

Example request:

curl -X GET "http://localhost:4000/lens" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200Whatever the Lens service answered, passed through with its status codeapplication/json object
307The path ended with a slash, follow Location to the same path without it
400The path climbs out of the Lens APIapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller has no user or key identity, or a datasets or evals path needs the evals licenseapplication/json ErrorDetail
409The request sent more than one x-lens-contract headerapplication/json ErrorDetail
413The request or Lens's answer is larger than 64 MiBapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
503Lens is not configured, its forwarding is busy (retry after Retry-After seconds), or it did not answerapplication/json ErrorDetail

POST /lens​

Forward a request to the Lens service

Pass the request on to the Lens service under /lens/<path>, with a 30 second identity token for the caller in place of their gateway credential, so Lens applies its own team and role rules. The body and query string travel unchanged, only content-type, x-lens-contract and idempotency-key are forwarded from the request headers, and the paths under evals and datasets need a license with the evals feature. Every successful change (POST, PUT, PATCH or DELETE, except the read-only searches) writes an audit row naming the caller, the method and the Lens path, never the request body. The Lens API reference lists every path, its methods and what it does.

Docs (https://docs.spanway.ai/docs/proxy/lens/api)

Parameters:

NameInTypeRequiredDescription
pathquerystringNo

Request body (application/json, object):

Example request:

curl -X POST "http://localhost:4000/lens" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "support-bot-regressions",
"trace_ids": [
"9f2c1a7e4b3d"
]
}'

Responses:

StatusDescriptionBody
200Whatever the Lens service answered, passed through with its status codeapplication/json object
307The path ended with a slash, follow Location to the same path without it
400The path climbs out of the Lens APIapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller has no user or key identity, or a datasets or evals path needs the evals licenseapplication/json ErrorDetail
409The request sent more than one x-lens-contract headerapplication/json ErrorDetail
413The request or Lens's answer is larger than 64 MiBapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
503Lens is not configured, its forwarding is busy (retry after Retry-After seconds), or it did not answerapplication/json ErrorDetail

PUT /lens​

Forward a request to the Lens service

Pass the request on to the Lens service under /lens/<path>, with a 30 second identity token for the caller in place of their gateway credential, so Lens applies its own team and role rules. The body and query string travel unchanged, only content-type, x-lens-contract and idempotency-key are forwarded from the request headers, and the paths under evals and datasets need a license with the evals feature. Every successful change (POST, PUT, PATCH or DELETE, except the read-only searches) writes an audit row naming the caller, the method and the Lens path, never the request body. The Lens API reference lists every path, its methods and what it does.

Docs (https://docs.spanway.ai/docs/proxy/lens/api)

Parameters:

NameInTypeRequiredDescription
pathquerystringNo

Request body (application/json, object):

Example request:

curl -X PUT "http://localhost:4000/lens" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "support-bot-regressions",
"trace_ids": [
"9f2c1a7e4b3d"
]
}'

Responses:

StatusDescriptionBody
200Whatever the Lens service answered, passed through with its status codeapplication/json object
307The path ended with a slash, follow Location to the same path without it
400The path climbs out of the Lens APIapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller has no user or key identity, or a datasets or evals path needs the evals licenseapplication/json ErrorDetail
409The request sent more than one x-lens-contract headerapplication/json ErrorDetail
413The request or Lens's answer is larger than 64 MiBapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
503Lens is not configured, its forwarding is busy (retry after Retry-After seconds), or it did not answerapplication/json ErrorDetail

PATCH /lens​

Forward a request to the Lens service

Pass the request on to the Lens service under /lens/<path>, with a 30 second identity token for the caller in place of their gateway credential, so Lens applies its own team and role rules. The body and query string travel unchanged, only content-type, x-lens-contract and idempotency-key are forwarded from the request headers, and the paths under evals and datasets need a license with the evals feature. Every successful change (POST, PUT, PATCH or DELETE, except the read-only searches) writes an audit row naming the caller, the method and the Lens path, never the request body. The Lens API reference lists every path, its methods and what it does.

Docs (https://docs.spanway.ai/docs/proxy/lens/api)

Parameters:

NameInTypeRequiredDescription
pathquerystringNo

Request body (application/json, object):

Example request:

curl -X PATCH "http://localhost:4000/lens" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "support-bot-regressions",
"trace_ids": [
"9f2c1a7e4b3d"
]
}'

Responses:

StatusDescriptionBody
200Whatever the Lens service answered, passed through with its status codeapplication/json object
307The path ended with a slash, follow Location to the same path without it
400The path climbs out of the Lens APIapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller has no user or key identity, or a datasets or evals path needs the evals licenseapplication/json ErrorDetail
409The request sent more than one x-lens-contract headerapplication/json ErrorDetail
413The request or Lens's answer is larger than 64 MiBapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
503Lens is not configured, its forwarding is busy (retry after Retry-After seconds), or it did not answerapplication/json ErrorDetail

DELETE /lens​

Forward a request to the Lens service

Pass the request on to the Lens service under /lens/<path>, with a 30 second identity token for the caller in place of their gateway credential, so Lens applies its own team and role rules. The body and query string travel unchanged, only content-type, x-lens-contract and idempotency-key are forwarded from the request headers, and the paths under evals and datasets need a license with the evals feature. Every successful change (POST, PUT, PATCH or DELETE, except the read-only searches) writes an audit row naming the caller, the method and the Lens path, never the request body. The Lens API reference lists every path, its methods and what it does.

Docs (https://docs.spanway.ai/docs/proxy/lens/api)

Parameters:

NameInTypeRequiredDescription
pathquerystringNo

Example request:

curl -X DELETE "http://localhost:4000/lens" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200Whatever the Lens service answered, passed through with its status codeapplication/json object
307The path ended with a slash, follow Location to the same path without it
400The path climbs out of the Lens APIapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller has no user or key identity, or a datasets or evals path needs the evals licenseapplication/json ErrorDetail
409The request sent more than one x-lens-contract headerapplication/json ErrorDetail
413The request or Lens's answer is larger than 64 MiBapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
503Lens is not configured, its forwarding is busy (retry after Retry-After seconds), or it did not answerapplication/json ErrorDetail

GET /lens/{path}​

Forward a request to the Lens service

Pass the request on to the Lens service under /lens/<path>, with a 30 second identity token for the caller in place of their gateway credential, so Lens applies its own team and role rules. The body and query string travel unchanged, only content-type, x-lens-contract and idempotency-key are forwarded from the request headers, and the paths under evals and datasets need a license with the evals feature. Every successful change (POST, PUT, PATCH or DELETE, except the read-only searches) writes an audit row naming the caller, the method and the Lens path, never the request body. The Lens API reference lists every path, its methods and what it does.

Docs (https://docs.spanway.ai/docs/proxy/lens/api)

Parameters:

NameInTypeRequiredDescription
pathpathstringYes

Example request:

curl -X GET "http://localhost:4000/lens/path-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200Whatever the Lens service answered, passed through with its status codeapplication/json object
307The path ended with a slash, follow Location to the same path without it
400The path climbs out of the Lens APIapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller has no user or key identity, or a datasets or evals path needs the evals licenseapplication/json ErrorDetail
409The request sent more than one x-lens-contract headerapplication/json ErrorDetail
413The request or Lens's answer is larger than 64 MiBapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
503Lens is not configured, its forwarding is busy (retry after Retry-After seconds), or it did not answerapplication/json ErrorDetail

POST /lens/{path}​

Forward a request to the Lens service

Pass the request on to the Lens service under /lens/<path>, with a 30 second identity token for the caller in place of their gateway credential, so Lens applies its own team and role rules. The body and query string travel unchanged, only content-type, x-lens-contract and idempotency-key are forwarded from the request headers, and the paths under evals and datasets need a license with the evals feature. Every successful change (POST, PUT, PATCH or DELETE, except the read-only searches) writes an audit row naming the caller, the method and the Lens path, never the request body. The Lens API reference lists every path, its methods and what it does.

Docs (https://docs.spanway.ai/docs/proxy/lens/api)

Parameters:

NameInTypeRequiredDescription
pathpathstringYes

Request body (application/json, object):

Example request:

curl -X POST "http://localhost:4000/lens/path-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "support-bot-regressions",
"trace_ids": [
"9f2c1a7e4b3d"
]
}'

Responses:

StatusDescriptionBody
200Whatever the Lens service answered, passed through with its status codeapplication/json object
307The path ended with a slash, follow Location to the same path without it
400The path climbs out of the Lens APIapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller has no user or key identity, or a datasets or evals path needs the evals licenseapplication/json ErrorDetail
409The request sent more than one x-lens-contract headerapplication/json ErrorDetail
413The request or Lens's answer is larger than 64 MiBapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
503Lens is not configured, its forwarding is busy (retry after Retry-After seconds), or it did not answerapplication/json ErrorDetail

PUT /lens/{path}​

Forward a request to the Lens service

Pass the request on to the Lens service under /lens/<path>, with a 30 second identity token for the caller in place of their gateway credential, so Lens applies its own team and role rules. The body and query string travel unchanged, only content-type, x-lens-contract and idempotency-key are forwarded from the request headers, and the paths under evals and datasets need a license with the evals feature. Every successful change (POST, PUT, PATCH or DELETE, except the read-only searches) writes an audit row naming the caller, the method and the Lens path, never the request body. The Lens API reference lists every path, its methods and what it does.

Docs (https://docs.spanway.ai/docs/proxy/lens/api)

Parameters:

NameInTypeRequiredDescription
pathpathstringYes

Request body (application/json, object):

Example request:

curl -X PUT "http://localhost:4000/lens/path-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "support-bot-regressions",
"trace_ids": [
"9f2c1a7e4b3d"
]
}'

Responses:

StatusDescriptionBody
200Whatever the Lens service answered, passed through with its status codeapplication/json object
307The path ended with a slash, follow Location to the same path without it
400The path climbs out of the Lens APIapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller has no user or key identity, or a datasets or evals path needs the evals licenseapplication/json ErrorDetail
409The request sent more than one x-lens-contract headerapplication/json ErrorDetail
413The request or Lens's answer is larger than 64 MiBapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
503Lens is not configured, its forwarding is busy (retry after Retry-After seconds), or it did not answerapplication/json ErrorDetail

PATCH /lens/{path}​

Forward a request to the Lens service

Pass the request on to the Lens service under /lens/<path>, with a 30 second identity token for the caller in place of their gateway credential, so Lens applies its own team and role rules. The body and query string travel unchanged, only content-type, x-lens-contract and idempotency-key are forwarded from the request headers, and the paths under evals and datasets need a license with the evals feature. Every successful change (POST, PUT, PATCH or DELETE, except the read-only searches) writes an audit row naming the caller, the method and the Lens path, never the request body. The Lens API reference lists every path, its methods and what it does.

Docs (https://docs.spanway.ai/docs/proxy/lens/api)

Parameters:

NameInTypeRequiredDescription
pathpathstringYes

Request body (application/json, object):

Example request:

curl -X PATCH "http://localhost:4000/lens/path-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "support-bot-regressions",
"trace_ids": [
"9f2c1a7e4b3d"
]
}'

Responses:

StatusDescriptionBody
200Whatever the Lens service answered, passed through with its status codeapplication/json object
307The path ended with a slash, follow Location to the same path without it
400The path climbs out of the Lens APIapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller has no user or key identity, or a datasets or evals path needs the evals licenseapplication/json ErrorDetail
409The request sent more than one x-lens-contract headerapplication/json ErrorDetail
413The request or Lens's answer is larger than 64 MiBapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
503Lens is not configured, its forwarding is busy (retry after Retry-After seconds), or it did not answerapplication/json ErrorDetail

DELETE /lens/{path}​

Forward a request to the Lens service

Pass the request on to the Lens service under /lens/<path>, with a 30 second identity token for the caller in place of their gateway credential, so Lens applies its own team and role rules. The body and query string travel unchanged, only content-type, x-lens-contract and idempotency-key are forwarded from the request headers, and the paths under evals and datasets need a license with the evals feature. Every successful change (POST, PUT, PATCH or DELETE, except the read-only searches) writes an audit row naming the caller, the method and the Lens path, never the request body. The Lens API reference lists every path, its methods and what it does.

Docs (https://docs.spanway.ai/docs/proxy/lens/api)

Parameters:

NameInTypeRequiredDescription
pathpathstringYes

Example request:

curl -X DELETE "http://localhost:4000/lens/path-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200Whatever the Lens service answered, passed through with its status codeapplication/json object
307The path ended with a slash, follow Location to the same path without it
400The path climbs out of the Lens APIapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The caller has no user or key identity, or a datasets or evals path needs the evals licenseapplication/json ErrorDetail
409The request sent more than one x-lens-contract headerapplication/json ErrorDetail
413The request or Lens's answer is larger than 64 MiBapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
503Lens is not configured, its forwarding is busy (retry after Retry-After seconds), or it did not answerapplication/json ErrorDetail