ForLoop Notify integration guide
ForLoop core service · docs
v1.0.1
llms.txtOpen console

ForLoop core service

ForLoop Notify integration guide

Send app-scoped email, manage reusable templates, and observe delivery, suppression, and billing state.

Quickstart

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

curl -X POST https://notify.app.forloop.cc/api/opencode/a2a/connections/<connectionId>/assertion \
  -H "x-api-token: $FLC_APP_CREDENTIAL" \
  -H "content-type: application/json" \
  -d '{"scopes":["notify.messages:write"],"contractVersion":"1.0.1"}'

The assertion is valid for 300 seconds. Send it as Authorization: Bearer <assertion> on every /v1 call.

  1. Create a template with POST /v1/templates, or send inline content.
  2. Send a notification to a bare email address.
  3. Poll GET /v1/notifications/{id} until accepted or terminal failure.
  4. Read GET /v1/usage to confirm the provider-accepted charge.

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/notificationswrite202Send notificationSend one email to one recipient, either from an app-scoped template plus templateData or from inline subject/html/text. Optional base64 attachments (for example an ICS reminder) are supported. Returns 202 with a stable notificationId. Requires an Idempotency-Key header.
GET/v1/notifications/{id}read200Get notificationRead one notification by id, including status, attempts, provider message id, and billing state. Rendered content and the full recipient are only returned with include=content.
GET/v1/notificationsread200List notificationsList the caller app's notifications for the environment, newest first, with optional status filtering and cursor pagination.
POST/v1/notifications/{id}/cancelwrite202Cancel notificationCancel a queued notification before dispatch and release its billing reservation. Accepted or failed notifications cannot be canceled. Requires an Idempotency-Key header.
POST/v1/templateswrite201Create templateCreate an app-scoped email template with a subject, optional HTML/text bodies, and {{variable}} placeholders. Requires an Idempotency-Key header.
GET/v1/templates/{id}read200Get templateRead one app-scoped template, including its content and version.
GET/v1/templatesread200List templatesList the caller app's templates for the environment, newest first, with cursor pagination.
PATCH/v1/templates/{id}write200Update templatePartially update a template's name, description, subject, html, or text using its current version for optimistic concurrency. Requires an Idempotency-Key header.
DELETE/v1/templates/{id}write204Delete templateDelete a template permanently. Already-queued notifications keep their frozen rendered content. Requires an Idempotency-Key header.

Send notification

POST /v1/notifications · write · success 202

Send one email to one recipient, either from an app-scoped template plus templateData or from inline subject/html/text. Optional base64 attachments (for example an ICS reminder) are supported. Returns 202 with a stable notificationId. Requires an Idempotency-Key header.

Example

POST /v1/notifications
Idempotency-Key: invoice-123-ready
Authorization: Bearer <assertion>
{"channel":"email","to":"client@example.com","templateId":"tpl_abc123","templateData":{"name":"Ada","invoiceUrl":"https://app.example.com/invoices/123"}}

202
{"notification":{"notificationId":"ntf_123","status":"queued","channel":"email","toMasked":"c***@example.com","subject":"Invoice 123 is ready","billing":{"state":"reserved","quotedAmountFLC":10}}}

Output fields: notification

Get notification

GET /v1/notifications/{id} · read · success 200

Read one notification by id, including status, attempts, provider message id, and billing state. Rendered content and the full recipient are only returned with include=content.

Example

GET /v1/notifications/ntf_123?include=content
Authorization: Bearer <assertion>

200
{"notification":{"notificationId":"ntf_123","status":"accepted","providerMessageId":"<provider-id>","billing":{"state":"charged","quotedAmountFLC":10}}}

Output fields: notification

List notifications

GET /v1/notifications · read · success 200

List the caller app's notifications for the environment, newest first, with optional status filtering and cursor pagination.

Example

GET /v1/notifications?status=accepted&limit=50
Authorization: Bearer <assertion>

200
{"notifications":[{"notificationId":"ntf_123","status":"accepted","toMasked":"c***@example.com"}],"nextCursor":"eyJwayI6..."}

Output fields: notifications, nextCursor

Cancel notification

POST /v1/notifications/{id}/cancel · write · success 202

Cancel a queued notification before dispatch and release its billing reservation. Accepted or failed notifications cannot be canceled. Requires an Idempotency-Key header.

Example

POST /v1/notifications/ntf_123/cancel
Idempotency-Key: cancel-ntf-123
Authorization: Bearer <assertion>

202
{"notification":{"notificationId":"ntf_123","status":"canceled"}}

Output fields: notification

Create template

POST /v1/templates · write · success 201

Create an app-scoped email template with a subject, optional HTML/text bodies, and {{variable}} placeholders. Requires an Idempotency-Key header.

Example

POST /v1/templates
Idempotency-Key: template-invoice-ready
Authorization: Bearer <assertion>
{"name":"invoice-ready","subject":"Invoice {{number}} is ready","html":"<p>Hi {{name}},</p>","text":"Hi {{name}},"}

201
{"template":{"templateId":"tpl_123","version":1}}

Output fields: template

Get template

GET /v1/templates/{id} · read · success 200

Read one app-scoped template, including its content and version.

Example

GET /v1/templates/tpl_123
Authorization: Bearer <assertion>

200
{"template":{"templateId":"tpl_123","name":"invoice-ready","subject":"Invoice {{number}} is ready","version":1}}

Output fields: template

List templates

GET /v1/templates · read · success 200

List the caller app's templates for the environment, newest first, with cursor pagination.

Example

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

200
{"templates":[{"templateId":"tpl_123","name":"invoice-ready","version":1}],"nextCursor":"eyJwayI6..."}

Output fields: templates, nextCursor

Update template

PATCH /v1/templates/{id} · write · success 200

Partially update a template's name, description, subject, html, or text using its current version for optimistic concurrency. Requires an Idempotency-Key header.

Example

PATCH /v1/templates/tpl_123
Idempotency-Key: template-invoice-ready-v2
Authorization: Bearer <assertion>
{"version":1,"subject":"Your invoice {{number}} is ready"}

200
{"template":{"templateId":"tpl_123","version":2}}

Output fields: template

Delete template

DELETE /v1/templates/{id} · write · success 204

Delete a template permanently. Already-queued notifications keep their frozen rendered content. Requires an Idempotency-Key header.

Example

DELETE /v1/templates/tpl_123
Idempotency-Key: delete-template-tpl-123
Authorization: Bearer <assertion>

204 (empty body)

Output fields:

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

10 FLC per 1 message (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.