{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/rateapi-dev/json-schema/rateapi-dev-protected-resource-metadata-schema.json",
  "title": "ProtectedResourceMetadata",
  "description": "RFC 9728 protected-resource metadata, extended with the auth.md `agent_auth` block. `authorization_servers` is deliberately ABSENT: rateAPI runs no OAuth authorization server, and naming one would advertise a URI that 404s on first fetch — worse for an agent than an omitted field.",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/rateapi-dev-openapi.json#/components/schemas/ProtectedResourceMetadata",
  "type": "object",
  "required": [
    "resource"
  ],
  "properties": {
    "resource": {
      "type": "string",
      "format": "uri",
      "description": "Canonical identifier of the protected resource these credentials are for."
    },
    "resource_name": {
      "type": "string",
      "description": "Human-readable name of this protected resource."
    },
    "resource_documentation": {
      "type": "string",
      "description": "Machine-readable documentation for the resource — this API’s OpenAPI spec.",
      "format": "uri"
    },
    "bearer_methods_supported": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "header",
          "body",
          "query"
        ]
      },
      "description": "Only `header`. The `X-API-Key` spelling is equivalent but has no registered vocabulary term, so it is described in `agent_auth.notes` instead."
    },
    "bearer_token_prefix": {
      "type": "string",
      "description": "Every credential starts with this. Keys are opaque and must not be parsed."
    },
    "scopes_supported": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Empty: keys carry no scopes at all. Stated positively so a client does not read an absent field as an oversight."
    },
    "agent_auth": {
      "type": "object",
      "description": "auth.md registration block. Every URI here is one this API serves or links to.",
      "properties": {
        "skill": {
          "type": "string",
          "format": "uri",
          "description": "The auth.md walkthrough."
        },
        "register_uri": {
          "type": "string",
          "description": "Where an agent registers to obtain its own credential.",
          "format": "uri"
        },
        "identity_types_supported": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "anonymous",
              "identity_assertion"
            ]
          },
          "description": "Drawn only from the auth.md enum. rateAPI advertises `anonymous` alone, because it implements no assertion exchange. Variants such as `verified_email` or `id-jag` are NOT identity types — they belong inside `identity_assertion.assertion_types_supported`."
        },
        "anonymous": {
          "type": "object",
          "description": "Sibling block for the `anonymous` identity type: an unauthenticated POST returns a server-generated secret exactly once. There is no claim step.",
          "properties": {
            "register_uri": {
              "type": "string",
              "format": "uri",
              "description": "Where an agent POSTs to register."
            },
            "register_method": {
              "type": "string",
              "description": "HTTP method used against `register_uri`."
            },
            "register_request_example": {
              "type": "object",
              "description": "A registration body that works as-is.",
              "properties": {
                "email": {
                  "type": "string",
                  "format": "email",
                  "description": "Contact address the key is issued against."
                },
                "source": {
                  "type": "string",
                  "description": "Free-text attribution for where the registration came from."
                }
              }
            },
            "register_headers_required": {
              "type": "object",
              "description": "Headers required to create a credential safely.",
              "additionalProperties": {
                "type": "string"
              }
            },
            "credential_type": {
              "type": "string",
              "description": "What the registration returns."
            },
            "credential_prefix": {
              "type": "string",
              "description": "Prefix every issued credential carries."
            },
            "credential_delivery": {
              "type": "string",
              "description": "How the secret reaches the caller. It is returned inline; a byte-identical retry can replay the encrypted response for 24 hours, after which only the long-term hash remains."
            },
            "identical_retry_window_seconds": {
              "type": "integer",
              "description": "How long a byte-identical request using the same enrollment UUID can recover the original encrypted response."
            },
            "documentation": {
              "type": "string",
              "format": "uri",
              "description": "Walkthrough for this registration flow."
            }
          }
        },
        "revocation_uri": {
          "type": "string",
          "description": "Session-authenticated dashboard route; not callable with an API key alone."
        },
        "revocation_method": {
          "type": "string",
          "description": "HTTP method used against `revocation_uri` to revoke a credential."
        },
        "notes": {
          "type": "array",
          "description": "Facts about this credential scheme an agent would otherwise have to discover by trial: the token format, the accepted headers, the sandbox prefix, and the registration cap.",
          "items": {
            "type": "string"
          }
        }
      }
    }
  }
}