Skip to main content

List the contract months of an ai hosting plan

GET/v2/customers/{customerId}/ai-hostings/{planId}/billing-periods
API version
v2
Request method
GET
Operation ID
ai-hosting-plan-get-billing-periods

Request​

  • customerIdstringrequired
  • planIdstring (uuid)required

Responses​

Format
application/json
Description

The plan's billing periods, oldest first.

  • customerIdstring (uuid)required
  • nextTokenResetstring (date-time)

    End of the current period, i.e. when the token counter next resets.

  • periodsarray of objectrequired

    Every contract month of the plan from its start up to the current one, anchored on the plan start date rather than the calendar.

    • Array[
      • *object
        • endstring (date-time)required
        • isCurrentbooleanrequired
        • shortenedByUpgradebooleanrequired

          True when an upgrade cut this period short: the token counter is reset immediately on an upgrade, so the period ends there instead of on the regular grid. A downgrade does not do this - it takes effect at the next regular boundary.

        • startstring (date-time)required
        • tokenLimitinteger (≥ 0, int64)required

          The limit that applied during this period, which after a tariff change differs from the plan's current limit.

      ]
  • planIdstring (uuid)required
Content-Type: application/json

{
"customerId": "f0f86186-0a5a-45b2-aa33-502777496347",
"nextTokenReset": "1985-10-26T01:21:00.000Z",
"periods": [
{
"end": "1985-10-26T01:21:00.000Z",
"isCurrent": true,
"shortenedByUpgrade": true,
"start": "1985-10-26T01:21:00.000Z",
"tokenLimit": 123
}
],
"planId": "f0f86186-0a5a-45b2-aa33-502777496347"
}
{
"properties": {
"customerId": {
"format": "uuid",
"type": "string"
},
"nextTokenReset": {
"description": "End of the current period, i.e. when the token counter next resets.",
"format": "date-time",
"type": "string"
},
"periods": {
"description": "Every contract month of the plan from its start up to the current one, anchored on the plan start date rather than the calendar.",
"items": {
"properties": {
"end": {
"format": "date-time",
"type": "string"
},
"isCurrent": {
"type": "boolean"
},
"shortenedByUpgrade": {
"description": "True when an upgrade cut this period short: the token counter is reset immediately on an upgrade, so the period ends there instead of on the regular grid. A downgrade does not do this - it takes effect at the next regular boundary.",
"type": "boolean"
},
"start": {
"format": "date-time",
"type": "string"
},
"tokenLimit": {
"description": "The limit that applied during this period, which after a tariff change differs from the plan's current limit.",
"format": "int64",
"minimum": 0,
"type": "integer"
}
},
"required": [
"start",
"end",
"tokenLimit",
"isCurrent",
"shortenedByUpgrade"
],
"type": "object"
},
"type": "array"
},
"planId": {
"format": "uuid",
"type": "string"
}
},
"required": [
"customerId",
"planId",
"periods"
],
"type": "object"
}

Usage examples​

$ curl \
--fail \
--location \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
https://api.mittwald.de/v2/customers/string/ai-hostings/f0f86186-0a5a-45b2-aa33-502777496347/billing-periods
import { MittwaldAPIV2Client } from "@mittwald/api-client";
import { assertStatus } from "@mittwald/api-client-commons";

const client = MittwaldAPIClient.newWithToken(process.env.MITTWALD_API_TOKEN);
const response = await client.aiHosting.aiHostingPlanGetBillingPeriods({
"customerId": "string",
"planId": "f0f86186-0a5a-45b2-aa33-502777496347"
});

assertStatus(response, 200);

use \Mittwald\ApiClient\Generated\V2\Clients\AIHosting\AiHostingPlanGetBillingPeriods\AiHostingPlanGetBillingPeriodsRequest;

$client = MittwaldAPIClient::newWithToken(getenv('MITTWALD_API_TOKEN'));

$request = (new AiHostingPlanGetBillingPeriodsRequest(
customerId: "string",
planId: "f0f86186-0a5a-45b2-aa33-502777496347"
));
$response = $client->aiHosting()->aiHostingPlanGetBillingPeriods($request);

var_dump($response->getBody();

On this page