Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Flexi Billing

Flexi Billing Service exposes internal, service-to-service-only operations for the flexi billing V3 pipeline: sanity reads of the ledger-reconstructed billable units, the flexi_billing_events_daily_runs rows, and the billable Ansible hosts for a day, plus replaying discovery, delivery, or Ansible host billing for a day.

Sanity read of the Ansible hosts billed for a day

get

Returns the hosts Ansible host billing sends as IACM_ACTIVE_HOSTS for the given date: one row per host active in ansible_usage over the 30 days ending on it, with the deterministic id its event carries. Optionally scoped to a single account. The date must be a completed UTC day (before today). total_count is the full host count for the day regardless of limit.

Query parameters
datestringRequired

UTC calendar day to act on, in YYYY-MM-DD format; resolved to 00:00 UTC of that date. Must be a completed UTC day (before today).

Example: 2026-09-27
accountstring · max: 128Optional

Optional account identifier; empty means all accounts.

Example: fbm
limitinteger · int64Optional

Optional maximum number of rows to return; absent or <= 0 returns all rows for the day. total_count is always the full count, independent of limit.

Example: 8387776355325926000
Responses
200

OK response.

application/json

Ansible hosts billed from ansible_usage for a day

accountstringOptional

Account the read targeted; empty means all accounts

Example: Praesentium error sunt cupiditate molestiae tempora facere.
countinteger · int64Required

Number of rows returned (after any limit)

Example: 876811326205003100
datestringRequired

Requested day

Example: Provident provident quas vel quos eum est.
epoch_dayinteger · int64Required

Resolved 00:00 UTC Unix seconds for the date

Example: 5997227889072194000
total_countinteger · int64Required

Full number of billable hosts for the day (and account), independent of limit

Example: 8650659163089397000
get/api/flexi-billing/ansible-host-ledger
GET /api/flexi-billing/ansible-host-ledger?date=2026-09-27 HTTP/1.1
Host: localhost:80
Accept: */*
{
  "account": "Rerum enim repellendus quaerat aliquid doloribus quidem.",
  "count": 196313460938978720,
  "date": "Ipsa ex voluptatem et vel.",
  "epoch_day": 749145043679963800,
  "rows": [
    {
      "account": "Doloribus quisquam.",
      "host_address": "Laborum repellendus officiis.",
      "id": "Nulla magni quisquam voluptatum.",
      "last_activity": 6471904228986153000,
      "org": "Dicta sed autem rerum excepturi.",
      "parent_unique_id": "Excepturi facilis labore nihil deleniti.",
      "project": "Qui dolorem earum vel tenetur odit beatae."
    },
    {
      "account": "Doloribus quisquam.",
      "host_address": "Laborum repellendus officiis.",
      "id": "Nulla magni quisquam voluptatum.",
      "last_activity": 6471904228986153000,
      "org": "Dicta sed autem rerum excepturi.",
      "parent_unique_id": "Excepturi facilis labore nihil deleniti.",
      "project": "Qui dolorem earum vel tenetur odit beatae."
    }
  ],
  "total_count": 8514714005029311000
}

Replay Ansible host billing for a day

post

Enqueues IACM_ACTIVE_HOSTS billing for one account, or the Ansible host scheduler fan-out for all accounts, re-sending one Kafka event per host active in ansible_usage over the 30 days ending on the given date. The date must be a completed UTC day (before today). Idempotent: events carry deterministic idempotency keys, so UDP deduplicates hosts already delivered.

Body
accountstring · max: 128Optional

Optional account identifier; empty means all accounts.

Example: r1j
datestringRequired

UTC calendar day to act on, in YYYY-MM-DD format; resolved to 00:00 UTC of that date. Must be a completed UTC day (before today).

Example: 2026-09-27
forcebooleanOptional

When an identical job is already queued (e.g. waiting out a retry), make it run immediately instead of leaving it.

Default: falseExample: false
Responses
202

Accepted response.

application/json

Result of a flexi billing trigger

accountstringOptional

Account the trigger targeted; empty means all accounts

Example: Cum deleniti et itaque consectetur modi.
datestringRequired

Requested day

Example: Voluptas eos omnis aut.
epoch_dayinteger · int64Required

Resolved 00:00 UTC Unix seconds for the date

Example: 4527392274086356000
job_idinteger · int64Required

River job acted on

Example: 2298437543349237800
job_statestringRequired

State of the River job after the trigger

Example: available
messagestringRequired

Human-readable summary

Example: Iste iste est eaque suscipit aut voluptate.
outcomestring · enumRequired

What happened to the job

Example: enqueuedPossible values:
post/api/flexi-billing/ansible-hosts
POST /api/flexi-billing/ansible-hosts HTTP/1.1
Host: localhost:80
Content-Type: application/json
Accept: */*
Content-Length: 51

{
  "account": "tfd",
  "date": "2026-09-27",
  "force": false
}
{
  "account": "Sed repellendus accusamus ullam.",
  "date": "Voluptatum dolor.",
  "epoch_day": 7981891377293283000,
  "job_id": 5714267073566024000,
  "job_state": "available",
  "message": "Quae quo aut iure.",
  "outcome": "enqueued"
}

Sanity read of the billable units reconstructed from the ledger for a day

get

Reconstructs the billable units from workspace_history as of the end of the given date (UTC) and returns them (the rows discovery would write). Optionally scoped to a single account. total_count is the full unit count for the day regardless of limit.

Query parameters
datestringRequired

UTC calendar day to act on, in YYYY-MM-DD format; resolved to 00:00 UTC of that date. Must be a completed UTC day (before today).

Example: 2026-09-27
accountstring · max: 128Optional

Optional account identifier; empty means all accounts.

Example: wl5
limitinteger · int64Optional

Optional maximum number of rows to return; absent or <= 0 returns all rows for the day. total_count is always the full count, independent of limit.

Example: 5386115898750387000
Responses
200

OK response.

application/json

Billable units reconstructed from the ledger for a day

accountstringOptional

Account the read targeted; empty means all accounts

Example: Corporis alias natus nemo quae repudiandae et.
countinteger · int64Required

Number of rows returned (after any limit)

Example: 3731472243908707300
datestringRequired

Requested day

Example: Earum provident.
epoch_dayinteger · int64Required

Resolved 00:00 UTC Unix seconds for the date

Example: 4289444166704150000
total_countinteger · int64Required

Full number of billable units for the day (and account), independent of limit

Example: 3163907324095765500
get/api/flexi-billing/billing-ledger
GET /api/flexi-billing/billing-ledger?date=2026-09-27 HTTP/1.1
Host: localhost:80
Accept: */*
{
  "account": "Quis tenetur necessitatibus vero a veritatis.",
  "count": 2872496400759357400,
  "date": "Qui modi.",
  "epoch_day": 8720432632602405000,
  "rows": [
    {
      "account": "Quia vel id.",
      "id": "Aspernatur vero similique quod molestiae.",
      "org": "Sed cumque modi voluptatibus perferendis accusantium unde.",
      "project": "Occaecati dolor qui fuga sed.",
      "provisioner": "Est a in commodi.",
      "provisioner_version": "Enim vel aut esse alias.",
      "terragrunt_provider": true,
      "unique_key": "Ipsum voluptate nesciunt consequuntur.",
      "workspace_id": "Quo quasi exercitationem nam esse quidem ipsam.",
      "workspace_name": "Accusamus officia ipsa."
    },
    {
      "account": "Quia vel id.",
      "id": "Aspernatur vero similique quod molestiae.",
      "org": "Sed cumque modi voluptatibus perferendis accusantium unde.",
      "project": "Occaecati dolor qui fuga sed.",
      "provisioner": "Est a in commodi.",
      "provisioner_version": "Enim vel aut esse alias.",
      "terragrunt_provider": true,
      "unique_key": "Ipsum voluptate nesciunt consequuntur.",
      "workspace_id": "Quo quasi exercitationem nam esse quidem ipsam.",
      "workspace_name": "Accusamus officia ipsa."
    },
    {
      "account": "Quia vel id.",
      "id": "Aspernatur vero similique quod molestiae.",
      "org": "Sed cumque modi voluptatibus perferendis accusantium unde.",
      "project": "Occaecati dolor qui fuga sed.",
      "provisioner": "Est a in commodi.",
      "provisioner_version": "Enim vel aut esse alias.",
      "terragrunt_provider": true,
      "unique_key": "Ipsum voluptate nesciunt consequuntur.",
      "workspace_id": "Quo quasi exercitationem nam esse quidem ipsam.",
      "workspace_name": "Accusamus officia ipsa."
    }
  ],
  "total_count": 3950380147033872000
}

Sanity read of flexi_billing_events_daily_runs rows for a day

get

Returns the flexi_billing_events_daily_runs rows for the given date (epoch_day), optionally scoped to a single account. A day with no rows returns total_count 0 and an empty list. total_count is the full row count for the day regardless of limit.

Query parameters
datestringRequired

UTC calendar day to act on, in YYYY-MM-DD format; resolved to 00:00 UTC of that date. Must be a completed UTC day (before today).

Example: 2026-09-27
accountstring · max: 128Optional

Optional account identifier; empty means all accounts.

Example: hk0
limitinteger · int64Optional

Optional maximum number of rows to return; absent or <= 0 returns all rows for the day. total_count is always the full count, independent of limit.

Example: 2904822671541610500
Responses
200

OK response.

application/json

flexi_billing_events_daily_runs rows for a day

accountstringOptional

Account the read targeted; empty means all accounts

Example: Libero voluptatem inventore provident exercitationem ad.
countinteger · int64Required

Number of rows returned (after any limit)

Example: 1555165120474850000
datestringRequired

Requested day

Example: Blanditiis rem.
epoch_dayinteger · int64Required

Resolved 00:00 UTC Unix seconds for the date

Example: 6728136257324208000
total_countinteger · int64Required

Full number of rows for the day (and account), independent of limit

Example: 276886844279661470
get/api/flexi-billing/daily-runs
GET /api/flexi-billing/daily-runs?date=2026-09-27 HTTP/1.1
Host: localhost:80
Accept: */*
{
  "account": "Aliquid nisi eveniet suscipit deserunt exercitationem sit.",
  "count": 426612369567945600,
  "date": "Consequuntur dolores.",
  "epoch_day": 687765621944930700,
  "rows": [
    {
      "account": "Consectetur ipsum.",
      "created": 6340797790707285000,
      "epoch_day": 5218527181147283000,
      "id": "Ut quae sit.",
      "org": "Sequi sit earum.",
      "parent_unique_id": "Eum omnis explicabo.",
      "project": "Eos similique.",
      "provisioner": "Id rem illum accusantium ut voluptate nisi.",
      "provisioner_version": "Placeat quidem velit explicabo.",
      "status": "success",
      "terragrunt_provider": true,
      "unique_key": "Numquam animi molestias vero praesentium sed.",
      "updated": 7534090311425261000,
      "workspace_id": "Dignissimos et beatae perferendis odio sint repudiandae.",
      "workspace_name": "Odit hic porro enim nostrum nostrum molestiae."
    },
    {
      "account": "Consectetur ipsum.",
      "created": 6340797790707285000,
      "epoch_day": 5218527181147283000,
      "id": "Ut quae sit.",
      "org": "Sequi sit earum.",
      "parent_unique_id": "Eum omnis explicabo.",
      "project": "Eos similique.",
      "provisioner": "Id rem illum accusantium ut voluptate nisi.",
      "provisioner_version": "Placeat quidem velit explicabo.",
      "status": "success",
      "terragrunt_provider": true,
      "unique_key": "Numquam animi molestias vero praesentium sed.",
      "updated": 7534090311425261000,
      "workspace_id": "Dignissimos et beatae perferendis odio sint repudiandae.",
      "workspace_name": "Odit hic porro enim nostrum nostrum molestiae."
    },
    {
      "account": "Consectetur ipsum.",
      "created": 6340797790707285000,
      "epoch_day": 5218527181147283000,
      "id": "Ut quae sit.",
      "org": "Sequi sit earum.",
      "parent_unique_id": "Eum omnis explicabo.",
      "project": "Eos similique.",
      "provisioner": "Id rem illum accusantium ut voluptate nisi.",
      "provisioner_version": "Placeat quidem velit explicabo.",
      "status": "success",
      "terragrunt_provider": true,
      "unique_key": "Numquam animi molestias vero praesentium sed.",
      "updated": 7534090311425261000,
      "workspace_id": "Dignissimos et beatae perferendis odio sint repudiandae.",
      "workspace_name": "Odit hic porro enim nostrum nostrum molestiae."
    }
  ],
  "total_count": 3342918160465369000
}

Replay flexi billing delivery

post

Enqueues Kafka delivery for one account, or the delivery sweep for all accounts. Delivery drains every open or failed row for an account regardless of day; date is validated but not used as a filter.

Body
accountstring · max: 128Optional

Optional account identifier; empty means all accounts.

Example: 7ls
datestringRequired

UTC calendar day to act on, in YYYY-MM-DD format; resolved to 00:00 UTC of that date. Must be a completed UTC day (before today).

Example: 2026-09-27
forcebooleanOptional

When an identical job is already queued (e.g. waiting out a retry), make it run immediately instead of leaving it.

Default: falseExample: true
Responses
202

Accepted response.

application/json

Result of a flexi billing trigger

accountstringOptional

Account the trigger targeted; empty means all accounts

Example: Cum deleniti et itaque consectetur modi.
datestringRequired

Requested day

Example: Voluptas eos omnis aut.
epoch_dayinteger · int64Required

Resolved 00:00 UTC Unix seconds for the date

Example: 4527392274086356000
job_idinteger · int64Required

River job acted on

Example: 2298437543349237800
job_statestringRequired

State of the River job after the trigger

Example: available
messagestringRequired

Human-readable summary

Example: Iste iste est eaque suscipit aut voluptate.
outcomestring · enumRequired

What happened to the job

Example: enqueuedPossible values:
post/api/flexi-billing/delivery
POST /api/flexi-billing/delivery HTTP/1.1
Host: localhost:80
Content-Type: application/json
Accept: */*
Content-Length: 50

{
  "account": "7ap",
  "date": "2026-09-27",
  "force": true
}
{
  "account": "Nihil blanditiis dolor dolor numquam consequuntur.",
  "date": "Eos blanditiis cum suscipit dolorem mollitia.",
  "epoch_day": 8687879576004123000,
  "job_id": 916622191622871700,
  "job_state": "available",
  "message": "Quidem molestiae ducimus amet.",
  "outcome": "enqueued"
}

Replay flexi billing discovery for a day

post

Enqueues discovery for one account, or the scheduler fan-out for all accounts, rebuilding flexi_billing_events_daily_runs from workspace_history as of the end of the given date (UTC). The date must be a completed UTC day (before today). Idempotent: delivered rows are preserved and missing rows are filled in.

Body
accountstring · max: 128Optional

Optional account identifier; empty means all accounts.

Example: vuy
datestringRequired

UTC calendar day to act on, in YYYY-MM-DD format; resolved to 00:00 UTC of that date. Must be a completed UTC day (before today).

Example: 2026-09-27
forcebooleanOptional

When an identical job is already queued (e.g. waiting out a retry), make it run immediately instead of leaving it.

Default: falseExample: true
Responses
202

Accepted response.

application/json

Result of a flexi billing trigger

accountstringOptional

Account the trigger targeted; empty means all accounts

Example: Cum deleniti et itaque consectetur modi.
datestringRequired

Requested day

Example: Voluptas eos omnis aut.
epoch_dayinteger · int64Required

Resolved 00:00 UTC Unix seconds for the date

Example: 4527392274086356000
job_idinteger · int64Required

River job acted on

Example: 2298437543349237800
job_statestringRequired

State of the River job after the trigger

Example: available
messagestringRequired

Human-readable summary

Example: Iste iste est eaque suscipit aut voluptate.
outcomestring · enumRequired

What happened to the job

Example: enqueuedPossible values:
post/api/flexi-billing/discovery
POST /api/flexi-billing/discovery HTTP/1.1
Host: localhost:80
Content-Type: application/json
Accept: */*
Content-Length: 50

{
  "account": "d42",
  "date": "2026-09-27",
  "force": true
}
{
  "account": "Et et.",
  "date": "Sit eaque id alias blanditiis impedit rerum.",
  "epoch_day": 3146444344596864500,
  "job_id": 5306704197148801000,
  "job_state": "available",
  "message": "Mollitia ab debitis veritatis commodi.",
  "outcome": "enqueued"
}

Last updated

Was this helpful?