{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://objectsgrid.com/.well-known/objects-catalog/ServiceAccount/v1/schema.json",
  "title": "ServiceAccount",
  "description": "Objects Grid ServiceAccount Object",
  "type": "object",
  "properties": {
    "id": {
      "description": "The unique identifier for ServiceAccount",
      "type": "string",
      "minLength": 0,
      "maxLength": 50
    },
    "secret": {
      "description": "A secret service account's secret, generated by the platform: answered when the account is created or its secret rotated (POST /serviceaccounts/{id}/secret), and to readers the ABAC policy allows. Read-only: a replacement (PUT) keeps it, whatever it sends. Lists do not carry it. A public service account has none.",
      "readOnly": true,
      "type": "string",
      "minLength": 0,
      "maxLength": 64
    },
    "description": {
      "description": "The ServiceAccount description",
      "type": "string",
      "minLength": 0,
      "maxLength": 255
    },
    "previousSecretExpiresAt": {
      "description": "After a rotation, when the secret it replaced stops working (24 hours later); until then both secrets authenticate.",
      "type": "string",
      "format": "date-time",
      "readOnly": true
    },
    "type": {
      "description": "The ServiceAccount type, public or secret: set when it is created, read-only afterwards (a replacement keeps it).",
      "type": "string",
      "minLength": 6,
      "maxLength": 6,
      "enum": ["public", "secret"]
    },
    "disabled": {
      "description": "Is the ServiceAccount disabled: a disabled account gets no access token, and its API keys and anonymous tokens stop within a minute",
      "type": "boolean"
    },
    "allowedOrigins": {
      "description": "Public service accounts only: the web origins (scheme, host and port, such as https://shop.example.com) its browser requests may come from. A request whose Origin header is not listed is refused (403); one without the header, from a server or a script, is not, so this keeps other websites from using the key in their visitors' browsers, not scripts. None listed: any origin. Stored lower case, at most 50.",
      "type": "array",
      "maxItems": 50,
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 255
      }
    },
    "monthlyRequestLimit": {
      "description": "Public service accounts only: how many billable requests it may make a month, under the Organization Account's spending cap (monthlyQuota); once made, its requests get 429 until the month ends. 0 or absent: no limit of its own. Its usage is at GET /serviceaccounts/{id}/usage.",
      "type": "integer",
      "minimum": 0,
      "maximum": 1000000000
    },
    "tags": {
      "description": "Tags an ABAC policy can decide on. A name may repeat; the same name and value appear once. Every stored object has them: created empty when not sent, kept by a replacement (PUT) that does not mention them, unchanged by a patch that does not mention them, cleared by null or [].",
      "type": "array",
      "default": [],
      "uniqueItems": true,
      "maxItems": 50,
      "items": {
        "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Tag/v1/schema.json"
      }
    }
  },
  "required": ["type"]
}