{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/placestack-com/json-schema/placestack-com-credential-schema.json",
  "title": "Credential",
  "description": "A credential, its scopes and its organization's credit balance.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/placestack-com-account-api-openapi.yml#/components/schemas/Credential",
  "properties": {
    "object": {
      "type": "string",
      "const": "credential",
      "title": "Object",
      "description": "The object's type. Always `credential`.",
      "default": "credential"
    },
    "organization": {
      "type": "string",
      "title": "Organization",
      "description": "The organization's id."
    },
    "organization_name": {
      "type": "string",
      "title": "Organization Name",
      "description": "The organization's name."
    },
    "plan": {
      "type": "string",
      "title": "Plan",
      "description": "The organization's plan, such as `free`."
    },
    "kind": {
      "type": "string",
      "title": "Kind",
      "description": "Whether the credential belongs to a person or a machine. One of `user` or `machine`."
    },
    "subject": {
      "type": "string",
      "title": "Subject",
      "description": "The id of the API key, user or OAuth client the credential belongs to."
    },
    "method": {
      "type": "string",
      "title": "Method",
      "description": "How the request was authenticated. One of `session`, `api_key`, `oauth` or `mcp`."
    },
    "name": {
      "type": "string",
      "title": "Name",
      "description": "The API key's name or the user's email address, for display."
    },
    "scope": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Scope",
      "description": "The credential's scopes, such as `record:read` and `webhook:manage`. A console session also has its role's `*:manage` scopes."
    },
    "credit_balance": {
      "type": "integer",
      "title": "Credit Balance",
      "description": "The current credit balance."
    },
    "user": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "User",
      "description": "The user's id. Null for a machine credential."
    }
  },
  "type": "object",
  "required": [
    "object",
    "organization",
    "organization_name",
    "plan",
    "kind",
    "subject",
    "method",
    "name",
    "scope",
    "credit_balance",
    "user"
  ]
}