Metered Billing Proxy

These endpoints live on the main API server under /api/v1/proxy/metered-billing/marketplaces/*. Paths on this page are shown relative to the /api/v1 prefix. They proxy metered-usage reports and readiness probes to the underlying cloud metering APIs — AWS Marketplace Metering and GCP Service Control.

Authentication & authorization. All four endpoints require a site-admin token. Send it as Authorization: token <YOUR_TOKEN> (or as a token / access_token query parameter). Non-site-admin callers receive 403; unauthenticated callers receive 401.

Deployment gating. Each provider’s routes are registered only for the matching KubeDB Platform deployment type:

  • aws/*AWSMarketplaceDeployment
  • gcp/*GCPMarketplaceDeployment

On any other deployment the routes do not exist and requests return 404. Azure has no metering proxy wired up (Azure metering is handled via the webhook’s billingDetails.resourceUsageId on the subscription side instead).

Availability on this platform. The reference deployment (appscode) is a standard, non-marketplace install, so none of these routes are registered — the GET readiness probes below both returned 404. The endpoints are documented from the OpenAPI schema.


AWS metering

POST /proxy/metered-billing/marketplaces/aws/report-usage

Forward a usage report to the AWS Marketplace Metering MeterUsage API.

  • Auth: token, site-admin required.
  • Gated by: AWSMarketplaceDeployment.

Request body (MeterUsageInput):

{
  "DryRun": false,
  "ProductCode": "<aws-product-code>",
  "Timestamp": "2026-07-14T10:00:00Z",
  "UsageDimension": "nodes",
  "UsageQuantity": 3,
  "UsageAllocations": [
    {
      "AllocatedUsageQuantity": 3,
      "Tags": [
        { "Key": "cluster", "Value": "ace" }
      ]
    }
  ]
}
FieldTypeRequiredDescription
ProductCodestringyesAWS Marketplace product code.
Timestampstring (date-time)yesTimestamp of the metering record.
UsageDimensionstringyesThe metered dimension being reported.
DryRunbooleannoIf true, validate without recording usage.
UsageQuantityinteger (int64)noQuantity of the dimension consumed.
UsageAllocationsarray (UsageAllocation)noPer-bucket allocation of the usage.

UsageAllocation fields: AllocatedUsageQuantity (integer, required) and an optional Tags array of { "Key", "Value" } pairs.

Response — 200 (MeterUsageOutput):

{ "MeteringRecordId": "<metering-record-id>" }

Other statuses: 400 AWS rejected the request — e.g. customer not entitled, duplicate request, invalid product code, or throttling (AwsMeteringProxyErr body); 401 auth required; 403 site-admin required; 422 unprocessable body; 500 failed to report / unmapped AWS error code (AwsMeteringProxyErr).

AwsMeteringProxyErr shape:

{
  "code": "CustomerNotEntitledException",
  "message": "the customer is not entitled to the product",
  "origErr": {}
}

GET /proxy/metered-billing/marketplaces/aws/check/readiness

Readiness probe for the AWS metering proxy.

  • Auth: token, site-admin required.
  • Gated by: AWSMarketplaceDeployment.

Response: 200 proxy ready (empty body). 401 auth required; 403 site-admin required.

Example

curl -H "Authorization: token $AKP_TOKEN" \
  "https://<akp-host>/api/v1/proxy/metered-billing/marketplaces/aws/check/readiness?org=appscode"

Verified: returned 404 against appscode on 2026-07-14 — the AWS metering proxy route is not registered (this is not an AWSMarketplaceDeployment).


GCP metering

POST /proxy/metered-billing/marketplaces/gcp/report-usage

Forward a usage report to the GCP Service Control reporting API.

  • Auth: token, site-admin required.
  • Gated by: GCPMarketplaceDeployment.

Request body (GcpUsageReport):

{
  "name": "services/ace.endpoints.<project>.cloud.goog",
  "startTime": "2026-07-14T09:00:00Z",
  "endTime": "2026-07-14T10:00:00Z",
  "labels": { "cluster": "ace" },
  "value": { "int64Value": 3 },
  "dimension": "nodes",
  "serviceName": "ace.endpoints.<project>.cloud.goog"
}
FieldTypeDescription
namestringOperation / consumer resource name.
startTimestring (date-time)Start of the usage window.
endTimestring (date-time)End of the usage window.
labelsobject (string→string)Metric labels.
valueobject (GcpUsageValue)Usage value: int64Value and/or doubleValue.
dimensionstringThe metered dimension.
serviceNamestringGCP managed service name.

Response — 200: the GCP Service Control report response (an arbitrary Kubernetes-style / free-form object — passed through as-is).

Other statuses: 401 auth required; 403 site-admin required; 422 unprocessable body; 500 failed to report to GCP Service Control.

GET /proxy/metered-billing/marketplaces/gcp/check/readiness

Readiness probe for the GCP metering proxy.

  • Auth: token, site-admin required.
  • Gated by: GCPMarketplaceDeployment.

Response: 200 proxy ready (empty body). 401 auth required; 403 site-admin required.

Example

curl -H "Authorization: token $AKP_TOKEN" \
  "https://<akp-host>/api/v1/proxy/metered-billing/marketplaces/gcp/check/readiness?org=appscode"

Verified: returned 404 against appscode on 2026-07-14 — the GCP metering proxy route is not registered (this is not a GCPMarketplaceDeployment).