Why Executions Are Asynchronous
Some Lamina apps complete in seconds. Others, especially multi-step image/video pipelines, may take much longer. Because of that,POST /api/apps/{appId}/executions starts work and returns an execution handle immediately instead of blocking until the final output is ready.
Two Ways To Get Results
Option 1: Webhook (Recommended)
Pass a webhook URL as a query parameter. When the execution completes, we POST the results to your URL.- No polling loop needed
- Results arrive as soon as they’re ready
- Signed with ED25519 for security
- Automatic retries (3 attempts with backoff)
Option 2: Polling
PollGET /api/executions/{executionId} on an interval until status is completed or failed.
Use different polling intervals depending on the workflow:
- Short image jobs: every 3-5 seconds
- Heavier multi-step jobs: every 5-10 seconds
- Long-running video jobs: every 10-15 seconds
Recommended Flow
Start the execution
Call
POST /api/apps/{appId}/executions?webhook=<your_url> and store the returned executionId.Persist the execution ID
Save it in your job table, queue, or request state so you can resume later.
What To Store
For every execution you start, store at least:executionIdappId- input payload
- current status
- started timestamp
Failure Handling
If an execution fails:- inspect the top-level
errorMessage - inspect each output’s
error - keep the original inputs for debugging or replay
Webhook Verification
When receiving webhook callbacks, verify the signature to ensure it’s from Lamina:- Fetch the public key from
GET /api/webhooks/signing-key - Verify the ED25519 signature:
verify(signature, "<timestamp>.<body>", publicKey) - Reject timestamps older than 5 minutes (replay protection)