ForLoop Scheduler integration guide
ForLoop core service · docs
v2.7.0
llms.txtOpen console

ForLoop core service

ForLoop Scheduler integration guide

Schedule signed outbound webhook deliveries for a ForLoop app, then inspect every attempt, signature, and charge.

Quickstart

Create an app-subject connection to this service, then exchange the app credential for an assertion.

curl -X POST https://scheduler.app.forloop.cc/api/opencode/a2a/connections/<connectionId>/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 <assertion> 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:<callerSprintId>, appPublicId, env, scopes, and the pinned contractVersion.

Scopes

API reference

MethodPathAccessSuccessToolPurpose
POST/v1/endpointswrite201Register endpointRegister 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/endpointsread200List endpointsList the caller app's registered endpoints in the scheduler environment, newest registration order, with cursor pagination.
GET/v1/endpoints/{id}read200Get endpointRead one endpoint, including verification state and signing-secret version. Plaintext signing secrets are never returned.
POST/v1/endpoints/{id}/verifywrite200Verify endpointComplete 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-secretwrite200Rotate endpoint signing secretIssue 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}write204Delete endpointDelete an endpoint permanently. Deletion is blocked while any non-deleted schedule references it. Requires an Idempotency-Key header.
POST/v1/scheduleswrite202Create scheduleCreate 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/schedulesread200List schedulesList the caller app's non-deleted schedules for the scheduler environment with cursor pagination.
GET/v1/schedules/{id}read200Get scheduleRead one schedule, including state, version, nextRunAt, pausedReason, rule, and a redacted HTTP request.
PATCH/v1/schedules/{id}write202Update schedulePartially 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}/pausewrite202Pause scheduleStop 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}/resumewrite202Resume scheduleResume 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-nowwrite202Run schedule nowAsk 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}write202Delete scheduleSoft-delete a schedule and stop future deliveries. Deletion is terminal. Requires an Idempotency-Key header.
GET/v1/usageread200Get usage and spendRead 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/deliveriesread200List app deliveriesList 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}/deliveriesread200List deliveriesList a schedule's delivery attempts, newest first, with optional status filtering and cursor pagination.
GET/v1/deliveries/{id}read200Get deliveryRead one delivery attempt, including HTTP status, error code, HMAC signing-secret version, billing state, and settlementId.
POST/v1/deliveries/{id}/retrywrite202Retry deliveryRetry 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

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

GET /v1/endpoints?limit=50
Authorization: Bearer <assertion>

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

GET /v1/endpoints/ep_abc123
Authorization: Bearer <assertion>

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

POST /v1/endpoints/ep_abc123/verify
Idempotency-Key: endpoint-verify-1
Authorization: Bearer <assertion>

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

POST /v1/endpoints/ep_abc123/rotate-secret
Idempotency-Key: endpoint-rotate-1
Authorization: Bearer <assertion>

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":"<new secret, shown once>","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

DELETE /v1/endpoints/ep_abc123
Idempotency-Key: endpoint-delete-1
Authorization: Bearer <assertion>

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

POST /v1/schedules
Idempotency-Key: schedule-create-1
Authorization: Bearer <assertion>
{"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

GET /v1/schedules?limit=50
Authorization: Bearer <assertion>

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

GET /v1/schedules/sch_123
Authorization: Bearer <assertion>

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

PATCH /v1/schedules/sch_123
Idempotency-Key: schedule-patch-1
Authorization: Bearer <assertion>
{"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

POST /v1/schedules/sch_123/pause
Idempotency-Key: schedule-pause-1
Authorization: Bearer <assertion>

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

POST /v1/schedules/sch_123/resume
Idempotency-Key: schedule-resume-1
Authorization: Bearer <assertion>
{"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

POST /v1/schedules/sch_123/run-now
Idempotency-Key: schedule-run-now-1
Authorization: Bearer <assertion>

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

DELETE /v1/schedules/sch_123
Idempotency-Key: schedule-delete-1
Authorization: Bearer <assertion>

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

GET /v1/usage?from=2026-10-01T00:00:00Z&to=2026-10-22T00:00:00Z
Authorization: Bearer <assertion>

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

GET /v1/deliveries?limit=50&status=permanent_failure&from=2026-10-01T00:00:00Z&to=2026-10-22T00:00:00Z
Authorization: Bearer <assertion>

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

GET /v1/schedules/sch_123/deliveries?limit=50&status=permanent_failure
Authorization: Bearer <assertion>

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

GET /v1/deliveries/dlv_123
Authorization: Bearer <assertion>

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

POST /v1/deliveries/dlv_123/retry
Idempotency-Key: delivery-retry-1
Authorization: Bearer <assertion>

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

CodeMeaningRetry?
invalid_assertion / expiredThe assertion is missing, invalid, or expired.No; exchange a fresh assertion.
insufficient_scopeThe assertion does not carry a required scope.No; update the connection grant.
env_mismatch / audience_mismatchWrong platform environment or target.No; fix the connection.
invalid_requestThe request body or parameters are invalid.No.
not_foundThe resource is absent or belongs to another app.No.
conflictVersion, state, or idempotency conflict.No; read the current state first.
quota_exceeded / rate_limitedPer-app quota or rate limit reached.Yes, after the indicated delay.
internal_error / provider_transportTransient platform or provider failure.Yes, with backoff and the same idempotency key.

Billing

5 FLC per 1 delivery (ceil). Payer: APP:<appPublicId>. 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

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.