- API-Referenz
- AI hosting
- List the contract months of an ai hosting plan
List the contract months of an ai hosting plan
Request
- customerIdstringrequired
- planIdstring (uuid)required
Responses
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 von 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"
}
Validation Error caused by invalid input data in the request
- type"ValidationError"required
- messagestring
- validationErrorsArray von objectrequired
- Array[
- *object
- messagestringrequired
The standard error message
- pathstringrequired
The path to the part of the data that was validated. JavaScript property access notation (e.g., ".prop[1].subProp") is used.
- typestringrequired
ajv validation error type (e.g. "format", "required", "type") or own validation error types
- contextobject
The object with the additional information about the error that can be used to create custom error messages. Keys depend on the type that failed validation (e.g. "missingProperty" for type "required")
- *string
]
Content-Type: application/json
{
"type": "ValidationError",
"message": "Validation failed",
"validationErrors": [
{
"message": "should be string",
"path": ".address.street",
"type": "format",
"context": {
"format": "email"
}
}
]
}
{
"type": "object",
"required": [
"type",
"validationErrors"
],
"properties": {
"type": {
"type": "string",
"enum": [
"ValidationError"
]
},
"message": {
"type": "string",
"example": "Validation failed"
},
"validationErrors": {
"type": "array",
"items": {
"type": "object",
"required": [
"message",
"path",
"type"
],
"properties": {
"message": {
"type": "string",
"description": "The standard error message",
"example": "should be string"
},
"path": {
"type": "string",
"description": "The path to the part of the data that was validated. JavaScript property access notation (e.g., \".prop[1].subProp\") is used.\n",
"example": ".address.street"
},
"type": {
"type": "string",
"description": "ajv validation error type (e.g. \"format\", \"required\", \"type\") or own validation error types",
"example": "format"
},
"context": {
"type": "object",
"example": {
"format": "email"
},
"description": "The object with the additional information about the error that can be used to create custom error messages. Keys depend on the\ntype that failed validation (e.g. \"missingProperty\" for type \"required\")\n",
"additionalProperties": {
"type": "string"
}
}
}
}
}
}
}
An unexpected Error that occurred while handling the request
- messagestringrequired
- typestringrequired
Content-Type: application/json
{
"message": "Something went wrong",
"type": "InternalServerError"
}
{
"type": "object",
"required": [
"type",
"message"
],
"properties": {
"message": {
"type": "string",
"example": "Something went wrong"
},
"type": {
"type": "string",
"example": "InternalServerError"
}
}
}
The requested resource was not found
- messagestringrequired
- typestringrequired
Content-Type: application/json
{
"message": "Something went wrong",
"type": "InternalServerError"
}
{
"type": "object",
"required": [
"type",
"message"
],
"properties": {
"message": {
"type": "string",
"example": "Something went wrong"
},
"type": {
"type": "string",
"example": "InternalServerError"
}
}
}
Your request ran into a rate limit. You have to wait until rate limit expires
- messagestring
- typestring
Content-Type: application/json
{
"message": "too many requests",
"type": "RateLimitError"
}
{
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "too many requests"
},
"type": {
"type": "string",
"example": "RateLimitError"
}
}
}
An unexpected Error that occurred while handling the request
- messagestringrequired
- typestringrequired
Content-Type: application/json
{
"message": "Something went wrong",
"type": "InternalServerError"
}
{
"type": "object",
"required": [
"type",
"message"
],
"properties": {
"message": {
"type": "string",
"example": "Something went wrong"
},
"type": {
"type": "string",
"example": "InternalServerError"
}
}
}
Nutzungsbeispiele
$ 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();