API Reference

The Fliq API is a REST API. All requests are over HTTPS. Request and response bodies are JSON.

Base URL

https://api.fliq.sh

Authentication

Pass your API token in the Authorization header as a Bearer token. Generate tokens in Settings → API Tokens.

Authorization: Bearer fliq_sk_your_token

Jobs

Create a job

POST /jobs

{
  "url":             string,   // required
  "http_method":     string,   // optional — default "POST"
  "scheduled_at":    string,   // required — ISO 8601 UTC
  "headers":         object,   // optional
  "body":            string,   // optional
  "max_retries":     number,   // optional — default 0
  "idempotency_key": string,   // optional
  "webhook_url":     string,   // optional — URL to POST when job reaches terminal state
  "webhook_headers": object    // optional — custom headers for webhook request
}
// Response — 201 Created
{
  "id":           "job_01hx...",
  "url":          "https://yourapp.com/api/charge",
  "http_method":  "POST",
  "scheduled_at": "2026-04-01T09:00:00Z",
  "max_retries":  3,
  "status":       "scheduled",
  "created_at":   "2026-03-10T14:22:01Z"
}

Get a job

GET /jobs/{job_id}

Returns the job object with current status and execution count.

List jobs

GET /jobs?status=scheduled&limit=50&cursor=...
  • status — filter by scheduled | success | failed | cancelled
  • limit — max results per page (default 20, max 100)
  • cursor — pagination cursor from previous response

Cancel a job

DELETE /jobs/{job_id}

Cancels a job that has not yet fired. Returns 404 if the job doesn’t exist or 409 if it has already executed.

Replay a failed job

POST /jobs/{job_id}/replay

Re-runs a permanently-failed job. Rather than resetting the original, Fliq clones it into a fresh pending job — the failed row is preserved for audit, and the clone gets a clean attempt sequence and a replay_of pointer back to the source.

// Response — 201 Created
{
  "id":           "job_01hy...",
  "status":       "pending",
  "replay_of":    "job_01hx...",
  "scheduled_at": "2026-04-01T09:05:00Z",
  "created_at":   "2026-04-01T09:05:00Z"
}

A replay enqueues a new execution, so it passes the same credit gate as a create — 402 when you’re out of credits. Returns 409 if the job isn’t in a failed state.

Schedules

Create a schedule

POST /schedules

{
  "url":             string,   // required
  "http_method":     string,   // optional — default "POST"
  "cron":            string,   // required — 5-part cron expression (UTC)
  "headers":         object,   // optional
  "body":            string,   // optional
  "max_retries":     number,   // optional — default 0
  "webhook_url":     string,   // optional — inherited by spawned jobs
  "webhook_headers": object    // optional — inherited by spawned jobs
}
// Response — 201 Created
{
  "id":          "sched_01hx...",
  "url":         "https://yourapp.com/api/digest",
  "cron":        "0 8 * * 1-5",
  "status":      "active",
  "created_at":  "2026-03-10T14:22:01Z",
  "next_run_at": "2026-03-11T08:00:00Z"
}

List schedules

GET /schedules?limit=50&cursor=...

Delete a schedule

DELETE /schedules/{schedule_id}

Stops all future executions immediately. Already-queued executions for the current interval may still fire.

Webhooks

When a job has a webhook_url, Fliq POSTs a JSON payload to that URL when the job reaches a terminal state (completed, failed, or cancelled).

// Webhook payload
{
  "job_id":       "job_01hx...",
  "status":       "completed",
  "status_code":  200,
  "last_error":   null,
  "completed_at": "2026-04-01T09:00:01Z",
  "attempt_num":  1
}
  • Delivery is best-effort, fire-and-forget — a webhook failure does not change the job’s status
  • Webhook calls have a 10-second timeout
  • Webhook calls do not consume credits
  • Custom headers can be set via webhook_headers (e.g. for auth tokens)
  • Schedules inherit webhook_url and webhook_headers — every spawned job gets the same webhook config

Executions

List executions for a job

GET /jobs/{job_id}/executions
// Response
{
  "executions": [
    {
      "id":           "exec_01hx...",
      "attempt_num":  1,
      "status":       "success",
      "status_code":  200,
      "duration_ms":  143,
      "executed_at":  "2026-04-01T09:00:00Z"
    }
  ]
}

Alert channels

Get notified when a job or buffer item exhausts its retries — a permanent failure, meaning your endpoint is down and Fliq has given up. Retries themselves don’t alert; only the terminal failure does.

Create a channel

POST /alerts

{
  "type":   string,   // required — "webhook" or "slack"
  "target": string,   // required — destination URL
  "name":   string    // optional — a label
}
// Response — 201 Created
{
  "id":         "alt_01hx...",
  "type":       "slack",
  "target":     "https://hooks.slack.com/services/...",
  "name":       "on-call",
  "enabled":    true,
  "created_at": "2026-04-01T09:00:00Z",
  "updated_at": "2026-04-01T09:00:00Z"
}
  • slack channels receive a Slack incoming-webhook message ({"text": ...}).
  • webhook channels receive a structured JSON payload (resource_type, resource_id, last_error, status_code, attempts, …).
  • Delivery uses the same SSRF-safe path as job execution and is best-effort — it never blocks or changes job processing.
  • email is not supported yet; the API rejects any type other than webhook or slack.

List, toggle & delete

GET    /alerts                  // { "channels": [ ... ] }
PATCH  /alerts/{id}  {"enabled": false}   // 204 — pause/resume delivery
DELETE /alerts/{id}             // 204

Analytics

Read-only aggregates over data the engine already records. days defaults to 30 and is clamped to [1, 365].

Job stats

GET /stats/jobs?days=30
{
  "total_executions": 1240,
  "succeeded":        1198,
  "failed":           42,
  "success_rate":     0.966,
  "avg_duration_ms":  148.2,
  "p95_duration_ms":  512.0,
  "since_days":       30
}

Usage

GET /stats/usage?days=30

Per-UTC-day execution counts split by type, plus window totals and your current credit balance.

{
  "buckets": [
    { "date": "2026-03-31", "job_executions": 40, "buffer_executions": 12 }
  ],
  "total_job_executions":    980,
  "total_buffer_executions": 260,
  "balance":                 41200,
  "plan":                    "free",
  "since_days":              30
}

Errors

All error responses follow the same shape:

{
  "error": {
    "code":    "invalid_scheduled_at",
    "message": "scheduled_at must be in the future"
  }
}
  • 400 — invalid request body or parameters
  • 401 — missing or invalid API token
  • 403 — action not allowed on this resource
  • 404 — resource not found
  • 409 — conflict (e.g. cancelling an already-executed job)
  • 429 — daily execution limit reached (free tier)
  • 500 — something went wrong on our end