Skip to content
Kokumi

Goals

Live

Mark a form sent, a page reached, or a tool used as a conversion goal alongside its traffic source. Manage goal definitions through POST and GET /api/v1/goals or kokumi goal add, backed by D1 and idempotency keys.

POST and GET /api/v1/goals with idempotency keys and kokumi goal add.

Create and update goals from the CLI with dry-run checks

Define a goal with a name, kind, and target, previewing the request with --dry-run before writing to your D1 goals table. Re-running with the same idempotency key replays safely without duplicate writes.

  • kokumi goal add <name> --kind <kind> --target <val> --dry-run validates before mutating.
  • Upserts definitions into the D1 goals table using write scope.
  • Reusing an Idempotency-Key on a different route is rejected with HTTP 409.
sh
kokumi goal add signup --kind path --target /thanks --dry-run

Inspect and automate goals over the HTTP API

Read up to 200 configured goals with a read token or upsert definitions programmatically from CI or setup scripts. Every write is logged to api_audit_log and protected by Idempotency-Key.

  • GET /api/v1/goals returns up to 200 configured goals (read scope).
  • POST /api/v1/goals accepts { name, kind, target } (write scope).
  • Replays return 200 with x-idempotent-replay: true.
sh
curl -sS -X POST -H "Authorization: Bearer $WRITE_TOKEN" -H "Idempotency-Key: goal-signup-v1" -d '{"name":"signup","kind":"path","target":"/thanks"}' https://example.com/api/v1/goals