{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/timescale/main/json-schema/timescale-auth-info-schema.json",
  "title": "AuthInfo",
  "description": "Information about the authenticated caller.",
  "x-generated": "2026-10-13",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/timescale-auth-api-openapi.yml#/components/schemas/AuthInfo",
  "type": "object",
  "required": [
    "type"
  ],
  "properties": {
    "type": {
      "type": "string",
      "description": "Type of authentication used.",
      "enum": [
        "api_key",
        "user"
      ]
    },
    "api_key": {
      "$ref": "#/$defs/ApiKeyInfo"
    },
    "user": {
      "$ref": "#/$defs/UserInfo"
    }
  },
  "$defs": {
    "ApiKeyInfo": {
      "type": "object",
      "description": "Information about the API key used for authentication.",
      "required": [
        "prefix",
        "name",
        "created_at",
        "space_id",
        "space_name",
        "user_id",
        "user_email",
        "user_name"
      ],
      "properties": {
        "prefix": {
          "type": "string",
          "description": "Stable prefix identifier for the API key (starts with `gt_`), identifying the key without exposing the secret."
        },
        "name": {
          "type": "string",
          "description": "User-provided label for the API key."
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "description": "Time the API key was created."
        },
        "space_id": {
          "type": "string",
          "description": "Space the API key is scoped to."
        },
        "space_name": {
          "type": "string",
          "description": "Name of the space the API key is scoped to."
        },
        "user_id": {
          "type": "string",
          "description": "ID of the user who created the API key."
        },
        "user_email": {
          "type": "string",
          "description": "Email of the user who created the API key."
        },
        "user_name": {
          "type": "string",
          "description": "Name of the user who created the API key."
        }
      }
    },
    "UserInfo": {
      "type": "object",
      "description": "Authenticated user details.",
      "required": [
        "id",
        "email",
        "name"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "User ID."
        },
        "email": {
          "type": "string",
          "description": "User email address."
        },
        "name": {
          "type": "string",
          "description": "User's full name."
        }
      }
    }
  }
}