Skip to content
LakeSharkDocumentation
EXECUTIONSETS / DOCUMENTATION

HTTP ExecutionSets API

Create, invoke, connect, deactivate, and remove HTTP ExecutionSets with typed contracts.

Use the Answers public API base URL, even though the console navigation is named Executions:

https://lakeshark.dev/api/answers

The current HTTP-function endpoints have the prefix /v1/execution-functions. This is distinct from the older /v1/execution-sets deterministic-rule API. Do not substitute one route for the other.

Use an authenticated, workspace-scoped access token with the required scopes for management and explicit invocation. A Question Key cannot manage actions or select an arbitrary invocation target; its ordinary question request may run only the bound AnswerSet’s already-approved Automatic connections.

HTTP function operations

Operation Method Relative path Scope
List functions GET /v1/execution-functions executions.read
Create a function POST /v1/execution-functions executions.write
Read a function GET /v1/execution-functions/{id} executions.read
Invoke a function POST /v1/execution-functions/{id}/invoke executions.evaluate
Deactivate a function DELETE /v1/execution-functions/{id} executions.write
Remove a function DELETE /v1/execution-functions/{id}/remove executions.write

Create

curl --fail-with-body \
  'https://lakeshark.dev/api/answers/v1/execution-functions' \
  -H "Authorization: Bearer $LAKESHARK_ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "notify_color",
    "method": "POST",
    "url": "https://api.example.org/notify",
    "timeout_seconds": 5,
    "input_schema": {
      "type": "object",
      "properties": {"color": {"type": "string"}},
      "required": ["color"],
      "additionalProperties": false
    },
    "output_schema": {
      "type": "object",
      "properties": {"accepted": {"type": "boolean"}},
      "required": ["accepted"],
      "additionalProperties": false
    }
  }'

Replace api.example.org with an endpoint you control and have approved. The request creates configuration, not an outbound HTTP call. Input and output schemas must describe JSON objects.

Invoke

curl --fail-with-body \
  -X POST "https://lakeshark.dev/api/answers/v1/execution-functions/$EXECUTION_SET_ID/invoke" \
  -H "Authorization: Bearer $LAKESHARK_ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"inputs":{"color":"green"}}'

Example success:

{
  "run_id": "00000000-0000-0000-0000-000000000010",
  "output": {"accepted": true},
  "latency_ms": 150
}

A successful response requires an authorized action, a reachable public destination permitted by the configured host policy, verified egress, a valid outbound HTTP result and matching output schema. The checked-in beta deployment uses a wildcard hostname policy rather than individual host approval; see HTTP execution security. The example run ID and latency are illustrative.

Query strings, URL paths and JSON bodies

You can configure a fixed query parameter or use a full typed reference, such as ${inputs.username}, as its value. URL path substitutions are limited to complete supported segments. Dynamic hostnames are not permitted.

For POST, you can also configure body_template with fixed JSON and typed $ref values:

{
  "body_template": {
    "event": "color_selected",
    "color": {"$ref": "inputs.color"},
    "source": "LakeShark"
  }
}

This is a fragment of a creation payload, not a complete request. If body_template is absent or null, the default POST body behavior applies. See request builder details.

AnswerSet action operations

Operation Method Relative path Scope
List connected actions GET /v1/answer-sets/{id}/execution-bindings answers.read, executions.read
Connect an action POST /v1/answer-sets/{id}/execution-bindings answers.write, executions.write (plus executions.evaluate for Automatic)
Change mode or reapprove Automatic PATCH /v1/answer-sets/{id}/execution-bindings/{binding_id} answers.write, executions.write (plus executions.evaluate for Automatic)
Disconnect DELETE /v1/answer-sets/{id}/execution-bindings/{binding_id} answers.write, executions.write
List recent action evidence GET /v1/answer-sets/{id}/execution-runs answers.read, executions.read
Resolve an answer and explicitly execute POST /v1/answer-sets/{id}/execution-bindings/{binding_id}/run answers.write, executions.evaluate
Run approved Automatic connections POST /v1/answer-sets/{id}/ask-and-execute answers.write, executions.evaluate
Question Key automatic workflow POST /v1/questions Question Key bound to that AnswerSet

Create a connection using this shape:

{
  "name": "Notify service",
  "execution_set_id": "00000000-0000-0000-0000-000000000001",
  "input_mapping": {"color": {"$ref": "answer.value"}},
  "trigger_mode": "manual"
}

Then explicitly run it:

{
  "question": "What color is grass?",
  "context": {},
  "idempotency_key": "00000000-0000-0000-0000-000000000002"
}

The explicit action endpoint re-resolves the question under current AnswerSet policy, validates the mapping, and may send a real request. Repeat use of a reserved idempotency key returns 409, not a retry. The source of an answer does not establish identity or authorization for caller-provided context.

Automatic execution contract

Connections default to "trigger_mode": "manual". To approve automatic execution, create or PATCH a binding with "trigger_mode": "automatic" using a user/service-account token authorized for answers.write, executions.write, and executions.evaluate. At most eight active Automatic bindings may be attached to an AnswerSet. Approval records the current ExecutionSet definition fingerprint; changes to the definition require explicit reapproval with PATCH /v1/answer-sets/{id}/execution-bindings/{binding_id} and {"trigger_mode":"automatic"} before automatic delivery resumes.

POST /v1/answer-sets/{id}/ask-and-execute resolves one governed answer and invokes only that AnswerSet’s active Automatic connections. The request requires a UUID idempotency_key and the scopes answers.write and executions.evaluate. The ordinary Question Key endpoint, POST /v1/questions, uses the saved active Flow when configured, suppressing legacy Automatic connections. Try It Out uses the same active Flow and can perform its approved external actions. With no active Flow, Question Keys dispatch approved legacy Automatic bindings and console previews do not. Callers cannot select a different AnswerSet, graph, binding or destination. See active Flow routing.

For POST /v1/questions, send a UUID in the Idempotency-Key header or idempotency_key body field and reuse it when retrying the same logical request. When omitted, the server creates a new key, so an independent retry can submit another action. A reused reserved key returns 409 rather than replaying a side effect. Inspect unconfirmed outcomes and audit evidence before any new attempt. Verify the live backend rollout before enabling external side effects; this describes the checked-in source contract, not an independently confirmed production deployment.

Failure handling

Status Typical condition
401 Invalid or absent access token
403 Missing scopes, wrong actor type, or workspace denial
404 Resource not visible in the selected workspace
409 Duplicate idempotency key, incompatible state, or destination not approved
422 Invalid URL, mapping or input/output contract
502 External HTTPS, DNS, response or dependency failure

Never automatically retry a side-effecting action after a timeout. Check destination-side evidence. For detailed egress requirements, see HTTP execution security and API errors.