{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/teliax/json-schema/teliax-internal-handlers-apikey-with-scopes-response-schema.json",
  "title": "internal_handlers.APIKeyWithScopesResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/teliax-customer-apikeys-api-openapi.yml#/components/schemas/internal_handlers.APIKeyWithScopesResponse",
  "type": "object",
  "properties": {
    "key": {
      "$ref": "#/$defs/github_com_ringer-warp_api-gateway_internal_models.APIKey"
    },
    "scopes": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "$defs": {
    "github_com_ringer-warp_api-gateway_internal_models.APIKey": {
      "type": "object",
      "properties": {
        "allowed_ips": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/net.IPNet"
          }
        },
        "created_at": {
          "type": "string"
        },
        "created_by_user_id": {
          "type": "string"
        },
        "customer_id": {
          "type": "string"
        },
        "environment": {
          "$ref": "#/$defs/github_com_ringer-warp_api-gateway_internal_models.KeyEnvironment"
        },
        "expires_at": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "key_prefix": {
          "type": "string"
        },
        "last_used_at": {
          "type": "string"
        },
        "last_used_ip": {
          "type": "array",
          "items": {
            "type": "integer"
          }
        },
        "name": {
          "type": "string"
        },
        "rate_limit_per_min": {
          "type": "integer"
        },
        "revoke_reason": {
          "type": "string"
        },
        "revoked_at": {
          "type": "string"
        },
        "revoked_by": {
          "type": "string"
        },
        "scopes": {
          "description": "Scopes is a transient field (not a column) populated from auth.role/scope\njoins by the list handler so the API contract always carries the key's\ngranted scopes. No omitempty: an empty grant must serialize as [].",
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "github_com_ringer-warp_api-gateway_internal_models.KeyEnvironment": {
      "type": "string",
      "enum": [
        "live",
        "test"
      ],
      "x-enum-varnames": [
        "KeyEnvironmentLive",
        "KeyEnvironmentTest"
      ]
    },
    "net.IPNet": {
      "type": "object",
      "properties": {
        "ip": {
          "description": "network number",
          "type": "array",
          "items": {
            "type": "integer"
          }
        },
        "mask": {
          "description": "network mask",
          "type": "array",
          "items": {
            "type": "integer"
          }
        }
      }
    }
  }
}