Skip to content

API Reference

Base URL: http://localhost:8080 (configurable via api.host and api.port)

All endpoints except /health are prefixed with /api/v1.

General behavior

  • Authentication: None built-in. Use a reverse proxy for auth.
  • CORS: Configurable via api.enable_cors and api.cors_origins. Allowed methods: GET, POST, PATCH, DELETE.
  • Request timeout: Requests exceeding api.request_timeout_seconds (default 30, max 300) return HTTP 504.
  • Content type: JSON for API data. Export and Preview artifact endpoints return their declared CSV or manifest media type.

Pagination

List endpoints accept:

Parameter Type Default Constraints
page int 1 >= 1
page_size int 100 1–1000

Response includes: items, total, page, page_size, pages.

Date range defaults

When start_date / end_date are omitted on list endpoints, the API uses the tenant's configured lookback window. FOCUS Mapping Preview requires both dates.

Error responses

Status Meaning
400 Invalid parameters (bad filter, unknown column, etc.)
404 Tenant or resource not found
409 Pipeline already running (trigger endpoint)
504 Request timeout

Health & Readiness

GET /health

Lightweight liveness check.

Response: {"status": "ok", "version": "<version>"}

GET /api/v1/readiness

Per-tenant readiness with pipeline state. TTL-cached for 2 seconds.

Response fields:

Field Type Description
status string ready, initializing, no_data, or error
version string Package version
mode string Run mode (api, worker, both)
tenants list Per-tenant status (see below)

Per-tenant fields: tenant_name, tables_ready, has_data, pipeline_running, pipeline_stage, pipeline_current_date, last_run_status, last_run_at, permanent_failure, topic_attribution_status, topic_attribution_error, focus_preview_state, focus_preview_completed_repair_dates, focus_preview_total_repair_dates, focus_preview_message, focus_preview_ordinary_retention, and focus_preview_evidence_retention.

topic_attribution_status is one of "disabled" | "enabled" | "config_error". topic_attribution_error is a string describing the validation failure when topic_attribution_status is "config_error", otherwise null.

focus_preview_state is one of disabled, ready, upgrading, degraded, or unavailable:

State Meaning
disabled The tenant does not enable FOCUS Mapping Preview. Progress is null.
ready Preview is available and no repair or retention cause needs attention. Progress is null before the first repair and total/total after a successful repair.
upgrading A historical repair is queued or running. Existing valid Preview data remains available.
degraded Historical repair or retention cleanup needs attention. Existing valid Preview data remains available; use the repair progress and structured retention outcomes to choose the operator action.
unavailable Preview readiness cannot be determined safely, including unavailable Preview storage. Progress is null.

When repair work exists, the completed and total fields report Date progress. A completed date is durably terminal, whether it succeeded or failed. The ratio is lifecycle progress, not data volume or successful-row progress.

The two retention fields report the latest recorded attempt independently:

Field Cleanup represented
focus_preview_ordinary_retention Ordinary tenant pipeline and configured overlay retention
focus_preview_evidence_retention Preview source, readiness, allocation-lineage, and organization-authority retention

Each field is null before an outcome is available. Otherwise it contains attempted_at, status (success or failure), and diagnostic. A successful outcome has a null diagnostic. A failure includes a stable code, an operator-facing message, and a redacted error_type. A later successful attempt replaces only the matching cleanup outcome and clears its diagnostic; the other cleanup outcome and historical repair progress remain independent. Any recorded retention failure makes Preview degraded, including while a repair is queued, running, or already degraded.

Preview state does not change top-level application readiness or disable unrelated billing, chargeback, inventory, and pipeline operations. Existing valid Preview packages and revisions remain available while retention cleanup needs attention.


Tenants

GET /api/v1/tenants

List all configured tenants with summary pipeline state.

Response fields per tenant: tenant_name, tenant_id, ecosystem, dates_pending, dates_calculated, last_calculated_date, topic_attribution_status, topic_attribution_error.

topic_attribution_status is one of "disabled" | "enabled" | "config_error". See GET /api/v1/readiness above for field semantics.

GET /api/v1/tenants/{tenant_name}/status

Detailed per-date pipeline state for a tenant.

Parameter Type Required Description
start_date date no Filter from this date
end_date date no Filter to this date

Response: {tenant_name, tenant_id, ecosystem, topic_attribution_status, topic_attribution_error, states} where states is a list of {tracking_date, billing_gathered, resources_gathered, chargeback_calculated, topic_overlay_gathered, topic_attribution_calculated} per date. The topic_overlay_gathered and topic_attribution_calculated fields are false when topic attribution is disabled or in config_error state.

POST /api/v1/tenants/{tenant_name}/resource-links/resolve

Look up resource and identity metadata for identifiers within a tenant. The request body is:

{"identifiers":["env-a","lkc-a","user-a"]}

identifiers must contain 1–100 non-blank strings. The limit is checked before duplicate values are removed. Results are scoped to the named tenant and use two minimal maps:

{
  "resources": {
    "lkc-a": {
      "resource_type": "kafka_cluster",
      "parent_id": "env-a",
      "kafka_cluster_id": null
    }
  },
  "identities": {
    "user-a": {"identity_type": "user"}
  }
}

Unknown and deleted identifiers are omitted. Resource entries contain only resource_type, parent_id, and kafka_cluster_id; identity entries contain only identity_type. A matching identifier may appear in both maps.

Status Meaning
200 Maps of active resource and identity matches; missing matches are omitted
422 Malformed JSON; missing body or identifiers; a non-object top-level body; non-string, blank, empty, or more than 100 identifiers
404 The tenant is not configured
503 The storage backend provider is unavailable
500 Unexpected application or backend failure: {"detail":"Internal server error","error_id":"<uuid>"}

Billing

GET /api/v1/tenants/{tenant_name}/billing

List raw billing line items. Paginated.

Parameter Type Required Description
start_date date no Filter start
end_date date no Filter end
timezone string no IANA timezone for date boundaries (e.g. America/Denver). Defaults to UTC.
product_type string no Filter by product type
resource_id string no Filter by resource

Response fields per item: ecosystem, tenant_id, timestamp, resource_id, product_category, product_type, quantity, unit_price, total_cost, currency, granularity, metadata.


Chargebacks

GET /api/v1/tenants/{tenant_name}/chargebacks

List allocated chargeback rows. Paginated.

Parameter Type Required Description
start_date date no Filter start
end_date date no Filter end
timezone string no IANA timezone for date boundaries (e.g. America/Denver). Defaults to UTC.
identity_id string no Filter by identity
product_type string no Filter by product type
resource_id string no Filter by resource
cost_type string no Filter by cost type
tag_key string no Filter by tag key
tag_value string no Filter by tag value (requires tag_key)

Response fields per item: dimension_id, ecosystem, tenant_id, timestamp, resource_id, product_category, product_type, identity_id, cost_type, amount, allocation_method, allocation_detail, tags, metadata.

tags is a dict[str, str] mapping tag keys to tag values (e.g. {"team": "platform", "env": "prod"}). Tags are resolved at query time from the linked resource or identity.

GET /api/v1/tenants/{tenant_name}/chargebacks/{dimension_id}

Get a single chargeback dimension.

Response: Dimension fields (tags not resolved at this level — use /chargebacks list endpoint for tag-enriched rows).

GET /api/v1/tenants/{tenant_name}/chargebacks/dates

List all distinct dates with chargeback data.

Response: {"dates": ["2026-01-01", "2026-01-02", ...]}

GET /api/v1/tenants/{tenant_name}/chargebacks/allocation-issues

Aggregated view of failed or problematic allocations. Paginated. Same filters as chargebacks list.

Response fields per item: ecosystem, resource_id, product_type, identity_id, allocation_detail, row_count, usage_cost, shared_cost, total_cost.


Compare two cost periods

The comparison endpoints return a ranked view of one source across two explicit inclusive date ranges. They do not combine chargeback and Topic Attribution amounts.

GET /api/v1/tenants/{tenant_name}/chargebacks/comparison
GET /api/v1/tenants/{tenant_name}/topic-attributions/comparison

The chargebacks route reports Chargeback — allocated tenant costs. It can group by principal (identity_id), resource (resource_id), or environment (environment_id). Its filters are identity_id, product_type, resource_id, cost_type (usage or shared), tag_key, and tag_value.

The topic-attributions route reports Topic Attribution — attributed Kafka costs, not the full tenant bill. It can group by topic (a stable, cluster-scoped topic key with cluster and topic display fields) or cluster (cluster_resource_id). Its filters are cluster_resource_id, topic_name, product_type, attribution_method, tag_key, and tag_value.

Topic Attribution's cluster_resource_id and topic_name filters retain the existing list behavior and match containing values. Other source filter values are passed as exact values. Tag keys must start with an alphanumeric character, then contain only alphanumerics, _, or -, with a maximum length of 63.

Query parameters

Parameter Type Required Default / constraints
baseline_start date yes Inclusive baseline date.
baseline_end date yes Inclusive baseline date.
comparison_start date yes Inclusive comparison date.
comparison_end date yes Inclusive comparison date.
timezone string no IANA timezone for date boundaries; UTC when omitted.
group_by string no principal, resource, or environment for chargeback; topic or cluster for Topic Attribution. Defaults to principal or topic.
movement string no all, increase, or decrease; defaults to all. Zero changes appear only with all.
sort_by string no absolute_change, entity, baseline_amount, comparison_amount, change, or percentage_change; defaults to absolute_change.
sort_direction string no asc or desc; defaults to desc.
limit integer no Defaults to 100; must be between 1 and 500.
source filters string no See the source lists above. tag_value requires tag_key.

The Compare control offers row limits of 25, 50, 100, 250, and 500; API clients may request any value from 1 through 500.

The default order is absolute change descending, with the stable group key as the final ascending tie-breaker. Alternate sort fields use the same stable tie-breaker.

The API always receives the four dates explicitly. The Compare controls provide these presets for hourly and daily tenants:

  • Previous day: the day before yesterday as the baseline versus yesterday as the comparison.
  • Previous week: the prior Monday–Sunday week as the baseline versus the latest completed Monday–Sunday week as the comparison.
  • Calendar month: the preceding complete calendar month as the baseline versus the latest completed calendar month as the comparison.
  • Custom: two non-empty inclusive date ranges.

Named presets use the current calendar date in the selected IANA timezone. A timezone change recomputes a named preset and resolves custom dates at local midnight. The response shows the requested dates and the effective UTC bounds; daylight-saving changes can make two date ranges have different elapsed durations.

For monthly tenants, Compare uses UTC, offers Calendar month and Custom, and disables Previous day and Previous week. A custom monthly range must start on the first day of a UTC month and end on the last day of a UTC month. The API rejects a non-UTC timezone and partial UTC calendar months.

Response

Every monetary amount below is a JSON decimal string, including zero, negative values, and long fractional values. A non-null percentage_change is also a JSON decimal string; percentage_change may be null when the baseline is zero.

Field Description
source chargeback or topic_attribution.
granularity Tenant data granularity: hourly, daily, or monthly.
group_by The source-specific grouping used for the rows.
timezone The effective comparison timezone; monthly responses use UTC.
coverage_evaluated_at ISO 8601 UTC instant at which coverage was evaluated.
baseline, comparison Period objects described below.
unequal_durations true when the two resolved UTC durations differ. It does not reject or normalize the periods.
summary Full filtered-scope totals and movement values, independent of movement and limit.
reconciliation Counts and financial contributions for returned, movement-excluded, and top-N-omitted groups.
rows At most limit groups in the requested server-side order.

Each period contains start_date, end_date, start_at, end_at, duration_seconds, and coverage. start_date and end_date are the requested inclusive dates. start_at is the resolved UTC inclusive bound and end_at is the resolved UTC exclusive bound; both are ISO 8601 UTC datetimes.

coverage contains:

Field Description
status complete, incomplete, or unknown.
expected_dates Source dates expected for the period's granularity.
unknown_dates Dates whose source availability cannot be confirmed.
incomplete_dates Dates without complete source processing evidence.
retention_qualified_dates Dates where current evidence cannot distinguish unavailable retained data from a valid zero. This does not assert that data was deleted.
availability_cutoff_at The captured source retention cutoff, or null when a valid Topic Attribution policy cannot be established. Confluent Cloud and self-managed Kafka use their validated plugin policy, including defaults and explicit overrides.

unknown takes precedence when both unknown and incomplete dates exist. A successful chargeback calculation can confirm a zero total even when no rows match the filters. Topic Attribution requires unfiltered source-date evidence for the selected slots, so a filtered zero or an empty source slot remains qualified when that evidence is absent. The UI labels values from either non-complete period as observed totals and shows a short warning identifying the affected periods. Detailed coverage dates remain available in the API. For the built-in Kafka plugins, omitting topic_attribution.retention_days uses the plugin's default; it does not by itself make coverage unknown. Coverage is checked independently of topic and cluster filters: a filter with no matching costs can report complete when the underlying source dates are complete. Missing source records, unfinished processing, and periods outside the retention window remain qualified.

summary contains baseline_amount, comparison_amount, increases, decreases, net_change, and percentage_change. increases is the sum of positive row changes; decreases is the signed sum of negative row changes; net_change is the comparison total minus the baseline total. When the baseline total is exactly zero, percentage_change is null; the same rule applies to a row whose baseline amount is zero.

Each row contains key, kind, dimensions, baseline_amount, comparison_amount, change, percentage_change, baseline_row_count, comparison_row_count, and observed_presence. Presence is based on row presence, so a zero-valued row is retained. A row absent from a complete period can be described as cost only in the other period; an absent period with incomplete or unknown coverage is described as no cost observed.

reconciliation contains full_group_count, selected_group_count, returned_group_count, movement_excluded_group_count, and row_limit_omitted_group_count, plus baseline, comparison, and net amounts for each of the returned, movement-excluded, and row-limit-omitted groups. The amounts satisfy these identities independently for baseline, comparison, and net values:

full = returned + movement_excluded + row_limit_omitted
selected = returned + row_limit_omitted

A group count remains meaningful even when the corresponding omitted amounts cancel to zero. Unassigned and sentinel groups are included in these counts, but do not expose an investigation action.

Errors

Condition Status and response
Invalid date syntax, enum, source grouping, or limit bounds 422; FastAPI places the offending field at detail[0].loc = ["query", "<field>"].
Baseline or comparison start after its end 400, respectively baseline_start must be <= baseline_end or comparison_start must be <= comparison_end.
tag_value without tag_key 400, tag_value requires tag_key.
Invalid tag key format 400, Invalid tag key format: '<key>'.
Unknown IANA timezone 400, Unknown timezone: '<timezone>'.
Monthly request with a non-UTC timezone 400, timezone must be UTC for monthly comparison data.
Monthly baseline is not a complete UTC calendar-month range 400, baseline period must contain complete UTC calendar months for monthly comparison data.
Monthly comparison is not a complete UTC calendar-month range 400, comparison period must contain complete UTC calendar months for monthly comparison data.
Tenant is not configured 404, Tenant '<name>' not found.
Provider wiring is unavailable 503, Storage backend provider is unavailable.
Leased backend cannot provide a consistent comparison read 503, Storage backend does not support consistent comparison reads.
Provider initialization or another unhandled comparison failure 500, {"detail":"Internal server error","error_id":"<uuid>"}.
Request exceeds the configured API timeout 504, Request exceeded <seconds>s timeout.

Malformed query input is rejected before settings or storage work. For valid queries, date-order checks run before the tag dependency, timezone validation, and monthly alignment checks. Provider initialization failures keep the normal sanitized 500 response; qualified 200 results are possible only after storage has been acquired successfully.

Aggregation

GET /api/v1/tenants/{tenant_name}/chargebacks/aggregate

Multi-dimensional aggregation with time bucketing. Returns up to 10,000 buckets.

Parameter Type Default Description
group_by list[string] ["identity_id"] Columns or tag keys to group by (repeatable). Use tag:{key} for tag-based grouping.
time_bucket string day hour, day, week, or month
start_date date no Filter start
end_date date no Filter end
timezone string no IANA timezone for date boundaries (e.g. America/Denver). Defaults to UTC.
identity_id string no Filter by identity
product_type string no Filter by product type
resource_id string no Filter by resource
cost_type string no Filter by cost type
tag:{key} string no Filter to rows where the tag {key} matches the given value. Repeatable for AND semantics. Comma-separated values in a single param are OR-matched.

Valid group_by columns: identity_id, resource_id, product_type, product_category, cost_type, allocation_method, environment_id.

Tag-based grouping (group_by=tag:{key}):

Use tag: prefix to group by an entity tag key instead of a dimension column. Examples:

  • group_by=tag:owner — group by the owner tag; rows with no owner tag land in an UNTAGGED bucket.
  • group_by=tag:owner&group_by=tag:department — group by two tag keys; each bucket has both keys in dimensions.
  • group_by=tag:owner&group_by=product_type — mix tag and dimension grouping in one query.

Tag values are resolved by joining the entity_tags table. When a resource and its linked identity both carry the same tag key, the resource tag wins (mirrors the behavior on the list endpoint).

Tag-based filtering (tag:{key}={value}):

Dynamic query parameters prefixed tag: are treated as tag filters and are independent of group_by.

  • tag:department=eng — only rows where department tag equals eng.
  • tag:team=platform,commerce — team IN (platform, commerce) — comma-separated values are OR-matched within one key.
  • tag:owner=alice&tag:department=eng — multiple tag params are AND-matched across keys.
  • Untagged rows (no matching tag key) are excluded from filtered results.

Tag key format: must start with an alphanumeric character, then alphanumeric, _, or -, up to 63 characters total. Invalid keys return HTTP 400.

Response:

{
  "buckets": [
    {
      "dimensions": {"tag:owner": "team-commerce", "product_type": "kafka"},
      "time_bucket": "2026-01-01",
      "total_amount": "150.00",
      "usage_amount": "120.00",
      "shared_amount": "30.00",
      "row_count": 42
    },
    {
      "dimensions": {"tag:owner": "UNTAGGED", "product_type": "kafka"},
      "time_bucket": "2026-01-01",
      "total_amount": "30.00",
      "usage_amount": "30.00",
      "shared_amount": "0.00",
      "row_count": 8
    }
  ],
  "total_amount": "180.00",
  "usage_amount": "150.00",
  "shared_amount": "30.00",
  "total_rows": 50
}

Tag dimensions appear in dimensions with the tag: prefix (e.g. "tag:owner": "team-commerce"). usage_amount is cost attributed by actual usage metrics. shared_amount is cost split evenly.


Resources

GET /api/v1/tenants/{tenant_name}/resources

List discovered resources. Paginated. Supports three temporal query modes:

Parameter Type Default Description
resource_type string — Filter by type
status string — Filter by status (active or deleted)
active_at datetime — Resources active at this point in time
period_start + period_end datetime — Resources active during this period
search string — Case-insensitive substring match on resource_id and display_name
sort_by string — Column to sort by: resource_id, display_name, resource_type, status. Falls back to resource_id if invalid.
sort_order string asc Sort direction: asc or desc. Applied when no temporal params are set.
tag_key string — Filter to resources that have this tag key
tag_value string — Narrow tag_key filter to this value (requires tag_key)

search, sort_by, sort_order, tag_key, and tag_value apply only when no temporal params (active_at, period_start/period_end) are set.

If no temporal params: returns all resources. Cannot combine active_at with period_start/period_end.

Response fields per item: ecosystem, tenant_id, resource_id, resource_type, display_name, parent_id, owner_id, status, created_at, deleted_at, last_seen_at, metadata.


Identities

GET /api/v1/tenants/{tenant_name}/identities

List discovered identities. Paginated. Same temporal query modes as resources.

Parameter Type Default Description
identity_type string — Filter by type
active_at datetime — Identities active at this point
period_start + period_end datetime — Identities active during period
search string — Case-insensitive substring match on identity_id and display_name
sort_by string — Column to sort by: identity_id, display_name, identity_type. Falls back to identity_id if invalid.
sort_order string asc Sort direction: asc or desc. Applied when no temporal params are set.
tag_key string — Filter to identities that have this tag key
tag_value string — Narrow tag_key filter to this value (requires tag_key)

search, sort_by, sort_order, tag_key, and tag_value apply only when no temporal params are set.

Response fields per item: ecosystem, tenant_id, identity_id, identity_type, display_name, created_at, deleted_at, last_seen_at, metadata.


Inventory

GET /api/v1/tenants/{tenant_name}/inventory/summary

Counts of resources and identities grouped by type.

Response: {"resource_counts": {"cluster": {"total": 3, "active": 3, "deleted": 0}}, "identity_counts": {"service_account": {"total": 12, "active": 10, "deleted": 2}}}


Tags

Tags attach to entities (resources or identities) and propagate to chargeback rows at query time. entity_type must be "resource" or "identity".

GET /api/v1/tenants/{tenant_name}/entities/{entity_type}/{entity_id}/tags

List all tags on an entity.

Response: Array of tag objects with fields tag_id, tenant_id, entity_type, entity_id, tag_key, tag_value, created_by, created_at.

POST /api/v1/tenants/{tenant_name}/entities/{entity_type}/{entity_id}/tags

Create a tag on an entity. Returns 201. Returns 409 if a tag with the same key already exists on this entity.

Body: {"tag_key": "team", "tag_value": "platform", "created_by": "admin"}

PUT /api/v1/tenants/{tenant_name}/entities/{entity_type}/{entity_id}/tags/{tag_key}

Update a tag's value.

Body: {"tag_value": "new-value"}

DELETE /api/v1/tenants/{tenant_name}/entities/{entity_type}/{entity_id}/tags/{tag_key}

Delete a tag by key. Returns 204.

GET /api/v1/tenants/{tenant_name}/tags

List all tags for a tenant. Paginated.

Parameter Type Description
entity_type string Filter by entity type ("resource" or "identity")
tag_key string Filter by tag key
page int Page number (default 1)
page_size int Page size 1–1000 (default 100)

Response: {"items": [...], "total": N, "page": 1, "page_size": 100, "pages": N}

GET /api/v1/tenants/{tenant_name}/tags/keys

List distinct tag keys for a tenant, sorted alphabetically.

Parameter Type Description
entity_type string Filter by entity type ("resource" or "identity")

Response: {"keys": ["env", "team", "owner"]}

GET /api/v1/tenants/{tenant_name}/tags/keys/{tag_key}/values

List distinct values for a tag key, sorted alphabetically. Returns 400 if tag_key format is invalid.

Parameter Type Description
entity_type string Filter by entity type ("resource" or "identity")
q string Prefix filter for autocomplete (case-insensitive)

Response: {"values": ["prod", "staging"]}

POST /api/v1/tenants/{tenant_name}/tags/bulk

Bulk create/update tags on explicit entity IDs.

Body:

{
  "items": [
    {"entity_type": "resource", "entity_id": "cluster-1", "tag_key": "team", "tag_value": "platform"},
    {"entity_type": "identity", "entity_id": "sa-abc", "tag_key": "team", "tag_value": "data"}
  ],
  "created_by": "admin",
  "override_existing": false
}

Response: {"created_count": 2, "updated_count": 0, "skipped_count": 0}

When override_existing is true, existing tags with the same key are updated instead of skipped.

POST /api/v1/tenants/{tenant_name}/tags/bulk-by-filter

Bulk tag all unique resources/identities found in chargebacks matching the given filters. Resolves entities server-side.

Body:

{
  "start_date": "2026-01-01",
  "end_date": "2026-01-31",
  "timezone": "America/Denver",
  "identity_id": "sa-abc",
  "tag_key": "team",
  "display_name": "Platform",
  "created_by": "admin",
  "override_existing": false
}

display_name is stored as the tag value. identity_id narrows which chargebacks are scanned.

Response: {"created_count": 2, "updated_count": 0, "skipped_count": 0}


Pipeline

POST /api/v1/tenants/{tenant_name}/pipeline/run

Trigger a pipeline run for a tenant. Returns 202 (accepted).

Returns HTTP 409 if a run is already in progress. Requires both mode — API-only mode cannot trigger runs.

GET /api/v1/tenants/{tenant_name}/pipeline/status

Get latest pipeline run status.

Response:

{
  "tenant_name": "my-org",
  "is_running": false,
  "last_run": "2026-03-17T12:00:00Z",
  "last_result": {
    "dates_gathered": 5,
    "dates_calculated": 5,
    "chargeback_rows_written": 142,
    "errors": [],
    "completed_at": "2026-03-17T12:00:00Z"
  }
}

last_result is null if no completed or failed runs exist.


Export

POST /api/v1/tenants/{tenant_name}/export

Stream chargeback data as CSV. Returns text/csv with Content-Disposition: attachment.

Body:

{
  "columns": ["timestamp", "resource_id", "product_type", "identity_id", "amount"],
  "start_date": "2026-01-01",
  "end_date": "2026-01-31",
  "timezone": "America/Denver",
  "filters": {
    "identity_id": "sa-12345",
    "product_type": "KAFKA_NUM_CKU"
  }
}
Field Type Default Description
columns list[string] 9 default columns Columns to include
start_date date no Filter start
end_date date no Filter end
timezone string no IANA timezone for date boundaries (e.g. America/Denver). Defaults to UTC.
filters dict no Key-value filters (identity_id, product_type, resource_id, cost_type)

All available columns: ecosystem, tenant_id, timestamp, resource_id, product_category, product_type, identity_id, cost_type, amount, allocation_method, allocation_detail, tags, metadata.

The tags column is serialized as key=value;key=value pairs (e.g. team=platform;env=prod).

Default columns: timestamp, resource_id, product_category, product_type, identity_id, cost_type, amount, allocation_method, tags.


FOCUS Mapping Preview

FOCUS Mapping Preview is an asynchronous, Confluent Cloud-only API under /api/v1/tenants/{tenant_name}/focus-preview. Requested packages and monthly revisions read persisted calculation and source evidence. Historical repair is the only Preview operation that reacquires provider data and runs calculation.

The tenant must enable focus_preview for the requested interval. Disabled tenants receive HTTP 409 preview_commercial_profile_unavailable; unrelated billing, chargeback, and export endpoints remain available.

The API has no built-in authentication. Protect the complete Preview prefix with an authenticated reverse proxy or API gateway. For configuration and UI/CLI workflows, use FOCUS Mapping Preview. This section defines only the HTTP contract.

GET /api/v1/tenants/{tenant_name}/focus-preview/profile

Return static capability metadata for focus-1.4-preview-v1:

  • mapping_profile_version;
  • target_focus_version: "1.4";
  • conformance_status: "non_conforming";
  • ordered full_columns and summary_columns; and
  • ordered known_gaps, each containing code, description, and affected columns.

The current authority gaps are:

Code Description Affected columns
invoice_identity_unavailable Post-issuance invoice identity is unavailable. InvoiceDetailId, InvoiceId
provider_host_display_name_unavailable HostProviderName contains the raw provider cloud code, not a provider display name. HostProviderName
provider_region_display_name_unavailable Confluent inventory does not provide a distinct region display name. RegionName
derived_sku_identity_not_provider_authoritative SKU values are deterministic Chitragupta-derived evidence, not provider-issued identifiers. SkuId, SkuMeter, SkuPriceDetails, SkuPriceId, x_ChitraguptaSkuComponents

The endpoint validates tenant existence and the Confluent Cloud ecosystem but does not initialize Preview storage or workers.

POST /api/v1/tenants/{tenant_name}/focus-preview/repairs

Create an asynchronous historical repair. New repairs are accepted only in both mode.

{
  "start_date": "2026-01-01",
  "end_date": "2026-02-01"
}

Dates use inclusive-start/exclusive-end UTC semantics. The 1–364 date range must fit inside the tenant's commercial, acquisition, cutoff, and retention intervals and cannot include future dates.

A valid request returns HTTP 202, a Location header, and these operation fields: repair_id, tenant_name, start_date, end_date, status, created_at, nullable started_at, nullable completed_at, nullable diagnostic, and date-ordered dates. Operation status is queued, running, completed, completed_with_failures, or failed.

Each date contains tracking_date, status, and nullable started_at, completed_at, calculation_id, calculation_completed_at, rows_written, failure_stage, and diagnostic. Date status is queued, running, daily_validated, succeeded, or failed. Failure stage is retained_state, provider_source, calculation, evidence, preview_validation, or worker. daily_validated is nonterminal: Daily validation passed, but validation of the selected UTC month has not completed. Diagnostics contain code, message, retryable, and optional source_correlation_ids.

Repair reacquires billing data and runs the ordinary calculation for the selected tenant/date scope. It can replace billing, chargebacks, pipeline state, source evidence, and allocation lineage in that range. It creates no requested package or published revision.

Only one repair can be active per tenant. Process-wide repair admission uses preview.max_workers and preview.max_queued_repairs. A rejected capacity request creates no operation and is not retried automatically.

Condition Status Detail
Malformed, missing, or extra body field 422 FastAPI validation body
Unknown tenant 404 Tenant '<tenant_name>' not found
Unsupported ecosystem 400 FOCUS Mapping Preview currently supports only Confluent Cloud tenants
Disabled tenant 409 preview_commercial_profile_unavailable
Invalid or future range 400 focus_preview_repair_range_invalid or focus_preview_repair_future_range
Outside the eligible interval or over 364 dates 400 focus_preview_repair_range_ineligible
Worker unavailable 503 FOCUS Mapping Preview repair worker is unavailable
Storage unavailable 503 FOCUS Mapping Preview repair storage is unavailable
Repair already active 409 focus_preview_repair_in_progress
Tenant busy 409 focus_preview_repair_tenant_busy
Capacity full 429 focus_preview_repair_capacity_exhausted

GET /api/v1/tenants/{tenant_name}/focus-preview/repairs/{repair_id}

Return the same durable operation and complete per-date result list. GET is available in api and both modes for an enabled tenant and does not require a running repair worker. A missing repair or a repair owned by another tenant returns 404. Disabled tenants retain the normal 409 enablement boundary.

POST /api/v1/tenants/{tenant_name}/focus-preview/requests

Create a request. An admitted request returns HTTP 202 with a queued status document. Capacity admission follows tenant, ecosystem, input, enablement, and runtime validation.

The creation response requires target_focus_version: "1.4" and conformance_status: "non_conforming". The same fields remain present on every subsequent request status/detail representation and recent-request list item.

{
  "grain": "daily",
  "start_date": "2026-07-01",
  "end_date": "2026-08-01",
  "column_profile": "full"
}

Dates are UTC and use inclusive-start/exclusive-end semantics. The request must contain 1–31 days within the UTC calendar month containing start_date; the exclusive end may be the first day of the following month.

Monthly requests supply one exact ASCII YYYY-MM; public start/end dates are not accepted for Monthly submission:

{
  "grain": "monthly",
  "month": "2026-07",
  "column_profile": "summary"
}

column_profile defaults to full. Summary uses the fixed profile subset. Custom supplies columns, for example {"column_profile":"custom","columns":["BilledCost","ResourceId"]}. Supported names retain first-occurrence caller order; unknown and duplicate entries are logged and ignored. Full and Summary reject columns, and Custom rejects a selection with no supported Full-profile columns.

When the process-local global or per-tenant capacity limit is full, the submission returns HTTP 429:

{
  "detail": {
    "code": "preview_capacity_exhausted",
    "message": "FOCUS Mapping Preview generation capacity is exhausted.",
    "retryable": true
  }
}

No request ID or artifacts are created for this response. Clients, including chitragupta-preview, should wait and submit the request again; the CLI does not automatically retry a capacity rejection.

GET /api/v1/tenants/{tenant_name}/focus-preview/requests

Return recent requests newest first, including queued, running, ready, failed, and expired requests. Ordering is descending by the immutable (created_at, request_id) pair.

Query Default Constraints Meaning
limit 20 1–100 Maximum items returned.
cursor none Non-empty request ID Continue after the prior page's next_cursor.

The response is {"items":[...],"next_cursor":"..."}. Every item uses the request representation, including required target_focus_version: "1.4" and conformance_status: "non_conforming". next_cursor is null when no later page exists. A missing cursor and a cursor owned by another tenant both return 400 Preview request cursor is invalid.

GET /api/v1/tenants/{tenant_name}/focus-preview/requests/{request_id}

Return a tenant-scoped request. Lifecycle is queued, running, then ready or failed; a ready request becomes expired at its fixed cutoff.

The response fields are request_id, tenant_name, target_focus_version, conformance_status, grain, start_date, end_date, nullable month, column_profile, ordered effective_columns, status, created_at, nullable started_at, nullable completed_at, nullable expires_at, nullable diagnostic, nullable source_snapshot, and nullable package.

  • Queued and running requests have no diagnostic, source snapshot, or package.
  • Failed requests contain {code, message, retryable} and no package. Source failures may also contain source_correlation_ids: at most 20 sorted, unique, opaque src:v1:<64 lowercase hex> values.
  • Ready requests contain source coverage and package download metadata.
  • Expired requests retain their source snapshot and expiry but return package: null.

source_snapshot contains nullable calculation_timestamp, date-ordered calculation_coverage, nullable source_through, effective_coverage_start_date, effective_coverage_end_date, nullable evidence_through_date, nullable availability_cutoff_end_date, and nullable monthly_status. Each coverage entry contains tracking_date, calculation_id, calculation_completed_at, and nullable calculation_run_id. monthly_status is provisional, settled, or null.

A ready package contains manifest, ordered files, download_all_name, and download_all_url. The files include the data parts and metadata file. Each artifact includes name, media_type, size_bytes, sha256, optional order, and download_url. Storage paths and keys are never returned.

For package files, lifecycle, manifest authority, and consumer handling, see Package contents and lifecycle.

GET /api/v1/tenants/{tenant_name}/focus-preview/requests/{request_id}/manifest

Return the exact stored manifest.json bytes for a ready request.

GET /api/v1/tenants/{tenant_name}/focus-preview/requests/{request_id}/files/{file_name}

Return exact stored bytes for a file declared by a ready package. CSV files use text/csv; focus-metadata.json uses application/json.

GET /api/v1/tenants/{tenant_name}/focus-preview/requests/{request_id}/archive

Return application/zip named focus-mapping-preview-{request_id}.zip. The ZIP contains the manifest followed by its declared files.

Requested artifacts are available until expires_at, exactly seven days after ready publication. Artifact endpoints return 410 after expiry. See Package contents and lifecycle for the file and consumer contract.

Published monthly revisions

Periodic workers publish validated Settled Monthly Full revisions. A later material correction replaces the current revision; failed candidates leave it unchanged. Consumers replace superseded revisions and never aggregate them.

Publication behavior and consumer handling are documented in Published monthly revisions.

GET /api/v1/tenants/{tenant_name}/focus-preview/revisions/current

Return the current published revision for required query month=YYYY-MM. revision_id is optional on this metadata route and acts as a current-revision guard when supplied.

The response contains revision identity and month bounds, target_focus_version: "1.4", conformance_status: "non_conforming", monthly_status, published_at, nullable supersedes_revision_id, nullable superseded_by_revision_id, lifecycle, material_sha256, source_snapshot, validation, self_url, and package. The source snapshot reports calculation and source-through freshness, effective coverage, evidence-through date, availability cutoff, and Monthly status. The validation summary reports the mapping profile, source-record and output-row counts, zero mapping errors, and passed artifact integrity. Package metadata contains the manifest, ordered CSV files, final focus-metadata.json, and ZIP download URL. Every returned current-artifact URL includes both month and revision_id.

Current revision artifact endpoints

Endpoint Result
GET /revisions/current/manifest?month=YYYY-MM&revision_id=... Exact validated manifest.json bytes.
GET /revisions/current/files/{file_name}?month=YYYY-MM&revision_id=... Exact validated bytes for one declared CSV or metadata artifact.
GET /revisions/current/archive?month=YYYY-MM&revision_id=... application/zip stream named focus-mapping-preview-{month}-{revision_id}.zip.

The table paths are relative to the tenant Preview prefix. Artifact revision_id is required. Each request re-reads the current revision before delivery. If the guard no longer matches, the API returns:

{
  "detail": {
    "code": "focus_preview_current_changed",
    "message": "The current FOCUS Mapping Preview revision changed; fetch the current revision and retry.",
    "retryable": true
  }
}

Clients should fetch metadata, follow its URLs, and repeat that sequence after this 409 response.

GET /api/v1/tenants/{tenant_name}/focus-preview/revisions

List retained current and superseded revisions newest first for required query month=YYYY-MM.

Query Default Constraints Meaning
limit 20 1–100 Maximum revisions returned.
cursor none Non-empty revision ID Continue after the prior page's next_cursor.

The response is {"items":[...],"next_cursor":"...","replacement_semantics":"complete_replacement","consumer_action":"replace_do_not_aggregate"}. Each item contains the same target, conformance, lifecycle, freshness, validation, and replacement fields as revision detail plus detail_url, including required target_focus_version: "1.4" and conformance_status: "non_conforming". An unknown cursor, a cursor for a different tenant/month, or a revision that is no longer publicly retained returns 400 FOCUS Mapping Preview revision cursor is invalid.

GET /api/v1/tenants/{tenant_name}/focus-preview/revisions/{revision_id}

Return one publicly retained revision by immutable ID. Its manifest, individual file, and archive URLs address that revision directly and do not use a current-revision guard. A superseded revision therefore remains retrievable until the billing-scope retention cutoff removes its month from public history. The retained detail uses the same required target_focus_version: "1.4" and conformance_status: "non_conforming" fields as current revision detail and revision list items.

Retained revision artifact endpoints

Endpoint Result
GET /revisions/{revision_id}/manifest Exact validated manifest.json bytes.
GET /revisions/{revision_id}/files/{file_name} Exact validated bytes for one declared CSV or metadata artifact.
GET /revisions/{revision_id}/archive application/zip stream named focus-mapping-preview-{month}-{revision_id}.zip.

All revision list/detail responses state replacement_semantics: complete_replacement and consumer_action: replace_do_not_aggregate. Consumers must replace the prior monthly revision; adding current and superseded revisions would double-count the report.

Condition Status Detail
Missing required month or artifact revision_id 422 FastAPI missing-field response
Invalid or unrepresentable month 400 month must use YYYY-MM
No current revision for this tenant/month 404 Current FOCUS Mapping Preview revision not found
Unknown file on the matching current revision 404 FOCUS Mapping Preview file not found for current revision
Guard differs from the current revision 409 focus_preview_current_changed retry response shown above
Invalid or foreign revision-history cursor 400 FOCUS Mapping Preview revision cursor is invalid
Direct revision absent, foreign, or pending retention cleanup 404 FOCUS Mapping Preview revision not found
Unknown file on a direct revision 404 FOCUS Mapping Preview file not found for revision
Stored revision artifact is missing, corrupt, or inconsistent 500 Stored FOCUS Mapping Preview revision artifact is unavailable
Revision service is unavailable 503 FOCUS Mapping Preview revision service is unavailable
Revision storage is unavailable 503 FOCUS Mapping Preview revision storage is unavailable

Preview errors

Condition Status Detail
Invalid JSON, date, grain, or profile 422 FastAPI validation body
Unknown tenant 404 Tenant '<tenant_name>' not found
Non-Confluent Cloud tenant 400 FOCUS Mapping Preview currently supports only Confluent Cloud tenants
Tenant has no focus_preview block 409 {"code":"preview_commercial_profile_unavailable","message":"An explicit Direct-billed PAYG profile does not cover the requested interval.","retryable":false}
Start is not before end 400 start_date must be before end_date
Range crosses the allowed UTC month 400 Daily preview range must stay within one UTC calendar month
Invalid or unrepresentable Monthly value 400 month must use YYYY-MM
columns supplied for Full or Summary 400 columns may be supplied only when column_profile is custom
Custom has no supported columns 400 Custom column selection must contain at least one supported Full-profile column
Runtime unavailable 503 FOCUS Mapping Preview runtime is unavailable
Generation capacity exhausted 429 {"code":"preview_capacity_exhausted","message":"FOCUS Mapping Preview generation capacity is exhausted.","retryable":true}
Storage unavailable 503 FOCUS Mapping Preview storage is unavailable
Recovery unavailable 503 FOCUS Mapping Preview recovery is unavailable
Worker scheduling unavailable 503 FOCUS Mapping Preview worker is unavailable
Invalid or foreign recent-list cursor 400 Preview request cursor is invalid
Request absent or owned by another tenant 404 Preview request '<request_id>' not found
Manifest/file/archive requested before ready or after failure 409 Status-specific not-ready detail
Manifest/file/archive requested after expiry 410 Preview request '<request_id>' expired at <UTC timestamp>
File not enumerated by a ready package 404 File-specific not-found detail
Stored bytes unavailable 500 Stored preview artifact is unavailable

The recovery 503 is retryable operationally after restoring tenant database and artifact-root availability. Existing ready packages and revisions remain available when their stored data can still be verified.

A generation whose temporary disk use would exceed preview.max_generation_spool_bytes terminates as a failed request with diagnostic.code: preview_generation_spool_limit_exceeded, diagnostic.message: FOCUS Mapping Preview package exceeds the configured generation spool limit., and retryable: false. It publishes no package. Scheduled publication logs the same diagnostic code, publishes no revision, and leaves the current revision unchanged.

If preview.max_csv_file_bytes cannot fit the repeated header and one complete row, generation fails with diagnostic code preview_csv_row_exceeds_file_size_limit, message A Preview CSV header or row exceeds the configured file-size limit., and retryable: false. Increase the part limit or set it to null; see Preview CSV part sizing.

Calculation diagnostics use these exact public meanings. Daily diagnostics apply to the requested interval; Monthly diagnostics apply to the effective evidence interval.

Code Retryable Message
calculation_metadata_unavailable false One or more requested dates lack preview calculation metadata.
calculation_before_acquisition_lookback false Required retained calculation evidence is unavailable outside the current acquisition window.
calculation_pending_cutoff_window true One or more requested dates are still inside the configured acquisition cutoff window; wait for the dates to enter the acquisition window, run the pipeline, and retry.
calculation_unavailable true No successful persisted calculation is available for the requested dates; run the pipeline and retry.
calculation_coverage_incomplete true No successful persisted calculation covers every requested date; run the pipeline and retry.

Eligibility and source diagnostics are:

An ordinary nonblank line type that is not in the current mapping table does not produce a failure diagnostic by itself. It maps to Usage / Usage-Based when all other evidence is complete and valid. Recognized native products reuse their current service mapping; unknown native products use the FOCUS Other taxonomy with the exact native product as ServiceName. Existing Support, promotional-credit, refund, correction, contradiction, malformed record, provider-context, lineage, and reconciliation checks retain precedence.

Code Retryable Meaning
preview_commercial_profile_unavailable false The optional tenant block is absent or its Direct-billed PAYG effective interval does not contain the request.
preview_billing_currency_unsupported false The configured or selected currency is not USD. Preview performs no currency conversion.
preview_billing_currency_unknown false Selected persisted aggregate currency evidence is blank.
preview_source_record_malformed false Persisted provider source evidence is malformed.
preview_source_scope_unsupported false Source evidence is not fully contained in the effective Daily or Monthly evidence interval.
preview_charge_classification_ambiguous false Credit/refund/adjustment/correction-like semantics are not authoritative.
preview_source_line_type_unknown false A source record has a missing or blank native line type.
preview_source_mapping_unavailable false A known line type lacks required mapping evidence, such as a returned unit for KAFKA_STREAMS.
preview_source_record_incomplete false Required Preview evidence is absent.
preview_evidence_storage_unavailable false Enabled Preview evidence storage or its schema is unavailable. Generic chargeback storage remains usable.
preview_source_evidence_unavailable true The newest persisted source-evidence attempt is unavailable or does not cover the requested interval. Run the pipeline and retry.
preview_source_economics_unsupported false Monetary or quantity values are outside the supported tracer.
preview_source_reconciliation_failed false Source, aggregate, or allocation evidence does not reconcile.
preview_source_coverage_incomplete false Complete source and aggregate origin coverage does not match.
preview_mapping_scope_unsupported false The complete source set exceeds the current Full-row mapping scope before profile projection, including multiple native/tier Cost rows associated with one billing origin.
preview_allocation_lineage_incomplete false Persisted calculation lineage is missing, incomplete, corrupt, or structurally inconsistent for one or more billing origins.
preview_allocation_lineage_unavailable true The ordinary calculation completed, but its Preview lineage capture or persistence did not. Run the pipeline and retry.
preview_billing_account_unavailable false No authoritative persisted Confluent organization binding is available.
preview_billing_account_conflicting false Persisted Confluent organization evidence conflicts for the tenant partition.
preview_provider_context_incomplete false Authoritative resource context is absent or incompatible; all TABLEFLOW rows use this failure because current inventory cannot prove their provider context.
preview_mapping_validation_failed false A generated Daily Full row or Monthly Full aggregate does not satisfy the current Full-row mapping profile before Full/Summary/Custom projection.

Fallback-mapped line types still use persisted allocation results; Preview does not recalculate them. Missing lineage returns preview_allocation_lineage_incomplete, and reconciliation differences return preview_source_reconciliation_failed. These failures expose no package.

lookback_days defines acquisition eligibility, not retention or guaranteed reconstruction. Use historical repair only while the required provider and metrics history remains available.


Topic Attributions

Topic attribution rows are produced by the optional topic_overlay pipeline stage (Confluent Cloud only). Each row represents the cost portion attributed to one topic for one billing line item. Requires topic_attribution.enabled: true in plugin settings. For a two-period ranked comparison, use the topic-attributions comparison endpoint.

GET /api/v1/tenants/{tenant_name}/topic-attributions

List topic attribution rows. Paginated.

Parameter Type Required Description
start_date date no Filter start
end_date date no Filter end
timezone string no IANA timezone for date boundaries. Defaults to UTC.
cluster_resource_id string no Filter by cluster (e.g. lkc-abc123)
topic_name string no Filter by topic name
product_type string no Filter by product type
attribution_method string no Filter by method (bytes_ratio, retained_bytes_ratio, even_split)
tag_key string no Filter by tag key (exact match)
tag_value string no Filter by tag value (requires tag_key, exact match)
page int no Page number (default 1)
page_size int no Page size 1–1000 (default 100)

Response fields per item: dimension_id, ecosystem, tenant_id, timestamp, env_id, cluster_resource_id, topic_name, product_category, product_type, attribution_method, amount.

GET /api/v1/tenants/{tenant_name}/topic-attributions/aggregate

Multi-dimensional aggregation of topic attribution rows.

Parameter Type Default Description
group_by list[string] ["topic_name"] Columns or tag keys to group by (repeatable). Use tag:{key} for tag-based grouping.
time_bucket string day hour, day, week, or month
start_date date no Filter start
end_date date no Filter end
timezone string no IANA timezone for date boundaries. Defaults to UTC.
cluster_resource_id string no Filter by cluster
topic_name string no Filter by topic
product_type string no Filter by product type
tag:{key} string no Filter to rows where the tag {key} matches the given value. Repeatable for AND semantics. Comma-separated values in a single param are OR-matched.

Valid group_by columns: topic_name, cluster_resource_id, env_id, product_type, product_category, attribution_method. Invalid dimension names are silently dropped (no 400).

Tag-based grouping (group_by=tag:{key}):

Use tag: prefix to group by a resource tag key instead of a dimension column. Examples:

  • group_by=tag:owner — group by the owner tag; rows with no owner tag land in an UNTAGGED bucket.
  • group_by=tag:owner&group_by=tag:department — group by two tag keys; each bucket has both keys in dimensions.
  • group_by=tag:owner&group_by=topic_name — mix tag and dimension grouping in one query.

Topic attribution is resource-only — tags are resolved from the resource entity (cluster_resource_id:topic:topic_name) only. There is no identity join and no resource/identity precedence rule.

Tag-based filtering (tag:{key}={value}):

Dynamic query parameters prefixed tag: are treated as tag filters and are independent of group_by.

  • tag:department=eng — only rows where the resource's department tag equals eng.
  • tag:team=platform,commerce — team IN (platform, commerce) — comma-separated values are OR-matched within one key.
  • tag:owner=alice&tag:department=eng — multiple tag params are AND-matched across keys.
  • Untagged rows (no matching tag key on the resource) are excluded from filtered results.

Tag key format: must start with an alphanumeric character, then alphanumeric, _, or -, up to 63 characters total. Invalid keys return HTTP 400.

Response:

{
  "buckets": [
    {
      "dimensions": {"tag:owner": "alice", "topic_name": "payments-events"},
      "time_bucket": "2026-01-01",
      "total_amount": "10.00",
      "row_count": 1
    },
    {
      "dimensions": {"tag:owner": "UNTAGGED", "topic_name": "untagged-events"},
      "time_bucket": "2026-01-01",
      "total_amount": "25.00",
      "row_count": 1
    }
  ],
  "total_amount": "35.00",
  "total_rows": 2
}

Tag dimensions appear in dimensions with the tag: prefix (e.g. "tag:owner": "alice"). Rows with no matching tag appear under "UNTAGGED".

GET /api/v1/tenants/{tenant_name}/topic-attributions/dates

List distinct dates for which topic attribution rows exist.

Response: {"dates": ["2026-01-01", "2026-01-02", ...]}

POST /api/v1/tenants/{tenant_name}/topic-attributions/export

Stream topic attribution data as CSV. Returns text/csv with Content-Disposition: attachment; filename=topic_attributions.csv.

Parameter Type Required Description
start_date date no Filter start
end_date date no Filter end
timezone string no IANA timezone for date boundaries. Defaults to UTC.

CSV columns: ecosystem, tenant_id, timestamp, env_id, cluster_resource_id, topic_name, product_category, product_type, attribution_method, amount.


Graph

Returns cost topology as a graph (nodes + edges) for use by the cost explorer graph frontend. One endpoint covers three views depending on the focus parameter.

GET /api/v1/tenants/{tenant_name}/graph

Return a neighborhood of nodes and directed edges centred on a focus entity.

Parameter Type Default Description
focus string — Entity ID to focus on. Omit for root (tenant) view.
depth int 1 Hierarchy hops from focus (1–3).
at datetime now Point-in-time lifecycle filter (ISO 8601 with timezone, e.g. 2026-03-15T00:00:00Z).
start_date date — Cost period start date. Overrides at-derived month when provided.
end_date date — Cost period end date. Overrides at-derived month when provided.
timezone string UTC IANA timezone for start_date/end_date boundaries.

Views:

  • Root view (focus omitted): returns a synthetic tenant node plus active environments and clusters without a parent. Confluent Cloud clusters remain under their environments; self-managed Kafka clusters appear directly under the tenant. Edges are parent type, directed tenant → resource. The tenant cost is the sum of these resource costs.
  • Environment focus (focus=env-abc): returns the environment node plus all direct child resources up to depth hops (clusters, connectors, flink pools, schema registries). Edges are parent type, directed parent → child.
  • Cluster focus (focus=lkc-abc): returns the cluster node, its child topic nodes, and any identity (service account / pool) nodes charged to the cluster via chargeback. Edges are parent (cluster → topic) and charge (cluster → identity).

Billing period: when start_date/end_date are omitted, the cost window defaults to the full calendar month containing at (e.g. at=2026-03-15 → March 1–April 1).

Response: GraphResponse

{
  "nodes": [
    {
      "id": "env-abc",
      "resource_type": "environment",
      "display_name": "Production",
      "cost": "1234.56",
      "created_at": "2025-01-01T00:00:00Z",
      "deleted_at": null,
      "tags": {"team": "platform"},
      "parent_id": null,
      "cloud": "aws",
      "region": "us-east-1",
      "status": "active",
      "cross_references": []
    }
  ],
  "edges": [
    {
      "source": "org-123",
      "target": "env-abc",
      "relationship_type": "parent",
      "cost": null
    }
  ]
}

Node fields:

Field Type Description
id string Entity ID (resource_id or identity_id)
resource_type string Entity type: tenant, environment, kafka_cluster, kafka_topic, service_account, etc.
display_name string|null Human-readable name
cost decimal string Aggregated cost for the billing period
created_at datetime|null Lifecycle start
deleted_at datetime|null Lifecycle end (null = still active)
tags object Tag key→value dict resolved from entity_tags
parent_id string|null Parent entity ID
cloud string|null Cloud provider
region string|null Cloud region
status string active or deleted
cross_references list[CrossReferenceGroup] For identity nodes: other resources this identity is charged in (excluding the focus cluster), grouped by resource type. Each group has resource_type (string), total_count (int, full DB count before cap), and items (list of up to 5 CrossReferenceItem objects sorted by cost descending). Each item has id, resource_type, display_name (string|null), and cost (decimal string).

Edge relationship_type values: parent (hierarchy), charge (identity charged to cluster).

Error codes: 400 (tz-naive at value), 404 (unknown tenant or unknown focus entity), 422 (unparseable parameters).

GET /api/v1/tenants/{tenant_name}/graph/search

Search resources and identities by partial name or ID match. Intended for the jump-to-entity feature in the cost explorer graph frontend.

Parameter Type Required Description
q string yes Case-insensitive partial match against resource_id, display_name, and identity_id. Minimum length 1.

Results are ordered by relevance: exact match first, then prefix match, then substring match. Returns at most 20 results. Returns an empty list when no entities match (never 404).

Response: GraphSearchResponse

{
  "results": [
    {
      "id": "lkc-abc123",
      "resource_type": "kafka_cluster",
      "display_name": "Production Cluster",
      "parent_id": "env-abc",
      "parent_display_name": "Production Environment",
      "status": "active"
    }
  ]
}

Result fields:

Field Type Description
id string Entity ID (resource_id for resources, identity_id for identities)
resource_type string resource_type for resources; identity_type for identities (e.g. service_account)
display_name string|null Human-readable name
parent_id string|null Parent entity ID. Always null for identity results (identities have no parent in the graph model)
parent_display_name string|null Human-readable name of the parent entity. null when parent has no display name or result has no parent
status string active or deleted

Error codes: 404 (unknown tenant), 422 (missing or empty q).

GET /api/v1/tenants/{tenant_name}/graph/diff

Compare costs between two time periods for a neighborhood. Returns a flat list of nodes annotated with before/after costs and a diff status, enabling the "what changed?" view in the cost explorer.

Parameter Type Required Description
from_start date yes Start of the "before" period (inclusive).
from_end date yes End of the "before" period (inclusive).
to_start date yes Start of the "after" period (inclusive).
to_end date yes End of the "after" period (inclusive).
focus string no Entity ID to focus on. Omit for root (tenant/environment) view.
depth int no (default 1) Hierarchy hops from focus (1–3).
timezone string no IANA timezone for date boundaries. Defaults to UTC.

Response: GraphDiffResponse

{
  "nodes": [
    {
      "id": "lkc-abc123",
      "resource_type": "kafka_cluster",
      "display_name": "Production Cluster",
      "parent_id": "env-abc",
      "cost_before": "100.00",
      "cost_after": "150.00",
      "cost_delta": "50.00",
      "pct_change": "50.00",
      "status": "changed"
    }
  ]
}

Node fields:

Field Type Description
id string Entity ID
resource_type string Entity type
display_name string|null Human-readable name
parent_id string|null Parent entity ID
cost_before decimal string Total cost in the "before" window. "0" for new entities.
cost_after decimal string Total cost in the "after" window. "0" for deleted entities.
cost_delta decimal string cost_after - cost_before. Negative means cost decreased.
pct_change decimal string|null Percentage change: (cost_delta / cost_before) * 100. null when cost_before == 0.
status string new (only in after), deleted (only in before), changed (in both, cost differs), unchanged (in both, cost equal)

Error codes: 404 (unknown tenant or unknown focus entity), 422 (missing date parameters).

GET /api/v1/tenants/{tenant_name}/graph/timeline

Return a daily cost time series for a single entity. Enables sparklines and cost-over-time drill-down in the cost explorer graph frontend without leaving the graph view.

Parameter Type Required Description
entity_id string yes resource_id or identity_id of the entity.
start date yes Start date (inclusive).
end date yes End date (inclusive).
timezone string no IANA timezone for date boundaries. Defaults to UTC.

Entity type routing: topics use topic_attribution_facts; environments use chargeback_facts grouped by env_id; all other resources use chargeback_facts grouped by resource_id; identities use chargeback_facts filtered by identity_id.

Every calendar day in [start, end] is present in the response. Days with no billing data are returned with cost: "0" (gap filling).

Response: GraphTimelineResponse

{
  "entity_id": "lkc-abc123",
  "points": [
    {"date": "2026-04-01", "cost": "12.34"},
    {"date": "2026-04-02", "cost": "0"},
    {"date": "2026-04-03", "cost": "15.00"}
  ]
}

Point fields:

Field Type Description
date date string Calendar date in YYYY-MM-DD format
cost decimal string Total cost on that day. "0" for days with no billing data.

Error codes: 404 (unknown tenant or entity_id not found in resources or identities), 422 (missing required parameters).