Skip to content

Retrieve subscription history.

Method

GET https://papi.afi.ai/api/v1/orgs/{org_id}/licensing/subscriptions/history

Description

Returns historical usage for the organization's subscriptions over the requested period. If the licensed quantity changes during that period, the response includes multiple records for the same subscription.

Only post-pay subscriptions are included in the response.

Path params
org_id string required

ID of the organization whose subscription history to retrieve.

Query params
start date-time

Start of the reporting window. Use RFC 3339 format. The window must span 1 to 40 days.

end date-time

End of the reporting window. Use RFC 3339 format. Must be at least one hour before the current time.

curl -X GET \
    -H 'Authorization: {api-key}' \
    https://papi.afi.ai/api/v1/orgs/{org_id}/licensing/subscriptions/history

Successful response (200) schema
object

SubscriptionHistoryResult is the response to a subscription history request.

items array of objects
object

SubscriptionHistoryItem represents a time span during which the licensed subscription item quantity remains constant.

sub_id string

ID of the subscription.

tenant_id string

Tenant ID the subscription is assigned to.

start date-time

Start of the period. Use RFC 3339 format.

end date-time

End of the period. Use RFC 3339 format.

kind string

Subscription item kind (for example, resource, storage, node, virtual machine, or database).

qty int64

Number of licensed units for the item kind (for example, 10 resources or 5 additional storage licenses, each granting 100 GB of quota).

amount int64

Total amount, in cents, billed for this item during the corresponding interval. This amount can change if the pricing plan changes mid-billing period (before the invoice is issued).

Response example
{
  "items": [
    {
      "sub_id": "string",
      "tenant_id": "string",
      "start": "2025-11-19T20:02:49.311313Z",
      "end": "2025-11-19T20:02:49.311313Z",
      "kind": "string",
      "qty": "int64-as-string",
      "amount": "int64-as-string"
    }
  ]
}