{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/permtracker-app/json-schema/permtracker-app-me-schema.json",
  "title": "Me",
  "description": "Your key, its plan, the limits and what you've used.",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/permtracker-app-openapi.json#/components/schemas/Me",
  "type": "object",
  "properties": {
    "key": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "The key's id (never the key itself)."
        },
        "sandbox": {
          "type": "boolean",
          "description": "True for a pt_test_ key, which answers sample data."
        },
        "scopes": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "What the key may do beyond reading public records."
        },
        "expiresAt": {
          "description": "When the key expires, ISO 8601, or null for no expiry.",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "id",
        "sandbox",
        "scopes",
        "expiresAt"
      ],
      "additionalProperties": {},
      "description": "The key that made the call."
    },
    "plan": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "The plan's id, e.g. free or plus."
        },
        "name": {
          "type": "string",
          "description": "The plan's name."
        },
        "perMinute": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "Calls a minute."
        },
        "perDay": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "Calls a day."
        },
        "perMonth": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "Calls a month."
        }
      },
      "required": [
        "id",
        "name",
        "perMinute",
        "perDay",
        "perMonth"
      ],
      "additionalProperties": {},
      "description": "The plan whose limits apply to this key, with every limit."
    },
    "accountPlan": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "The plan's id."
        },
        "name": {
          "type": "string",
          "description": "The plan's name."
        }
      },
      "required": [
        "id",
        "name"
      ],
      "additionalProperties": {},
      "description": "The plan the account itself is on."
    },
    "paywall": {
      "type": "object",
      "properties": {
        "enforced": {
          "type": "boolean",
          "description": "False while every account gets the Plus plan's limits."
        },
        "note": {
          "type": "string",
          "description": "The same, in a sentence."
        }
      },
      "required": [
        "enforced",
        "note"
      ],
      "additionalProperties": {},
      "description": "Whether paid limits are enforced yet."
    },
    "usage": {
      "type": "object",
      "properties": {
        "today": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "Counted calls today (UTC)."
        },
        "thisMonth": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "Counted calls this month (UTC)."
        },
        "remainingToday": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "Counted calls left today."
        },
        "remainingThisMonth": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "Counted calls left this month."
        },
        "dayResetsInSeconds": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "Seconds until the day's count resets, at midnight UTC."
        },
        "monthResetsInSeconds": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "Seconds until the month's count resets."
        }
      },
      "required": [
        "today",
        "thisMonth",
        "remainingToday",
        "remainingThisMonth",
        "dayResetsInSeconds",
        "monthResetsInSeconds"
      ],
      "additionalProperties": {},
      "description": "What the account has used and what's left."
    }
  },
  "required": [
    "key",
    "plan",
    "accountPlan",
    "paywall",
    "usage"
  ],
  "additionalProperties": {}
}