# Call an endpoint Your backend submits a run, then reads its status and output. ## Start the operation ```sh curl "$BROWSERLAYER_API_URL/runs" \ -H "Authorization: Bearer $BROWSERLAYER_API_KEY" \ -H "Idempotency-Key: $OPERATION_KEY" \ -H 'Content-Type: application/json' \ -d '{ "integration":"atlas-demo", "flow":"cancel-booking", "connection":"connection-id", "input":{"bookingId":""} }' ``` `flow` is the HTTP field for the public endpoint ID. Internal connector flows cannot be called through this endpoint. Persist `OPERATION_KEY` in your application database **before** sending the request. Reuse it for retries of that same user intention, including after a timeout or page refresh. ## Read the result ```sh curl "$BROWSERLAYER_API_URL/runs/$RUN_ID" \ -H "Authorization: Bearer $BROWSERLAYER_API_KEY" ``` | Status | What your app does | | ------------------- | --------------------------------------------------------------------- | | `queued`, `running` | Keep polling | | `awaiting_input` | [Open hosted Link for this run](/docs/connect#resume-an-existing-run) | | `completed` | Read `output` | | `failed` | Read `error`; do not blindly repeat a mutation | | `cancelled` | Show cancellation | ## TypeScript ```ts const response = await fetch(`${process.env.BROWSERLAYER_API_URL}/runs`, { method: "POST", headers: { Authorization: `Bearer ${process.env.BROWSERLAYER_API_KEY}`, "Content-Type": "application/json", "Idempotency-Key": operation.key, }, body: JSON.stringify({ integration: "atlas-demo", flow: "cancel-booking", connection: operation.connection, input: { bookingId: operation.booking }, }), }); if (!response.ok) throw new Error(`Admission failed: ${response.status}`); const { id: runId } = await response.json(); ``` Here `operation` is the persisted user operation in your backend. Authorize its connection against the signed-in user. Application keys are environment-scoped, not individual-user authorization.