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.
| Method | Path | Summary |
|---|---|---|
| GET | /lens/service | Is the Lens service connected |
| GET | /lens | Forward a request to the Lens service |
| POST | /lens | Forward a request to the Lens service |
| PUT | /lens | Forward a request to the Lens service |
| PATCH | /lens | Forward a request to the Lens service |
| DELETE | /lens | Forward 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:
| Status | Description | Body |
|---|---|---|
| 200 | Whether the gateway reaches Lens and what Lens reports about itself | application/json ServiceConnection |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Url |
connected | boolean | Yes | Connected |
status | ServiceStatus | Yes | |
configured | boolean | No | Configured |
release | string | No | Release |
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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
path | query | string | No |
Example request:
curl -X GET "http://localhost:4000/lens" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Whatever the Lens service answered, passed through with its status code | application/json object |
| 307 | The path ended with a slash, follow Location to the same path without it | |
| 400 | The path climbs out of the Lens API | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller has no user or key identity, or a datasets or evals path needs the evals license | application/json ErrorDetail |
| 409 | The request sent more than one x-lens-contract header | application/json ErrorDetail |
| 413 | The request or Lens's answer is larger than 64 MiB | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 503 | Lens is not configured, its forwarding is busy (retry after Retry-After seconds), or it did not answer | application/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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
path | query | string | No |
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:
| Status | Description | Body |
|---|---|---|
| 200 | Whatever the Lens service answered, passed through with its status code | application/json object |
| 307 | The path ended with a slash, follow Location to the same path without it | |
| 400 | The path climbs out of the Lens API | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller has no user or key identity, or a datasets or evals path needs the evals license | application/json ErrorDetail |
| 409 | The request sent more than one x-lens-contract header | application/json ErrorDetail |
| 413 | The request or Lens's answer is larger than 64 MiB | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 503 | Lens is not configured, its forwarding is busy (retry after Retry-After seconds), or it did not answer | application/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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
path | query | string | No |
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:
| Status | Description | Body |
|---|---|---|
| 200 | Whatever the Lens service answered, passed through with its status code | application/json object |
| 307 | The path ended with a slash, follow Location to the same path without it | |
| 400 | The path climbs out of the Lens API | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller has no user or key identity, or a datasets or evals path needs the evals license | application/json ErrorDetail |
| 409 | The request sent more than one x-lens-contract header | application/json ErrorDetail |
| 413 | The request or Lens's answer is larger than 64 MiB | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 503 | Lens is not configured, its forwarding is busy (retry after Retry-After seconds), or it did not answer | application/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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
path | query | string | No |
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:
| Status | Description | Body |
|---|---|---|
| 200 | Whatever the Lens service answered, passed through with its status code | application/json object |
| 307 | The path ended with a slash, follow Location to the same path without it | |
| 400 | The path climbs out of the Lens API | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller has no user or key identity, or a datasets or evals path needs the evals license | application/json ErrorDetail |
| 409 | The request sent more than one x-lens-contract header | application/json ErrorDetail |
| 413 | The request or Lens's answer is larger than 64 MiB | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 503 | Lens is not configured, its forwarding is busy (retry after Retry-After seconds), or it did not answer | application/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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
path | query | string | No |
Example request:
curl -X DELETE "http://localhost:4000/lens" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Whatever the Lens service answered, passed through with its status code | application/json object |
| 307 | The path ended with a slash, follow Location to the same path without it | |
| 400 | The path climbs out of the Lens API | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller has no user or key identity, or a datasets or evals path needs the evals license | application/json ErrorDetail |
| 409 | The request sent more than one x-lens-contract header | application/json ErrorDetail |
| 413 | The request or Lens's answer is larger than 64 MiB | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 503 | Lens is not configured, its forwarding is busy (retry after Retry-After seconds), or it did not answer | application/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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
path | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/lens/path-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Whatever the Lens service answered, passed through with its status code | application/json object |
| 307 | The path ended with a slash, follow Location to the same path without it | |
| 400 | The path climbs out of the Lens API | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller has no user or key identity, or a datasets or evals path needs the evals license | application/json ErrorDetail |
| 409 | The request sent more than one x-lens-contract header | application/json ErrorDetail |
| 413 | The request or Lens's answer is larger than 64 MiB | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 503 | Lens is not configured, its forwarding is busy (retry after Retry-After seconds), or it did not answer | application/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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
path | path | string | Yes |
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:
| Status | Description | Body |
|---|---|---|
| 200 | Whatever the Lens service answered, passed through with its status code | application/json object |
| 307 | The path ended with a slash, follow Location to the same path without it | |
| 400 | The path climbs out of the Lens API | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller has no user or key identity, or a datasets or evals path needs the evals license | application/json ErrorDetail |
| 409 | The request sent more than one x-lens-contract header | application/json ErrorDetail |
| 413 | The request or Lens's answer is larger than 64 MiB | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 503 | Lens is not configured, its forwarding is busy (retry after Retry-After seconds), or it did not answer | application/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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
path | path | string | Yes |
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:
| Status | Description | Body |
|---|---|---|
| 200 | Whatever the Lens service answered, passed through with its status code | application/json object |
| 307 | The path ended with a slash, follow Location to the same path without it | |
| 400 | The path climbs out of the Lens API | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller has no user or key identity, or a datasets or evals path needs the evals license | application/json ErrorDetail |
| 409 | The request sent more than one x-lens-contract header | application/json ErrorDetail |
| 413 | The request or Lens's answer is larger than 64 MiB | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 503 | Lens is not configured, its forwarding is busy (retry after Retry-After seconds), or it did not answer | application/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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
path | path | string | Yes |
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:
| Status | Description | Body |
|---|---|---|
| 200 | Whatever the Lens service answered, passed through with its status code | application/json object |
| 307 | The path ended with a slash, follow Location to the same path without it | |
| 400 | The path climbs out of the Lens API | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller has no user or key identity, or a datasets or evals path needs the evals license | application/json ErrorDetail |
| 409 | The request sent more than one x-lens-contract header | application/json ErrorDetail |
| 413 | The request or Lens's answer is larger than 64 MiB | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 503 | Lens is not configured, its forwarding is busy (retry after Retry-After seconds), or it did not answer | application/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:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
path | path | string | Yes |
Example request:
curl -X DELETE "http://localhost:4000/lens/path-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Whatever the Lens service answered, passed through with its status code | application/json object |
| 307 | The path ended with a slash, follow Location to the same path without it | |
| 400 | The path climbs out of the Lens API | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller has no user or key identity, or a datasets or evals path needs the evals license | application/json ErrorDetail |
| 409 | The request sent more than one x-lens-contract header | application/json ErrorDetail |
| 413 | The request or Lens's answer is larger than 64 MiB | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 503 | Lens is not configured, its forwarding is busy (retry after Retry-After seconds), or it did not answer | application/json ErrorDetail |