{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pexafy/json-schema/pexafy-usage-envelope-schema.json",
  "title": "UsageEnvelope",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pexafy-usage-api-openapi.yml#/components/schemas/UsageEnvelope",
  "type": "object",
  "required": [
    "success",
    "data"
  ],
  "properties": {
    "success": {
      "type": "boolean"
    },
    "data": {
      "$ref": "#/$defs/Usage"
    },
    "meta": {
      "$ref": "#/$defs/Meta"
    }
  },
  "$defs": {
    "Meta": {
      "type": "object",
      "properties": {
        "request_id": {
          "type": "string"
        },
        "took_ms": {
          "type": "number",
          "description": "Server side time, excluding transfer."
        }
      }
    },
    "Usage": {
      "type": "object",
      "description": "Quota counters for the calling key's account.",
      "properties": {
        "plan": {
          "type": "string"
        },
        "period_start": {
          "type": "string",
          "format": "date"
        },
        "period_end": {
          "type": "string",
          "format": "date"
        },
        "searches": {
          "type": "integer",
          "minimum": 0
        },
        "searches_limit": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "description": "Null on plans with no ceiling."
        },
        "downloads": {
          "type": "integer",
          "minimum": 0
        },
        "downloads_limit": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        }
      }
    }
  }
}