Skip to content

Invoke a named lens

POST
/api/v1/lenses/{lensId}/invoke
curl --request POST \
--url 'http://localhost:11044/api/v1/lenses/example/invoke?background=false' \
--header 'Content-Type: application/json' \
--header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>' \
--data '{ "args": { "additionalProperty": "example" }, "idempotencyKey": "example" }'

Run an authored lens by id and return a redacted, typed result envelope. background=true returns a RUNNING envelope immediately; waitSeconds=N waits that long then hands back the RUNNING envelope instead of blocking. For those deferred modes the envelope’s executionId is a run handle: poll GET /lenses/runs/{runId} with it. A synchronous invocation returns the final result directly; its executionId is not pollable.

lensId
required
string

The authored lens id

background
boolean

Run on a worker and return a RUNNING envelope immediately

waitSeconds
integer format: int64

Wait up to this many seconds for the run to settle, then return the envelope as it stands rather than blocking

The lens’s arguments under args, keyed by its declared parameter names; an argument left out takes the parameter’s default, and a required parameter left with no value is refused with 400. Omitting the body, or args, runs the lens on its defaults. Any top-level field other than args and idempotencyKey is refused with 400 rather than ignored; idempotencyKey is accepted but does not deduplicate invocations here

Media typeapplication/json

The body of POST /lenses/{lensId}/invoke and POST /views/{name}/invoke: arguments and an optional idempotency key. Any other top-level field is refused with 400.

object
args
required

Arguments by the lens’s or view’s declared parameter name. A name it does not declare, or a required parameter left out, is refused with 400; an optional one left out takes its declared default

object
key
additional properties
idempotencyKey

Accepted but not yet acted on: a repeated call with the same key runs again

string

Example generated

{
"args": {
"additionalProperty": "example"
},
"idempotencyKey": "example"
}

Arguments do not match the lens’s declared parameters, or the body has a field other than args/idempotencyKey; a body that will not parse answers an ApiError

One of:

A request-level refusal from the headless surface. Carries only the reason; an execution that ran and failed answers 200 with the outcome in its envelope instead

object
error
required

Why the request was refused, written to be shown: the unknown lens, view or run, the argument at fault, or the field the body should not have

string

Example generated

{
"error": "example"
}

Not authenticated. The filter chain answers an ApiError; a principal that resolves to no user answers the refusal

One of:

A request-level refusal from the headless surface. Carries only the reason; an execution that ran and failed answers 200 with the outcome in its envelope instead

object
error
required

Why the request was refused, written to be shown: the unknown lens, view or run, the argument at fault, or the field the body should not have

string

Example generated

{
"error": "example"
}

No such lens

Media typeapplication/json

A request-level refusal from the headless surface. Carries only the reason; an execution that ran and failed answers 200 with the outcome in its envelope instead

object
error
required

Why the request was refused, written to be shown: the unknown lens, view or run, the argument at fault, or the field the body should not have

string

Example generated

{
"error": "example"
}