{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cloudworldmodel-ai/json-schema/cloudworldmodel-ai-api-key-created-response-schema.json",
  "title": "ApiKeyCreatedResponse",
  "description": "Response returned when an API key is successfully created (either via admin POST /keys or via POST /keys/register)",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cloudworldmodel-ai-api-key-self-service-api-openapi.yml#/components/schemas/ApiKeyCreatedResponse",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier for the created API key"
    },
    "key": {
      "type": "string",
      "description": "The plain-text API key. Store this immediately — it is shown only once."
    },
    "keyPrefix": {
      "type": "string",
      "description": "Redacted prefix used to identify the key in listings"
    },
    "name": {
      "type": "string"
    },
    "scopes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "read",
          "write",
          "admin"
        ]
      }
    },
    "rateLimit": {
      "type": "integer"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "expiresAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "message": {
      "type": "string"
    }
  }
}