- API-Referenz
- AI hosting
- Creates a new key for a project
Creates a new key for a project
Creates a new key for a project. Same as the customer route but with required projectId. And project users can create it.
Request
- projectIdstringrequired
- createWebuiContainerboolean
- namestring (≥ 5 Zeichen)required
- planIdstring (≥ 1 Zeichen)required
Content-Type: application/json
{
"createWebuiContainer": true,
"name": "string",
"planId": "string"
}
{
"properties": {
"createWebuiContainer": {
"type": "boolean"
},
"name": {
"minLength": 5,
"type": "string"
},
"planId": {
"minLength": 1,
"type": "string"
}
},
"required": [
"name",
"planId"
],
"type": "object"
}
Responses
- containerMetaobject
- containerIdstring
- errorMessagestring
- ingressIdstring
- stackIdstring
- statusstring (einer von: created, requested, failed)required
- customerIdstringdeprecated
This Field is deprecated. Use the profileId field instead.
- isBlockedbooleanrequired
Indicates whether the key is blocked.
- keystringdeprecatedrequired
The secret API key. For security reasons we no longer want to keep exposing this value on every response — this field is deprecated and will stop returning the real key in a future change. It still returns the real value for now.
- keyIdstringrequired
Auto generated uuid to identify keys in requests.
- modelsArray von stringdeprecatedrequired
This Field is deprecated. You can find the allowed models in the /ai-hosting route.
- Array[
- *string
]
- namestringrequired
- planIdstringrequired
- profileIdstringrequired
- projectIdstring
- rateLimitobjectrequired
The number of allowed requests per unit. Limits are shared across all keys within the same project.
- allowedRequestsPerUnitintegerrequired
- unit"minute"required
- tokenUsageobjectrequired
- planLimitinteger (≥ -1, int64)required
- usedinteger (≥ 0, int64)required
Content-Type: application/json
{
"containerMeta": {
"containerId": "string",
"errorMessage": "string",
"ingressId": "string",
"stackId": "string",
"status": "created"
},
"isBlocked": true,
"keyId": "string",
"name": "string",
"planId": "string",
"profileId": "string",
"projectId": "string",
"rateLimit": {
"allowedRequestsPerUnit": 123,
"unit": "minute"
},
"tokenUsage": {
"planLimit": 123,
"used": 123
}
}
{
"properties": {
"containerMeta": {
"properties": {
"containerId": {
"type": "string"
},
"errorMessage": {
"type": "string"
},
"ingressId": {
"type": "string"
},
"stackId": {
"type": "string"
},
"status": {
"enum": [
"created",
"requested",
"failed"
],
"type": "string"
}
},
"required": [
"status"
],
"type": "object"
},
"customerId": {
"deprecated": true,
"description": "This Field is deprecated. Use the profileId field instead.",
"type": "string"
},
"isBlocked": {
"default": false,
"description": "Indicates whether the key is blocked.",
"type": "boolean"
},
"key": {
"deprecated": true,
"description": "The secret API key. For security reasons we no longer want to keep exposing this value on every response — this field is deprecated and will stop returning the real key in a future change. It still returns the real value for now.",
"type": "string"
},
"keyId": {
"description": "Auto generated uuid to identify keys in requests.",
"type": "string"
},
"models": {
"deprecated": true,
"description": "This Field is deprecated. You can find the allowed models in the /ai-hosting route.",
"items": {
"type": "string"
},
"type": "array"
},
"name": {
"type": "string"
},
"planId": {
"type": "string"
},
"profileId": {
"type": "string"
},
"projectId": {
"type": "string"
},
"rateLimit": {
"description": "The number of allowed requests per unit. Limits are shared across all keys within the same project.",
"properties": {
"allowedRequestsPerUnit": {
"type": "integer"
},
"unit": {
"enum": [
"minute"
],
"type": "string"
}
},
"required": [
"allowedRequestsPerUnit",
"unit"
],
"type": "object"
},
"tokenUsage": {
"properties": {
"planLimit": {
"format": "int64",
"minimum": -1,
"type": "integer"
},
"used": {
"format": "int64",
"minimum": 0,
"type": "integer"
}
},
"required": [
"used",
"planLimit"
],
"type": "object"
}
},
"required": [
"keyId",
"profileId",
"planId",
"key",
"models",
"name",
"isBlocked",
"tokenUsage",
"rateLimit"
],
"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"
}
}
}
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"
}
}
}
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"
}
}
}
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 \
-X POST \
-d '{"createWebuiContainer":true,"name":"string","planId":"string"}' \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
-H 'Content-Type: application/json' \
https://api.mittwald.de/v2/projects/string/ai-hosting-keys
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.aiHostingProjectCreateKey({
"projectId": "string",
"data": {
"createWebuiContainer": true,
"name": "string",
"planId": "string"
}
});
assertStatus(response, 201);
use \Mittwald\ApiClient\Generated\V2\Clients\AIHosting\AiHostingProjectCreateKey\AiHostingProjectCreateKeyRequest;
use \Mittwald\ApiClient\Generated\V2\Clients\AIHosting\AiHostingProjectCreateKey\AiHostingProjectCreateKeyRequestBody;
$client = MittwaldAPIClient::newWithToken(getenv('MITTWALD_API_TOKEN'));
// TODO: Please consult the properties and constructor signature of
// AiHostingProjectCreateKeyRequestBody to learn how to construct a valid instance
$body = new AiHostingProjectCreateKeyRequestBody(/* TODO: ... */);
$request = (new AiHostingProjectCreateKeyRequest(
projectId: "string",
body: $body
));
$response = $client->aiHosting()->aiHostingProjectCreateKey($request);
var_dump($response->getBody();