Skip to content
LakeSharkDocumentation
API REFERENCE / DOCUMENTATION

API recipes

Working request patterns for Question Keys, AnswerSets, ExecutionSets, and immutable settings.

Every customer API uses the public https://lakeshark.dev/api/<service>/v1 gateway. Use the service-specific path and a credential with the correct scope. Private origin hostnames are not public API entry points. Do not send organization or workspace headers in place of authentication.

1. Ask a question

Create a Question Key in Answers → AnswerSet → Try it out → Question API and store it securely as LAKESHARK_QUESTION_KEY.

curl --fail-with-body \
  -X POST 'https://lakeshark.dev/api/answers/v1/questions' \
  -H "Authorization: Bearer $LAKESHARK_QUESTION_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"question":"Where do I report a suspicious email?"}'

A representative Knowledge response:

{
  "answer": "Follow your company security reporting procedure.",
  "answer_type": "text",
  "source": "known",
  "input_tokens": 0,
  "output_tokens": 0
}

Fields shown above are illustrative, not a full response schema. Check the actual HTTP response for its run ID, latency and other evidence fields.

2. Create an HTTP ExecutionSet

Use a workspace-scoped management token with executions.write. This creates a reusable HTTP function and does not send network traffic:

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

Replace the example URL with an operator-approved public HTTPS endpoint you control. The function cannot execute until the destination is approved and protected egress is verified. For details, read the HTTP API contract and egress restrictions.

3. Connect an AnswerSet action

Use a management token with answers.write and executions.write. Replace REPLACE_WITH_EXECUTION_SET_UUID with the function ID returned by the previous request:

curl --fail-with-body \
  -X POST "https://lakeshark.dev/api/answers/v1/answer-sets/$ANSWER_SET_ID/execution-bindings" \
  -H "Authorization: Bearer $LAKESHARK_ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Notify service",
    "execution_set_id": "REPLACE_WITH_EXECUTION_SET_UUID",
    "input_mapping": {"message": {"$ref": "answer.text"}}
  }'

Saving a legacy connection does not invoke HTTP. An activated saved Flow can execute approved pinned actions on both incoming routes; otherwise Question Keys may execute approved legacy Automatic connections. Clients cannot select arbitrary actions or graph IDs in question payloads. Reuse a UUID for retries of the same logical request and inspect uncertain outcomes before a new request. See active Flow routing.

See the guided workflow or the action API reference. The older deterministic rule engine remains available only for previously deployed integrations: legacy migration.

4. Read a versioned configuration

ConfigStore publishes named typed configuration sets. To retrieve the active version:

curl --fail-with-body \
  'https://lakeshark.dev/api/config/v1/configs/customer-support' \
  -H "Authorization: Bearer $LAKESHARK_ACCESS_TOKEN"

To replay behavior tied to a historical configuration, request that exact immutable version instead of the active pointer.

Full ConfigStore request contracts

5. Run a specific Flow by ID

A Flow has a stable ID, a separately issued Flow Key, and an active published revision. Open Flows, select the Flow, and click API in the editor to see its ID, verified active revision and copyable command. The key can authorize only the Flow in this URL.

FLOW_ID="123e4567-e89b-42d3-a456-426614174000"
read -rsp 'Flow Key: ' LAKESHARK_FLOW_KEY; echo
RUN_ID="flow-run-$(python3 -c 'import uuid; print(uuid.uuid4().hex)')"

curl --fail-with-body --silent --show-error \
  -X POST "https://lakeshark.dev/api/flows/v1/flows/$FLOW_ID/runs" \
  -H "X-LakeShark-Flow-Key: $LAKESHARK_FLOW_KEY" \
  -H "Idempotency-Key: $RUN_ID" \
  -H 'Content-Type: application/json' \
  --data '{"inputs":{"question":"Describe this image"}}'

unset LAKESHARK_FLOW_KEY

Replace the example Flow ID with the one in your selected Flow’s API panel and adapt the inputs to its active published contract. Never put a Flow Key in a URL. Reuse the same idempotency key only when retrying the same logical run.

Run a Flow with the API

Diagnose failed requests

  • 401: Verify credentials, token expiry and the correct credential type.
  • 403: Check the required API scope and workspace authorization.
  • 422: Inspect JSON types and required fields.
  • 429: Review enforced quotas and Retry-After.
  • 5xx: Do not assume the provider or backend operation succeeded; inspect evidence and retry safely.

Error handling · Authentication · Troubleshooting