{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://objectsgrid.com/.well-known/objects-catalog/OrganizationAccount/v1/schema.json",
  "title": "OrganizationAccount",
  "description": "Objects Grid OrganizationAccount Private Object. Represents a registered Organization Account in the Objects Grid system.",
  "type": "object",
  "properties": {
    "id": {
      "description": "The unique identifier for an Object",
      "type": "string"
    },
    "name": {
      "description": "The OrganizationAccount Name",
      "type": "string",
      "minLength": 3,
      "maxLength": 64
    },
    "description": {
      "description": "The OrganizationAccount Description",
      "type": "string",
      "minLength": 0,
      "maxLength": 256
    },
    "countryCode": {
      "description": "The OrganizationAccount Country Code",
      "anyOf": [
        {
          "$ref": "https://objectsgrid.com/.well-known/objects-catalog/CountryCodeEnumeration/v1/schema.json"
        },
        {
          "type": "null"
        }
      ]
    },
    "commerceCode": {
      "description": "The OrganizationAccount Commerce Code",
      "type": "string"
    },
    "ownerID": {
      "description": "The OrganizationAccount Owner ID",
      "type": "string"
    },
    "accessPoint": {
      "description": "The OrganizationAccount AccessPoint",
      "type": "string",
      "enum": ["EU","US"]
    },
    "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"
      }
    },
    "monthlyQuota": {
      "description": "The OrganizationAccount's monthly spending cap: the number of billable API requests a month it is willing to be billed for (responses of 500 and above, 401, 403 and 429, and token requests are free; a GraphQL request counts once). Past it, requests get 429, except token requests and reading or replacing the OrganizationAccount, so that an administrator can raise it. 0 means the platform's default, 100,000. While the OrganizationAccount is unverified (verified false), at most 50,000 requests a month are allowed, whatever monthlyQuota says; one created without an ID token and without a cap gets 50,000. Only an administrator changes it, and a replacement (PUT) that does not mention it keeps it. Responses carry X-ObjectsGrid-Quota-Limit and X-ObjectsGrid-Quota-Used.",
      "type": "integer",
      "minimum": 0,
      "maximum": 1000000000,
      "default": 0
    },
    "customerDataRetentionYears": {
      "description": "How long, in years, an erased person's data stays readable to the accounting role (security.role = accounting) in the Orders that point to it, counted from the newest of those orders; then it is erased from them too. 1 to 30; 10 when unset. Only an administrator changes it, and a replacement (PUT) that does not mention it keeps it.",
      "type": "integer",
      "minimum": 1,
      "maximum": 30,
      "default": 10
    },
    "refreshTokenLifetimeHours": {
      "description": "How long, in hours, a user's sign-in lasts, whichever identity provider it was made with: the refresh tokens it gets, each used once and replaced by the next, are refused once that long has passed since the person signed in with the identity provider; then the app has the person sign in again. 1 to 2400 (100 days). Unset, a sign-in lasts as long as the app refreshes it at least every 100 days. The current value applies, so shortening it ends longer sign-ins at their next refresh. Only an administrator changes it, and a replacement (PUT) that does not mention it keeps it.",
      "type": "integer",
      "minimum": 1,
      "maximum": 2400
    },
    "jsonLdAddresses": {
      "description": "The addresses of your own web pages, by object type, used when an object is read as a JSON-LD document (GET <path>/{id} with Accept: application/ld+json) to give it and the objects it references your addresses as @id and url. Each value is an https address without a query, in which {field} is replaced by the object's top-level field of that name, such as {id} or {sku}; a fragment, such as #product, is kept in @id and left out of url. An object whose field is missing or empty, or whose type is not listed, gets no @id. The stored objects keep their API addresses (at_id). Only an administrator changes it, and a replacement (PUT) that does not mention it keeps it.",
      "type": "object",
      "maxProperties": 50,
      "propertyNames": {
        "pattern": "^[A-Z][A-Za-z0-9]{0,63}$"
      },
      "additionalProperties": {
        "type": "string",
        "pattern": "^https://[^{}/#?]+([/#][^?]*)?$",
        "maxLength": 512
      },
      "examples": [{"Product": "https://shop.example.com/products/{sku}#product", "Organization": "https://example.com/about#organization"}]
    },
    "identityProviders": {
      "description": "The apps whose ID tokens log users into the OrganizationAccount (OAuth 2.0 token exchange): an ID token is accepted only if its issuer is listed here and its audience (aud) is one of that issuer's clientIds. None listed, no user logs in; service accounts still do. An OrganizationAccount is created with the app its creator signed in with; one created without an ID token with none, until an administrator is bound (POST /organizationaccounts/{id}/administrator), whose app is then added. Only an administrator adds or removes apps, and a replacement (PUT) that does not mention identityProviders keeps them. Issuers: https://accounts.google.com, https://appleid.apple.com, and up to 3 of the organization account's own OpenID Connect issuers, such as its Okta org (https://acme.okta.com or https://acme.okta.com/oauth2/default, or its custom URL domain). An own issuer is checked when it is added: an https URL without query, fragment or port, whose discovery document ({issuer}/.well-known/openid-configuration) names exactly that issuer, a jwks_uri on https and RS256 ID tokens; ID tokens are then verified with its published keys. Changing an own issuer (for example to a custom URL domain) gives its users new user accounts: a user account is found by issuer and subject.",
      "type": "array",
      "default": [],
      "maxItems": 10,
      "items": {
        "type": "object",
        "properties": {
          "issuer": {
            "description": "The identity provider's issuer (iss), exactly as its ID tokens carry it: https://accounts.google.com, https://appleid.apple.com, or the organization account's own OpenID Connect issuer, e.g. https://acme.okta.com/oauth2/default",
            "type": "string",
            "format": "uri",
            "maxLength": 256
          },
          "clientIds": {
            "description": "The client ids of the apps registered with the issuer whose ID tokens are accepted: Google's OAuth client ids, e.g. 1234-abc.apps.googleusercontent.com; for Apple, the Services ID of a web app (e.g. com.example.shop.web) and the bundle id of an iOS app (e.g. com.example.shop); for Okta, the app integration's client ID (e.g. 0oa1b2c3d4EXAMPLE)",
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          }
        },
        "required": ["issuer", "clientIds"],
        "additionalProperties": false
      }
    },
    "verified": {
      "description": "False while the OrganizationAccount, created without an ID token (zero-friction onboarding), has no administrator who signed in: it is then held to 50,000 requests a month. True once an administrator is bound (POST /organizationaccounts/{id}/administrator), or from the start when it was created with an ID token. Absent on OrganizationAccounts created before 2026-11-22, which count as verified. Set by the platform only: a write that sends it keeps the stored value.",
      "type": "boolean",
      "readOnly": true
    },
    "verifiedAt": {
      "description": "When the OrganizationAccount was verified. Set by the platform only.",
      "type": "string",
      "format": "date-time",
      "readOnly": true
    }
  },
  "required": ["name", "accessPoint"]
}