# ForLoop Scheduler integration guide Schedule signed outbound webhook deliveries for a ForLoop app, then inspect every attempt, signature, and charge. - Base URL: `https://scheduler.app.forloop.cc` - Console: `https://scheduler.app.forloop.cc/console` - Contract version: `2.7.0` - Supported versions: `2.7.0` - Machine-readable guide: `https://scheduler.app.forloop.cc/llms.txt` ## Quickstart Create an app-subject connection to this service, then exchange the app credential for an assertion. ```bash curl -X POST https://scheduler.app.forloop.cc/api/opencode/a2a/connections//assertion \ -H "x-api-token: $FLC_APP_CREDENTIAL" \ -H "content-type: application/json" \ -d '{"scopes":["scheduler.schedules:write"],"contractVersion":"2.7.0"}' ``` The assertion is valid for **300 seconds**. Send it as `Authorization: Bearer ` on every `/v1` call. 1. Create an app-subject connection with scheduler.schedules:read and scheduler.schedules:write. 2. Exchange FLC_APP_CREDENTIAL for a 300-second assertion with the pinned contract version. 3. Register an HTTPS endpoint, then verify it with the published challenge. 4. Create a schedule and poll the delivery until a terminal status; inspect billing and signature headers. ## Authentication and tenancy The service trusts only a verified app assertion. It checks `iss`, `aud`, `sub=app:`, `appPublicId`, `env`, scopes, and the pinned `contractVersion`. - The payer is always `APP:` from the assertion; never accept a payer or app ID from the request body. - Resources are scoped to `(appPublicId, env)`. A foreign resource returns `404`, not `403`. - Writes require `Idempotency-Key`. Reuse the same key only for the same logical request. - Reuse the same assertion for a short logical workflow, but exchange a fresh one for a new workflow; do not cache it indefinitely. ## Scopes - `scheduler.schedules:read` - `scheduler.schedules:write` - `scheduler.deliveries:read` - `scheduler.deliveries:write` ## API reference | Method | Path | Access | Success | Tool | Purpose | | --- | --- | --- | --- | --- | --- | | `POST` | `/v1/endpoints` | write | 201 | Register endpoint | Register an app-owned HTTPS base URL for webhook delivery and receive a verification challenge. The returned endpointId is the value to pass to create_schedule. Requires an Idempotency-Key header. | | `GET` | `/v1/endpoints` | read | 200 | List endpoints | List the caller app's registered endpoints in the scheduler environment, newest registration order, with cursor pagination. | | `GET` | `/v1/endpoints/{id}` | read | 200 | Get endpoint | Read one endpoint, including verification state and signing-secret version. Plaintext signing secrets are never returned. | | `POST` | `/v1/endpoints/{id}/verify` | write | 200 | Verify endpoint | Complete endpoint ownership verification. For well_known the scheduler fetches the pending challenge URL; for manifest the platform assertion must attest the exact baseUrl + pathPrefix. On success the endpoint becomes eligible for schedules and a per-endpoint/per-env signing secret is returned exactly once. Requires an Idempotency-Key header. | | `POST` | `/v1/endpoints/{id}/rotate-secret` | write | 200 | Rotate endpoint signing secret | Issue a new per-endpoint/per-env HMAC signing secret. The previous secret remains valid until previousSecretExpiresAt (default 24 hours). The new plaintext secret is returned exactly once. Requires an Idempotency-Key header. | | `DELETE` | `/v1/endpoints/{id}` | write | 204 | Delete endpoint | Delete an endpoint permanently. Deletion is blocked while any non-deleted schedule references it. Requires an Idempotency-Key header. | | `POST` | `/v1/schedules` | write | 202 | Create schedule | Create an HTTP delivery schedule pinned to the caller app, environment, and assertion contractVersion. Exactly one of cron, rate or at is required, plus a typed http request. Requires an Idempotency-Key header. | | `GET` | `/v1/schedules` | read | 200 | List schedules | List the caller app's non-deleted schedules for the scheduler environment with cursor pagination. | | `GET` | `/v1/schedules/{id}` | read | 200 | Get schedule | Read one schedule, including state, version, nextRunAt, pausedReason, rule, and a redacted HTTP request. | | `PATCH` | `/v1/schedules/{id}` | write | 202 | Update schedule | Partially update a schedule's name, endpoint, rule, or HTTP request using its current version for optimistic concurrency. Requires an Idempotency-Key header. | | `POST` | `/v1/schedules/{id}/pause` | write | 202 | Pause schedule | Stop an active schedule from producing new deliveries without deleting it. Pausing an already-paused schedule is a no-op that returns the schedule. Requires an Idempotency-Key header. | | `POST` | `/v1/schedules/{id}/resume` | write | 202 | Resume schedule | Resume a paused schedule and compute its next run time. A spend-cap pause requires spendCapRaised=true; a manual/insufficient-balance pause does not. Resuming an active schedule is a no-op. Requires an Idempotency-Key header. | | `POST` | `/v1/schedules/{id}/run-now` | write | 202 | Run schedule now | Ask an active schedule to dispatch immediately without waiting for its next run. Requires an Idempotency-Key header. The request writes a run_now outbox row; the reconciler enqueues a synthetic delivery with a stable deliveryId through the normal billing path, so the accepted response is a request, not proof of delivery. | | `DELETE` | `/v1/schedules/{id}` | write | 202 | Delete schedule | Soft-delete a schedule and stop future deliveries. Deletion is terminal. Requires an Idempotency-Key header. | | `GET` | `/v1/usage` | read | 200 | Get usage and spend | Read this app's scheduler delivery usage for a time window: total deliveries and counts by status, failed deliveries, charged FLC, and the app's FLC balance and spend cap. Read-only and scoped to the caller app/env. | | `GET` | `/v1/deliveries` | read | 200 | List app deliveries | List the caller app's delivery attempts across every schedule, newest first, with optional status, schedule, and time filters plus cursor pagination. Read-only and scoped to the caller app/env; it never returns another app's deliveries. | | `GET` | `/v1/schedules/{id}/deliveries` | read | 200 | List deliveries | List a schedule's delivery attempts, newest first, with optional status filtering and cursor pagination. | | `GET` | `/v1/deliveries/{id}` | read | 200 | Get delivery | Read one delivery attempt, including HTTP status, error code, HMAC signing-secret version, billing state, and settlementId. | | `POST` | `/v1/deliveries/{id}/retry` | write | 202 | Retry delivery | Retry a terminal failed delivery through the normal dispatcher and billing path, reusing the same deliveryId. Requires an Idempotency-Key header. Only permanent_failure (failed/dead-lettered) deliveries can be retried; a success, an in-flight attempt, or a skipped delivery returns 409. The failed attempt was free (its reservation was released); the retry reserves again and charges at most once if it succeeds. The 202 response is an accepted request, not proof of delivery. | ### Register endpoint `POST /v1/endpoints` · write · success 201 Register an app-owned HTTPS base URL for webhook delivery and receive a verification challenge. The returned endpointId is the value to pass to create_schedule. Requires an Idempotency-Key header. **Example** ```http POST /v1/endpoints Idempotency-Key: endpoint-register-1 {"env":"prd","baseUrl":"https://api.example.com/forloop","verificationMethod":"well_known"} 201 {"endpoint":{"endpointId":"ep_abc123","appId":"app-public-1","env":"prd","baseUrl":"https://api.example.com/forloop","pathPrefix":"/forloop","verification":{"method":"well_known","state":"pending","attempts":0,"expiresAt":"2026-10-22T12:15:00.000Z"},"signingSecretVersion":0,"createdAt":"2026-10-22T12:00:00.000Z","updatedAt":"2026-10-22T12:00:00.000Z"},"challenge":{"method":"well_known","token":"ch_...","url":"https://api.example.com/forloop/.well-known/forloop-scheduler-verify?token=ch_...","expiresAt":"2026-10-22T12:15:00.000Z"}} ``` **Output fields:** endpoint, verified, challenge ### List endpoints `GET /v1/endpoints` · read · success 200 List the caller app's registered endpoints in the scheduler environment, newest registration order, with cursor pagination. **Example** ```http GET /v1/endpoints?limit=50 Authorization: Bearer 200 {"endpoints":[{"endpointId":"ep_abc123","appId":"app-public-1","env":"prd","baseUrl":"https://api.example.com/forloop","pathPrefix":"/forloop","verification":{"method":"well_known","state":"verified","attempts":1},"verifiedAt":"2026-10-22T12:01:00.000Z","signingSecretVersion":1,"createdAt":"2026-10-22T12:00:00.000Z","updatedAt":"2026-10-22T12:01:00.000Z"}],"nextCursor":"eyJwayI6..."} ``` **Output fields:** endpoints, nextCursor ### Get endpoint `GET /v1/endpoints/{id}` · read · success 200 Read one endpoint, including verification state and signing-secret version. Plaintext signing secrets are never returned. **Example** ```http GET /v1/endpoints/ep_abc123 Authorization: Bearer 200 {"endpoint":{"endpointId":"ep_abc123","appId":"app-public-1","env":"prd","baseUrl":"https://api.example.com/forloop","pathPrefix":"/forloop","verification":{"method":"well_known","state":"verified","attempts":1},"verifiedAt":"2026-10-22T12:01:00.000Z","signingSecretVersion":1,"createdAt":"2026-10-22T12:00:00.000Z","updatedAt":"2026-10-22T12:01:00.000Z"}} ``` **Output fields:** endpoint ### Verify endpoint `POST /v1/endpoints/{id}/verify` · write · success 200 Complete endpoint ownership verification. For well_known the scheduler fetches the pending challenge URL; for manifest the platform assertion must attest the exact baseUrl + pathPrefix. On success the endpoint becomes eligible for schedules and a per-endpoint/per-env signing secret is returned exactly once. Requires an Idempotency-Key header. **Example** ```http POST /v1/endpoints/ep_abc123/verify Idempotency-Key: endpoint-verify-1 Authorization: Bearer 200 {"endpoint":{"endpointId":"ep_abc123","appId":"app-public-1","env":"prd","baseUrl":"https://api.example.com/forloop","pathPrefix":"/forloop","verification":{"method":"well_known","state":"verified","attempts":1},"verifiedAt":"2026-10-22T12:01:00.000Z","signingSecretVersion":1,"createdAt":"2026-10-22T12:00:00.000Z","updatedAt":"2026-10-22T12:01:00.000Z"},"signingSecret":"<256-bit secret, shown once>","secretVersion":1} ``` **Output fields:** endpoint, signingSecret, secretVersion ### Rotate endpoint signing secret `POST /v1/endpoints/{id}/rotate-secret` · write · success 200 Issue a new per-endpoint/per-env HMAC signing secret. The previous secret remains valid until previousSecretExpiresAt (default 24 hours). The new plaintext secret is returned exactly once. Requires an Idempotency-Key header. **Example** ```http POST /v1/endpoints/ep_abc123/rotate-secret Idempotency-Key: endpoint-rotate-1 Authorization: Bearer 200 {"endpoint":{"endpointId":"ep_abc123","appId":"app-public-1","env":"prd","baseUrl":"https://api.example.com/forloop","pathPrefix":"/forloop","verification":{"method":"well_known","state":"verified","attempts":1},"verifiedAt":"2026-10-22T12:01:00.000Z","signingSecretVersion":2,"previousSecretExpiresAt":"2026-10-23T12:00:00.000Z","createdAt":"2026-10-22T12:00:00.000Z","updatedAt":"2026-10-22T12:00:00.000Z"},"signingSecret":"","secretVersion":2,"previousSecretExpiresAt":"2026-10-23T12:00:00.000Z"} ``` **Output fields:** endpoint, signingSecret, secretVersion, previousSecretExpiresAt ### Delete endpoint `DELETE /v1/endpoints/{id}` · write · success 204 Delete an endpoint permanently. Deletion is blocked while any non-deleted schedule references it. Requires an Idempotency-Key header. **Example** ```http DELETE /v1/endpoints/ep_abc123 Idempotency-Key: endpoint-delete-1 Authorization: Bearer 204 (empty body) ``` **Output fields:** ### Create schedule `POST /v1/schedules` · write · success 202 Create an HTTP delivery schedule pinned to the caller app, environment, and assertion contractVersion. Exactly one of cron, rate or at is required, plus a typed http request. Requires an Idempotency-Key header. **Example** ```http POST /v1/schedules Idempotency-Key: schedule-create-1 Authorization: Bearer {"name":"nightly sync","endpointId":"ep_abc123","contractVersion":"1.0.0","rate":"rate(1 minute)","timezone":"UTC","http":{"method":"POST","path":"/hooks/sync","headers":{"X-App":"demo"},"payload":{"hello":"world"}}} 202 {"schedule":{"scheduleId":"sch_123","appId":"app-public-1","env":"prd","endpointId":"ep_abc123","name":"nightly sync","state":"active","rule":{"type":"rate","expression":"rate(1 minute)","timezone":"UTC","flexWindowMin":1},"http":{"method":"POST","path":"/forloop/hooks/sync","headers":{"X-App":"***"},"headersBytes":18,"payloadBytes":17,"payload":{"omitted":true,"sha256":"..."}},"contractVersion":"1.0.0","payer":"APP:app-public-1","provisioningState":"pending","schedulerName":"sched-sch_123","version":1,"nextRunAt":"2026-10-22T12:01:00.000Z","createdAt":"2026-10-22T12:00:00.000Z","updatedAt":"2026-10-22T12:00:00.000Z"}} ``` **Output fields:** schedule ### List schedules `GET /v1/schedules` · read · success 200 List the caller app's non-deleted schedules for the scheduler environment with cursor pagination. **Example** ```http GET /v1/schedules?limit=50 Authorization: Bearer 200 {"schedules":[{"scheduleId":"sch_123","appId":"app-public-1","env":"prd","endpointId":"ep_abc123","name":"nightly sync","state":"active","rule":{"type":"rate","expression":"rate(1 minute)","timezone":"UTC","flexWindowMin":1},"version":1,"nextRunAt":"2026-10-22T12:01:00.000Z","createdAt":"2026-10-22T12:00:00.000Z","updatedAt":"2026-10-22T12:00:00.000Z"}],"nextCursor":"eyJwayI6..."} ``` **Output fields:** schedules, nextCursor ### Get schedule `GET /v1/schedules/{id}` · read · success 200 Read one schedule, including state, version, nextRunAt, pausedReason, rule, and a redacted HTTP request. **Example** ```http GET /v1/schedules/sch_123 Authorization: Bearer 200 {"schedule":{"scheduleId":"sch_123","appId":"app-public-1","env":"prd","endpointId":"ep_abc123","name":"nightly sync","state":"paused","pausedReason":"manual","pausedAt":"2026-10-22T12:05:00.000Z","rule":{"type":"rate","expression":"rate(1 minute)","timezone":"UTC","flexWindowMin":1},"http":{"method":"POST","path":"/forloop/hooks/sync","headers":{},"headersBytes":0,"payloadBytes":17},"contractVersion":"1.0.0","payer":"APP:app-public-1","provisioningState":"synced","schedulerName":"sched-sch_123","version":2,"createdAt":"2026-10-22T12:00:00.000Z","updatedAt":"2026-10-22T12:05:00.000Z"}} ``` **Output fields:** schedule ### Update schedule `PATCH /v1/schedules/{id}` · write · success 202 Partially update a schedule's name, endpoint, rule, or HTTP request using its current version for optimistic concurrency. Requires an Idempotency-Key header. **Example** ```http PATCH /v1/schedules/sch_123 Idempotency-Key: schedule-patch-1 Authorization: Bearer {"version":2,"name":"nightly sync v2","rate":"rate(5 minutes)"} 202 {"schedule":{"scheduleId":"sch_123","appId":"app-public-1","env":"prd","endpointId":"ep_abc123","name":"nightly sync v2","state":"active","rule":{"type":"rate","expression":"rate(5 minutes)","timezone":"UTC","flexWindowMin":1},"version":3,"nextRunAt":"2026-10-22T12:10:00.000Z","createdAt":"2026-10-22T12:00:00.000Z","updatedAt":"2026-10-22T12:05:00.000Z"}} ``` **Output fields:** schedule ### Pause schedule `POST /v1/schedules/{id}/pause` · write · success 202 Stop an active schedule from producing new deliveries without deleting it. Pausing an already-paused schedule is a no-op that returns the schedule. Requires an Idempotency-Key header. **Example** ```http POST /v1/schedules/sch_123/pause Idempotency-Key: schedule-pause-1 Authorization: Bearer 202 {"schedule":{"scheduleId":"sch_123","state":"paused","pausedReason":"manual","pausedAt":"2026-10-22T12:05:00.000Z","version":2,"nextRunAt":null}} ``` **Output fields:** schedule ### Resume schedule `POST /v1/schedules/{id}/resume` · write · success 202 Resume a paused schedule and compute its next run time. A spend-cap pause requires spendCapRaised=true; a manual/insufficient-balance pause does not. Resuming an active schedule is a no-op. Requires an Idempotency-Key header. **Example** ```http POST /v1/schedules/sch_123/resume Idempotency-Key: schedule-resume-1 Authorization: Bearer {"spendCapRaised":true} 202 {"schedule":{"scheduleId":"sch_123","state":"active","version":3,"nextRunAt":"2026-10-22T12:06:00.000Z"}} ``` **Output fields:** schedule ### Run schedule now `POST /v1/schedules/{id}/run-now` · write · success 202 Ask an active schedule to dispatch immediately without waiting for its next run. Requires an Idempotency-Key header. The request writes a run_now outbox row; the reconciler enqueues a synthetic delivery with a stable deliveryId through the normal billing path, so the accepted response is a request, not proof of delivery. **Example** ```http POST /v1/schedules/sch_123/run-now Idempotency-Key: schedule-run-now-1 Authorization: Bearer 202 {"schedule":{"scheduleId":"sch_123","state":"active","lastRunAt":"2026-10-22T12:05:00.000Z","version":3}} ``` **Output fields:** schedule ### Delete schedule `DELETE /v1/schedules/{id}` · write · success 202 Soft-delete a schedule and stop future deliveries. Deletion is terminal. Requires an Idempotency-Key header. **Example** ```http DELETE /v1/schedules/sch_123 Idempotency-Key: schedule-delete-1 Authorization: Bearer 202 {"schedule":{"scheduleId":"sch_123","state":"deleted","version":4}} ``` **Output fields:** schedule ### Get usage and spend `GET /v1/usage` · read · success 200 Read this app's scheduler delivery usage for a time window: total deliveries and counts by status, failed deliveries, charged FLC, and the app's FLC balance and spend cap. Read-only and scoped to the caller app/env. **Example** ```http GET /v1/usage?from=2026-10-01T00:00:00Z&to=2026-10-22T00:00:00Z Authorization: Bearer 200 {"usage":{"appId":"app-public-1","env":"prd","from":"2026-10-01T00:00:00.000Z","to":"2026-10-22T00:00:00.000Z","totalDeliveries":120,"successfulDeliveries":115,"failedDeliveries":3,"pendingDeliveries":2,"byStatus":{"pending":2,"success":115,"retryable_failure":1,"permanent_failure":2,"skipped_insufficient_balance":0,"skipped_spend_cap":0},"chargedFLC":575,"chargedDeliveries":115,"truncated":false,"balance":{"available":425,"reserved":0,"spent":575,"spendCap":2000},"balanceUnavailable":false}} ``` **Output fields:** usage ### List app deliveries `GET /v1/deliveries` · read · success 200 List the caller app's delivery attempts across every schedule, newest first, with optional status, schedule, and time filters plus cursor pagination. Read-only and scoped to the caller app/env; it never returns another app's deliveries. **Example** ```http GET /v1/deliveries?limit=50&status=permanent_failure&from=2026-10-01T00:00:00Z&to=2026-10-22T00:00:00Z Authorization: Bearer 200 {"deliveries":[{"id":"dlv_123","deliveryId":"dlv_123","scheduleId":"sch_123","status":"permanent_failure","attempts":3,"httpStatus":410,"latencyMs":84,"requestedAt":"2026-10-22T12:00:00.000Z","completedAt":"2026-10-22T12:00:00.084Z"}],"nextCursor":"eyJwayI6..."} ``` **Output fields:** deliveries, nextCursor ### List deliveries `GET /v1/schedules/{id}/deliveries` · read · success 200 List a schedule's delivery attempts, newest first, with optional status filtering and cursor pagination. **Example** ```http GET /v1/schedules/sch_123/deliveries?limit=50&status=permanent_failure Authorization: Bearer 200 {"deliveries":[{"id":"dlv_123","deliveryId":"dlv_123","status":"permanent_failure","attempts":3,"httpStatus":410,"latencyMs":84,"requestedAt":"2026-10-22T12:00:00.000Z","completedAt":"2026-10-22T12:00:00.084Z"}],"nextCursor":"eyJwayI6..."} ``` **Output fields:** deliveries, nextCursor ### Get delivery `GET /v1/deliveries/{id}` · read · success 200 Read one delivery attempt, including HTTP status, error code, HMAC signing-secret version, billing state, and settlementId. **Example** ```http GET /v1/deliveries/dlv_123 Authorization: Bearer 200 {"delivery":{"id":"dlv_123","deliveryId":"dlv_123","scheduleId":"sch_123","appId":"app-public-1","env":"prd","attempt":1,"attempts":1,"status":"success","httpStatus":202,"latencyMs":84,"requestedAt":"2026-10-22T12:00:00.000Z","completedAt":"2026-10-22T12:00:00.084Z","signingSecretVersion":1,"contractVersion":"1","billing":{"state":"charged","reservationId":"res_123","quotedAmountFLC":5,"catalogVersion":7,"chargeTxnId":"txn_123"},"settlementId":"stl_dlv_123"}} ``` **Output fields:** delivery ### Retry delivery `POST /v1/deliveries/{id}/retry` · write · success 202 Retry a terminal failed delivery through the normal dispatcher and billing path, reusing the same deliveryId. Requires an Idempotency-Key header. Only permanent_failure (failed/dead-lettered) deliveries can be retried; a success, an in-flight attempt, or a skipped delivery returns 409. The failed attempt was free (its reservation was released); the retry reserves again and charges at most once if it succeeds. The 202 response is an accepted request, not proof of delivery. **Example** ```http POST /v1/deliveries/dlv_123/retry Idempotency-Key: delivery-retry-1 Authorization: Bearer 202 {"delivery":{"id":"dlv_123","deliveryId":"dlv_123","scheduleId":"sch_123","appId":"app-public-1","env":"prd","attempt":0,"attempts":0,"status":"pending","requestedAt":"2026-10-22T12:10:00.000Z"}} ``` **Output fields:** delivery ## Errors and retries | Code | Meaning | Retry? | | --- | --- | --- | | `invalid_assertion` / `expired` | The assertion is missing, invalid, or expired. | No; exchange a fresh assertion. | | `insufficient_scope` | The assertion does not carry a required scope. | No; update the connection grant. | | `env_mismatch` / `audience_mismatch` | Wrong platform environment or target. | No; fix the connection. | | `invalid_request` | The request body or parameters are invalid. | No. | | `not_found` | The resource is absent or belongs to another app. | No. | | `conflict` | Version, state, or idempotency conflict. | No; read the current state first. | | `quota_exceeded` / `rate_limited` | Per-app quota or rate limit reached. | Yes, after the indicated delay. | | `internal_error` / `provider_transport` | Transient platform or provider failure. | Yes, with backoff and the same idempotency key. | ## Billing 5 FLC per 1 delivery (ceil). Payer: `APP:`. Failures are free. The service reserves before billable work and commits only after the success condition in its contract. A failed, filtered, or canceled unit is free. A successful unit that cannot settle is retried durably and is never silently released. ## Limits and retention - Up to 100 schedules per app. - Minimum schedule interval is 1 minute; the maximum payload is 32 KiB. - Delivery history is retained for 30 days. - Endpoint verification challenges expire after 15 minutes. - Use the `Idempotency-Key` header for every write. ## AI-agent checklist 1. Discover the target agent card and pin its exact contract version. 2. Exchange the app credential for a fresh assertion immediately before the call. 3. Use the generated client types; never hand-write a response type. 4. Send `Idempotency-Key` on every write and reuse it only for the same logical request. 5. Never infer the payer or app ID from a request body; use the verified assertion. 6. Treat 4xx errors as terminal unless the contract explicitly says otherwise; retry only transient 5xx/transport errors with backoff. 7. Read the returned job/delivery state before presenting success to a user. - A schedule cannot target an endpoint until that endpoint is verified. - Every delivery is signed with HMAC-SHA256 using the endpoint signing secret. - Failed deliveries and retries are free; only a 2xx delivery commits 5 FLC.