{
  "openapi": "3.1.0",
  "info": {
    "title": "RestrictTiers Public and Private API",
    "version": "1.0.0",
    "description": "Read-only public player lookups without keys. Default public limit 100/minute per IP and 1,000/minute aggregate. Optional private access has an independent default allowance of 1,000/minute per key and 1,000/minute aggregate. No bulk export. Empty results do not prove clean history.",
    "contact": {
      "name": "raincakecat",
      "url": "https://restricttiers.raincakecat.com/contact"
    }
  },
  "servers": [
    {
      "url": "https://restricttiers.raincakecat.com"
    }
  ],
  "security": [],
  "paths": {
    "/api/v1/players/{identifier}": {
      "get": {
        "operationId": "getPlayerRestrictions",
        "summary": "Look up a Minecraft IGN or UUID",
        "description": "Returns at most 100 active restrictions and 50 past records per page. Active records repeat on later pages. Name lookup outages return 503; UUID lookup may return nameUnavailable. Responses may use a short internal cache.",
        "parameters": [
          {
            "name": "identifier",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 36
            },
            "description": "Complete IGN or dashed/undashed UUID"
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 1,
              "minimum": 1,
              "maximum": 10000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful read-only lookup",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated request ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-API-Version": {
                "schema": {
                  "const": "1"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Configured per-key allowance; other limits can apply",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Window": {
                "schema": {
                  "const": "60"
                }
              },
              "X-RateLimit-Scope": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "ip",
                    "key"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/PlayerResult"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Current username not found",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request limit reached",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Wait this many seconds"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Lookup or protection unavailable",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method unsupported",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/v1/status": {
      "get": {
        "operationId": "getLookupStatus",
        "summary": "Check cached lookup-service connectivity",
        "responses": {
          "200": {
            "description": "Successful read-only lookup",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated request ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-API-Version": {
                "schema": {
                  "const": "1"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Configured per-key allowance; other limits can apply",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Window": {
                "schema": {
                  "const": "60"
                }
              },
              "X-RateLimit-Scope": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "ip",
                    "key"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Status"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Current username not found",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request limit reached",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Wait this many seconds"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Lookup or protection unavailable",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method unsupported",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/private/v1/players/{identifier}": {
      "get": {
        "operationId": "privateGetPlayerRestrictions",
        "summary": "Look up a Minecraft IGN or UUID (private higher-quota access)",
        "description": "Returns at most 100 active restrictions and 50 past records per page. Active records repeat on later pages. Name lookup outages return 503; UUID lookup may return nameUnavailable. Responses may use a short internal cache.",
        "parameters": [
          {
            "name": "identifier",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 36
            },
            "description": "Complete IGN or dashed/undashed UUID"
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 1,
              "minimum": 1,
              "maximum": 10000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful read-only lookup",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated request ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-API-Version": {
                "schema": {
                  "const": "1"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Configured per-key allowance; other limits can apply",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Window": {
                "schema": {
                  "const": "60"
                }
              },
              "X-RateLimit-Scope": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "ip",
                    "key"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/PlayerResult"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Current username not found",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request limit reached",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Wait this many seconds"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Lookup or protection unavailable",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method unsupported",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Private key missing, invalid, expired or disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "security": [
          {
            "DeveloperKey": []
          }
        ]
      }
    },
    "/api/private/v1/status": {
      "get": {
        "operationId": "privateGetLookupStatus",
        "summary": "Check cached lookup-service connectivity (private higher-quota access)",
        "responses": {
          "200": {
            "description": "Successful read-only lookup",
            "headers": {
              "X-Request-ID": {
                "description": "Server-generated request ID",
                "schema": {
                  "type": "string"
                }
              },
              "X-API-Version": {
                "schema": {
                  "const": "1"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Configured per-key allowance; other limits can apply",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Window": {
                "schema": {
                  "const": "60"
                }
              },
              "X-RateLimit-Scope": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "ip",
                    "key"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Status"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Current username not found",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Request limit reached",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Wait this many seconds"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Lookup or protection unavailable",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method unsupported",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Private key missing, invalid, expired or disabled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "security": [
          {
            "DeveloperKey": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "DeveloperKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Optional private API key. Applies only to /api/private/v1. Never distribute in public clients or URLs."
      }
    },
    "schemas": {
      "Meta": {
        "type": "object",
        "required": [
          "apiVersion",
          "requestId"
        ],
        "properties": {
          "apiVersion": {
            "const": "1"
          },
          "requestId": {
            "type": "string"
          },
          "respondedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error",
          "meta"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "enum": [
                  "INVALID_REQUEST",
                  "UNAUTHORIZED",
                  "PLAYER_NOT_FOUND",
                  "RATE_LIMITED",
                  "SERVICE_UNAVAILABLE",
                  "METHOD_NOT_ALLOWED"
                ]
              },
              "message": {
                "type": "string"
              },
              "retryAfter": {
                "type": "integer",
                "minimum": 1
              }
            }
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "Restriction": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "community",
          "reason",
          "categories",
          "durationDays",
          "restrictedAt",
          "expiresAt",
          "archivedAt",
          "verification",
          "sourceUrl"
        ],
        "properties": {
          "community": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "durationDays": {
            "type": [
              "integer",
              "null"
            ]
          },
          "restrictedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "archivedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "verification": {
            "type": "string",
            "enum": [
              "needs_review",
              "no_review_flag"
            ]
          },
          "sourceUrl": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          }
        }
      },
      "PlayerResult": {
        "type": "object",
        "required": [
          "player",
          "counts",
          "active",
          "past",
          "pagination",
          "limits",
          "sample",
          "notice"
        ],
        "properties": {
          "player": {
            "type": "object",
            "required": [
              "uuid",
              "username",
              "nameUnavailable",
              "profileUrl"
            ],
            "properties": {
              "uuid": {
                "type": "string",
                "pattern": "^[a-f0-9]{32}$"
              },
              "username": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "nameUnavailable": {
                "type": "boolean"
              },
              "profileUrl": {
                "type": "string",
                "format": "uri"
              }
            }
          },
          "counts": {
            "type": "object",
            "required": [
              "active",
              "past"
            ],
            "properties": {
              "active": {
                "type": "integer",
                "minimum": 0
              },
              "past": {
                "type": "integer",
                "minimum": 0
              }
            }
          },
          "active": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/Restriction"
            }
          },
          "past": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/Restriction"
            }
          },
          "pagination": {
            "type": "object",
            "required": [
              "page",
              "pageSize",
              "totalPages",
              "nextPage",
              "nextUrl"
            ],
            "properties": {
              "page": {
                "type": "integer",
                "minimum": 1,
                "maximum": 10000
              },
              "pageSize": {
                "const": 50
              },
              "totalPages": {
                "type": "integer",
                "minimum": 1
              },
              "nextPage": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 1,
                "maximum": 10000
              },
              "nextUrl": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uri"
              }
            }
          },
          "limits": {
            "type": "object",
            "required": [
              "activeMaximum",
              "pastPerPage",
              "maximumPage",
              "activeTruncated",
              "pastTruncated",
              "hasMorePast",
              "beyondPageLimit"
            ],
            "properties": {
              "activeMaximum": {
                "const": 100
              },
              "pastPerPage": {
                "const": 50
              },
              "maximumPage": {
                "const": 10000
              },
              "activeTruncated": {
                "type": "boolean"
              },
              "pastTruncated": {
                "type": "boolean"
              },
              "hasMorePast": {
                "type": "boolean"
              },
              "beyondPageLimit": {
                "type": "boolean"
              }
            }
          },
          "sample": {
            "type": "boolean"
          },
          "notice": {
            "type": "string"
          }
        }
      },
      "Status": {
        "type": "object",
        "required": [
          "status",
          "checkedAt",
          "scope"
        ],
        "properties": {
          "status": {
            "const": "healthy"
          },
          "checkedAt": {
            "type": "string",
            "format": "date-time"
          },
          "scope": {
            "type": "string"
          }
        }
      }
    }
  }
}
