{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/plinth-us-grants-data/json-schema/plinth-us-grants-data-trial-key-schema.json",
  "title": "TrialKey",
  "x-generated": "2026-11-08",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/plinth-us-grants-data-platform-api-openapi.yml#/components/schemas/TrialKey",
  "type": "object",
  "properties": {
    "code": {
      "type": "integer"
    },
    "message": {
      "type": "string"
    },
    "key": {
      "type": "string",
      "description": "The credential. Send as X-API-Key."
    },
    "key_prefix": {
      "type": "string"
    },
    "plan": {
      "type": "string"
    },
    "tier": {
      "type": "string"
    },
    "tier_label": {
      "type": "string"
    },
    "expires_at": {
      "type": "string",
      "format": "date-time"
    },
    "calls_ceiling": {
      "type": "integer"
    },
    "calls_used": {
      "type": "integer"
    },
    "calls_remaining": {
      "type": "integer"
    },
    "budget_is": {
      "type": "string"
    },
    "max_limit": {
      "type": "integer"
    },
    "max_page": {
      "type": [
        "integer",
        "null"
      ]
    },
    "scope": {
      "type": "string"
    },
    "challenge": {
      "type": "object",
      "description": "Present when the key arrives LOCKED. Until these are answered the key may make only the calls named here.",
      "properties": {
        "questions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ChallengeQuestion"
          }
        },
        "answer_at": {
          "type": "string"
        },
        "attempts": {
          "type": "string",
          "description": "How many answers this challenge takes and how they are spaced. Running out draws a FRESH challenge rather than locking the key."
        }
      }
    },
    "terms": {
      "type": "object",
      "description": "What is enforced, and what we ask of you."
    }
  },
  "required": [
    "code",
    "key",
    "tier",
    "expires_at"
  ],
  "$defs": {
    "ChallengeQuestion": {
      "type": "object",
      "properties": {
        "call": {
          "type": "string",
          "description": "The exact request to make, method and URL."
        },
        "ask": {
          "type": "string",
          "description": "What to read out of that response, in plain English."
        }
      },
      "required": [
        "call",
        "ask"
      ]
    }
  }
}