{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/fusio/main/json-schema/fusio-backend-rate-schema.json",
  "title": "Backend_Rate",
  "description": "This object represents a rate limitation, which allows to limit the requests which a user can send",
  "x-generated": "2026-10-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/fusio-rate-api-openapi.yml#/components/schemas/Backend_Rate",
  "type": "object",
  "properties": {
    "id": {
      "description": "Unique identifier for the object",
      "type": "integer"
    },
    "priority": {
      "description": "All rates are applied based on the priority, higher priorities are applied first",
      "type": "integer"
    },
    "name": {
      "description": "Unique name of the object",
      "type": "string"
    },
    "rateLimit": {
      "description": "Maximum number of allowed requests",
      "type": "integer"
    },
    "timespan": {
      "description": "Timespan for the allowed requests",
      "type": "string"
    },
    "allocation": {
      "description": "Through a rate allocation a user gets assigned to a specific rate",
      "type": "array",
      "items": {
        "$ref": "#/$defs/Backend_RateAllocation"
      }
    },
    "metadata": {
      "$ref": "#/$defs/Common_Metadata"
    }
  },
  "$defs": {
    "Backend_RateAllocation": {
      "description": "This object represents a rate allocation, in case a request matches it gets assigned to the attached rate",
      "type": "object",
      "properties": {
        "id": {
          "description": "Unique identifier for the object",
          "type": "integer"
        },
        "operationId": {
          "type": "integer"
        },
        "userId": {
          "type": "integer"
        },
        "planId": {
          "type": "integer"
        },
        "appId": {
          "type": "integer"
        },
        "authenticated": {
          "description": "Whether the request is authenticated",
          "type": "boolean"
        }
      }
    },
    "Common_Metadata": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    }
  }
}