{
  "openapi": "3.1.1",
  "info": {
    "title": "HeyIdentity Agent API",
    "description": "HeyIdentity is a hosted fake OpenID Connect / OAuth 2.0 identity provider for development and tests. The Agent API lets an AI agent create a working test tenant (an IdP) for the user's application without the user signing up, configure it one item per request, and hand it to the user to claim.\n\nWorkflow:\n1. Read the catalog (GET /agent/v1/catalog).\n2. Create a tenant (POST /agent/v1/tenants) with a random, secret Idempotency-Key header and the current accepted_terms_version.\n3. When the user wants to keep the tenant, request a claim code (POST /agent/v1/tenant/claim-code or MCP request_claim_code) and show it with claim_page_url. Codes work for 15 minutes; never store them. Save the agent token to .heyidentity/tenant.json (git-ignored).\n4. If the app is an MCP server, read Protecting an MCP server with HeyIdentity (mcp-servers in the guide at /agent) before adding clients.\n5. Configure the tenant to match the application, one item per request: clients and redirect URIs, users, claims, settings. A configuration always keeps at least one user, so add your own users before removing demo-user.\n6. Validate the configuration (POST /agent/v1/configurations/{configuration_id}/validate).\n\nRules:\n- When the user wants to keep a tenant, call POST /agent/v1/tenant/claim-code (MCP request_claim_code) and show them the code and claim_page_url. Codes work for 15 minutes, replace earlier codes and must never be stored. Unclaimed tenants are deleted when they expire.\n- Save the agent token to .heyidentity/tenant.json and add .heyidentity/ to .gitignore. The agent token is the operator's secret: never commit it or put it in a URL.\n- Never ask the user for their email address and never send one to the Agent API: the user claims the tenant themselves by entering a claim code at the claim page.\n- Use only fictional test people in users and claims, with email-shaped values on reserved test domains (for example alice@example.com, bob@example.org). Never use real people's names, emails or identifiers, even when modelling a real organisation.\n- Send an Idempotency-Key header when creating a tenant: a random secret of 32 to 128 characters from A-Z a-z 0-9 - _ (for example crypto.randomUUID(), uuidgen or openssl rand -hex 16), generated once per intended tenant and kept secret like the agent token. Retry only with the same key and body, and only if you never received the response. Never retry creation in a loop.\n- Read the catalog (GET /agent/v1/catalog) before configuring a tenant to match an application: it describes the profiles, URL shapes, token shape options and standard claims.\n- Prefer a separate client per environment (for example web-local, web-staging) within one configuration. Create another configuration (POST /agent/v1/configurations, with a name unique in the tenant) only for a different profile or a separate set of users. Only the user deletes configurations, in the editor after signing in with email. Only the user deletes tenants, in the editor after claiming and signing in with email; agents never delete either. The user can rename a configuration in the editor after signing in with email; keep its id, not its name, to find it again.\n- Apply one item operation per request (one client, user, claim or the settings); whole configuration documents are refused.\n- Configurations can be created (create_configuration) but not deleted through the Agent API (403 not_supported). Ask the user to delete the configuration, or the whole tenant, after signing in with email.\n- The current terms version and the limits change without a new version of this document, so it does not state them: read them from get_catalog (GET /agent/v1/catalog) before creating a tenant.\n\nAuthentication: every operation except create_tenant and get_catalog takes the agent token from create_tenant's data.agent_token as 'Authorization: Bearer <agent_token>'.\n\nGuide: /agent (HTML) and /agent/llms.txt (plain text). MCP server with the same operations as tools: /agent/mcp.",
    "version": "v1"
  },
  "servers": [
    {
      "url": "https://api.heyidentity.dev/"
    }
  ],
  "paths": {
    "/agent/v1/tenant/claim-code": {
      "post": {
        "tags": [
          "AgentApi"
        ],
        "summary": "Request a short-lived claim code",
        "description": "Issues a single-use claim code for an unclaimed tenant. It works for 15 minutes and replaces any earlier code. Show the code and claim_page_url to the user; never store the code.",
        "operationId": "request_claim_code",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": [
                  "null",
                  "object"
                ],
                "additionalProperties": false
              },
              "example": { }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Done. The body carries data, the tenant's status, the claim page URL while it is unclaimed, and next_steps.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "required": [
                            "user_code",
                            "expires_at",
                            "claim_page_url"
                          ],
                          "type": [
                            "null",
                            "object"
                          ],
                          "properties": {
                            "user_code": {
                              "type": "string",
                              "description": "Single-use claim code, valid for 15 minutes. Show it to the user and never store it."
                            },
                            "expires_at": {
                              "type": "string",
                              "description": "The UTC deadline for entering the claim code.",
                              "format": "date-time"
                            },
                            "claim_page_url": {
                              "type": "string",
                              "description": "The fixed claim page on the manage origin; carries no secret."
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: A field is missing or invalid; field names it. Next: Fix that field and send the request again.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The agent token is missing, unknown or revoked. Next: Use the saved token. If it was lost or revoked, the tenant owner issues a new one after signing in with email.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "403": {
            "description": "issuer_suspended: The issuing member is suspended because the tenant has more members than its seat maximum allows. Its primary owner can restore access. Next: Stop and tell the user. Ask the primary owner to restore access, then retry with the same token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "409": {
            "description": "already_claimed: The tenant is already claimed, so no claim code can be issued; a creation retry can also report this. Next: Use the agent token you saved.\nconcurrent_change: The tenant changed while a creation retry was processed, or a signing-key rotation lost a concurrent change; nothing changed. Next: Retry the operation once. For tenant creation, use the same Idempotency-Key and body.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "410": {
            "description": "tenant_expired: The tenant expired unclaimed and was deleted with its configuration. Next: Create a new tenant, request a claim code and show it with the claim page to the user, and update the application's configuration.\ntenant_deleted: The user deleted the tenant while signed in; deleted_at says when. It can't be restored. Next: Stop and ask the user whether they want a new tenant before creating one; never create one automatically.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "415": {
            "description": "unsupported_media_type: The request body is not JSON. Next: Send the body as JSON with Content-Type: application/json.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: A per-source, per-token, global or per-configuration signing-key rotation limit was hit, or too many unclaimed tenants exist. Next: Wait for the Retry-After time, then continue. Never retry creation in a loop; reuse your tenant.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "agent_token": [ ]
          }
        ]
      }
    },
    "/agent/v1/configurations/{configuration_id}/signing-keys": {
      "get": {
        "tags": [
          "AgentApi"
        ],
        "summary": "List published signing keys",
        "description": "Lists a configuration's published key IDs, status, source and expiry. Available on every plan; returns no key material.",
        "operationId": "list_signing_keys",
        "parameters": [
          {
            "name": "configuration_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done. The body carries data, the tenant's status, the claim page URL while it is unclaimed, and next_steps.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "required": [
                            "keys"
                          ],
                          "type": [
                            "null",
                            "object"
                          ],
                          "properties": {
                            "current_kid": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "description": "The current signing key ID; absent before first use or rotation."
                            },
                            "keys": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "kid",
                                  "is_current",
                                  "source"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "kid": {
                                    "type": "string"
                                  },
                                  "is_current": {
                                    "type": "boolean"
                                  },
                                  "source": {
                                    "type": "string"
                                  },
                                  "valid_until_utc": {
                                    "type": [
                                      "null",
                                      "string"
                                    ],
                                    "format": "date-time"
                                  }
                                }
                              },
                              "description": "Published keys, with current/retiring status, shared/generated source, and retiring expiry. No private material."
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The agent token is missing, unknown or revoked. Next: Use the saved token. If it was lost or revoked, the tenant owner issues a new one after signing in with email.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "403": {
            "description": "issuer_suspended: The issuing member is suspended because the tenant has more members than its seat maximum allows. Its primary owner can restore access. Next: Stop and tell the user. Ask the primary owner to restore access, then retry with the same token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "404": {
            "description": "not_found: No configuration with this id belongs to your tenant, or there is no Agent API endpoint at that path. Next: GET /agent/v1/tenant lists your configurations; the catalog's endpoints list the API.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "410": {
            "description": "tenant_expired: The tenant expired unclaimed and was deleted with its configuration. Next: Create a new tenant, request a claim code and show it with the claim page to the user, and update the application's configuration.\ntenant_deleted: The user deleted the tenant while signed in; deleted_at says when. It can't be restored. Next: Stop and ask the user whether they want a new tenant before creating one; never create one automatically.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: A per-source, per-token, global or per-configuration signing-key rotation limit was hit, or too many unclaimed tenants exist. Next: Wait for the Retry-After time, then continue. Never retry creation in a loop; reuse your tenant.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "agent_token": [ ]
          }
        ]
      }
    },
    "/agent/v1/configurations/{configuration_id}/signing-keys/rotate": {
      "post": {
        "tags": [
          "AgentApi"
        ],
        "summary": "Rotate a configuration's signing key (Pro)",
        "description": "Generates a new RSA signing key for this configuration. overlap=true keeps the previous key published for the configured window; false removes every earlier key immediately. Needs Pro or Enterprise (or Vetted assurance); rate limited per configuration. Returns the current kid and published keys.",
        "operationId": "rotate_signing_key",
        "parameters": [
          {
            "name": "configuration_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "required": [
                  "overlap"
                ],
                "type": [
                  "null",
                  "object"
                ],
                "properties": {
                  "overlap": {
                    "type": [
                      "null",
                      "boolean"
                    ],
                    "description": "Required. true keeps the previous key published for the overlap window; false drops every earlier key immediately."
                  }
                },
                "additionalProperties": false
              },
              "example": {
                "overlap": true
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Done. The body carries data, the tenant's status, the claim page URL while it is unclaimed, and next_steps.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "required": [
                            "keys"
                          ],
                          "type": [
                            "null",
                            "object"
                          ],
                          "properties": {
                            "current_kid": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "description": "The current signing key ID; absent before first use or rotation."
                            },
                            "keys": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "kid",
                                  "is_current",
                                  "source"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "kid": {
                                    "type": "string"
                                  },
                                  "is_current": {
                                    "type": "boolean"
                                  },
                                  "source": {
                                    "type": "string"
                                  },
                                  "valid_until_utc": {
                                    "type": [
                                      "null",
                                      "string"
                                    ],
                                    "format": "date-time"
                                  }
                                }
                              },
                              "description": "Published keys, with current/retiring status, shared/generated source, and retiring expiry. No private material."
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: A field is missing or invalid; field names it. Next: Fix that field and send the request again.\nplan_required: Signing-key rotation, or the field named by field (such as sign_in_outcome), needs an active Pro or Enterprise plan, or a vetted tenant. Nothing was saved. Next: For a field edit, leave it out, send the stored value or send normal. For signing-key rotation, ask the owner to activate Pro; reading keys works on every plan. Tell the user they can see the plans (next_steps links to them); an unverified tenant needs to be claimed first.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The agent token is missing, unknown or revoked. Next: Use the saved token. If it was lost or revoked, the tenant owner issues a new one after signing in with email.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "403": {
            "description": "issuer_suspended: The issuing member is suspended because the tenant has more members than its seat maximum allows. Its primary owner can restore access. Next: Stop and tell the user. Ask the primary owner to restore access, then retry with the same token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "404": {
            "description": "not_found: No configuration with this id belongs to your tenant, or there is no Agent API endpoint at that path. Next: GET /agent/v1/tenant lists your configurations; the catalog's endpoints list the API.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "409": {
            "description": "concurrent_change: The tenant changed while a creation retry was processed, or a signing-key rotation lost a concurrent change; nothing changed. Next: Retry the operation once. For tenant creation, use the same Idempotency-Key and body.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "410": {
            "description": "tenant_expired: The tenant expired unclaimed and was deleted with its configuration. Next: Create a new tenant, request a claim code and show it with the claim page to the user, and update the application's configuration.\ntenant_deleted: The user deleted the tenant while signed in; deleted_at says when. It can't be restored. Next: Stop and ask the user whether they want a new tenant before creating one; never create one automatically.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "415": {
            "description": "unsupported_media_type: The request body is not JSON. Next: Send the body as JSON with Content-Type: application/json.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: A per-source, per-token, global or per-configuration signing-key rotation limit was hit, or too many unclaimed tenants exist. Next: Wait for the Retry-After time, then continue. Never retry creation in a loop; reuse your tenant.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "agent_token": [ ]
          }
        ]
      }
    },
    "/agent/v1/tenants": {
      "post": {
        "tags": [
          "AgentApi"
        ],
        "summary": "Create an unverified test tenant",
        "description": "Creates an unverified HeyIdentity test tenant with a working demo client and test user, accepting the current Terms of Use on behalf of the operator running the agent. Returns endpoints, an agent token, the fixed claim page URL, the expiry time and next_steps. Read the current terms version (terms.current_version) with get_catalog first and send it as accepted_terms_version; it can change at any time.",
        "operationId": "create_tenant",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Strongly recommended: a random secret per intended tenant, generated with a cryptographic random generator (for example a random UUID or 16 random bytes as hex), never logged or shared, kept secret like the agent token. Reuse it only on a retry: send the same key and the same body if you never received the response, and you get the same tenant instead of a second one. Never retry creation with a new key, and never in a loop.",
            "schema": {
              "maxLength": 128,
              "minLength": 32,
              "pattern": "^[A-Za-z0-9_-]+$",
              "type": "string"
            },
            "example": "6f1c2d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "required": [
                  "accepted_terms_version"
                ],
                "type": [
                  "null",
                  "object"
                ],
                "properties": {
                  "accepted_terms_version": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "The current Terms of Use version (catalog terms.current_version), accepted on behalf of the operator running the agent."
                  },
                  "display_name": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "The tenant's display name, at most 200 characters. Default: Agent test tenant."
                  },
                  "profile": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "Generic (default), Microsoft (Entra ID), or AzureAdB2C (one synthetic sign-in policy)."
                  }
                },
                "additionalProperties": false,
                "description": "Creates an unverified test tenant. There is no email field: the user claims the tenant on the claim page."
              },
              "example": {
                "accepted_terms_version": "<terms.current_version from get_catalog>",
                "display_name": "Orders app tests",
                "profile": "Generic"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "The tenant was created (or, on a retry with the same Idempotency-Key and body, the same tenant is returned). Save data.agent_token: it is never shown again. Request a claim code when the user wants to keep the tenant.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "required": [
                            "tenant_route_id",
                            "configuration_id",
                            "display_name",
                            "profile",
                            "endpoints",
                            "demo_client",
                            "demo_user",
                            "agent_token",
                            "expires_at"
                          ],
                          "type": [
                            "null",
                            "object"
                          ],
                          "properties": {
                            "tenant_route_id": {
                              "type": "string",
                              "description": "The tenant's route id, part of every endpoint URL.",
                              "format": "uuid"
                            },
                            "configuration_id": {
                              "type": "string",
                              "description": "The tenant's first configuration; the configuration_id of every configuration operation.",
                              "format": "uuid"
                            },
                            "display_name": {
                              "type": "string",
                              "description": "The tenant's display name."
                            },
                            "profile": {
                              "type": "string",
                              "description": "Generic, Microsoft or AzureAdB2C."
                            },
                            "endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": "object",
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "The OpenID Connect endpoints to configure the application with (issuer = authority)."
                            },
                            "entra_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "Microsoft profile only: the endpoints at the Entra ID URL shape."
                            },
                            "entra": {
                              "required": [
                                "instance",
                                "tenant_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "Instance: the HeyIdentity origin."
                                },
                                "tenant_id": {
                                  "type": "string",
                                  "description": "TenantId: the configuration id.",
                                  "format": "uuid"
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The authority, for libraries configured with one."
                                }
                              },
                              "description": "Microsoft profile only: the Microsoft.Identity.Web / MSAL settings."
                            },
                            "demo_client": {
                              "required": [
                                "client_id",
                                "allow_all_return_urls",
                                "allowed_scopes"
                              ],
                              "type": "object",
                              "properties": {
                                "client_id": {
                                  "type": "string"
                                },
                                "client_secret": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "allow_all_return_urls": {
                                  "type": "boolean"
                                },
                                "allowed_scopes": {
                                  "type": "array",
                                  "items": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  }
                                }
                              },
                              "description": "A working client that accepts any redirect URI; edit it or add your own."
                            },
                            "demo_user": {
                              "required": [
                                "key",
                                "display_name"
                              ],
                              "type": "object",
                              "properties": {
                                "key": {
                                  "type": "string"
                                },
                                "display_name": {
                                  "type": "string"
                                }
                              },
                              "description": "A fictional test user to sign in as."
                            },
                            "agent_token": {
                              "type": "string",
                              "description": "Secret. Returned only in this response and never again: save it to .heyidentity/tenant.json (git-ignored) before doing anything else. Send it as 'Authorization: Bearer <agent_token>' on every other operation."
                            },
                            "expires_at": {
                              "type": "string",
                              "description": "When the tenant is deleted unless the user claims it with the claim page URL.",
                              "format": "date-time"
                            },
                            "b2c_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "AzureAdB2C profile only: policy-aware runtime endpoints.",
                              "default": null
                            },
                            "b2c": {
                              "required": [
                                "instance",
                                "domain",
                                "sign_up_sign_in_policy_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "AzureAdB2C Instance: the app origin followed by a slash."
                                },
                                "domain": {
                                  "type": "string",
                                  "description": "AzureAdB2C Domain: the local configuration GUID.",
                                  "format": "uuid"
                                },
                                "sign_up_sign_in_policy_id": {
                                  "type": "string",
                                  "description": "The sole synthetic sign-in policy: B2C_1_signin."
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The policy-aware authority base passed to MSAL WithB2CAuthority, without /v2.0."
                                }
                              },
                              "description": "AzureAdB2C profile only: local authority and synthetic policy.",
                              "default": null
                            },
                            "b2c_policy_claim": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "description": "B2C policy claim: tfp or acr.",
                              "default": null
                            }
                          },
                          "description": "The new tenant: its ids, endpoints, demo client and user, the agent token and the expiry time."
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: A field is missing or invalid; field names it. Next: Fix that field and send the request again.\nterms_not_accepted: accepted_terms_version is missing or not current. Next: Read the terms at terms_url and send current_terms_version.\nemail_not_accepted: The request contained an email address. Next: Remove it; the user claims the tenant on the claim page.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "409": {
            "description": "already_claimed: The tenant is already claimed, so no claim code can be issued; a creation retry can also report this. Next: Use the agent token you saved.\nidempotency_key_spent: The tenant created with this Idempotency-Key already received its response and its agent token has been used; nothing was issued. Next: Use the agent token you saved. If it is lost, create a new tenant with a new key.\nconcurrent_change: The tenant changed while a creation retry was processed, or a signing-key rotation lost a concurrent change; nothing changed. Next: Retry the operation once. For tenant creation, use the same Idempotency-Key and body.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "415": {
            "description": "unsupported_media_type: The request body is not JSON. Next: Send the body as JSON with Content-Type: application/json.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "422": {
            "description": "idempotency_key_reused: The Idempotency-Key was used with a different body. Next: Use a new key for a different request.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: A per-source, per-token, global or per-configuration signing-key rotation limit was hit, or too many unclaimed tenants exist. Next: Wait for the Retry-After time, then continue. Never retry creation in a loop; reuse your tenant.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          }
        },
        "security": [ ]
      }
    },
    "/agent/v1/catalog": {
      "get": {
        "tags": [
          "AgentApi"
        ],
        "summary": "Describe profiles, options, limits and the current terms",
        "description": "Describes the profiles (claims, URL shapes, protocol behaviors), token shape options, standard claims, limits, the current terms version and the rules agents must follow. Read it before configuring a tenant.",
        "operationId": "get_catalog",
        "responses": {
          "200": {
            "description": "Done. The body carries data, the tenant's status, the claim page URL while it is unclaimed, and next_steps.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          }
        },
        "security": [ ]
      }
    },
    "/agent/v1/tenant": {
      "get": {
        "tags": [
          "AgentApi"
        ],
        "summary": "Get the tenant",
        "description": "Returns the tenant, its configurations and their endpoints, its limits and status.",
        "operationId": "get_tenant",
        "responses": {
          "200": {
            "description": "Done. The body carries data, the tenant's status, the claim page URL while it is unclaimed, and next_steps.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "required": [
                            "tenant_route_id",
                            "display_name",
                            "origin",
                            "created_at",
                            "configurations",
                            "limits"
                          ],
                          "type": [
                            "null",
                            "object"
                          ],
                          "properties": {
                            "tenant_route_id": {
                              "type": "string",
                              "description": "The tenant's route id, part of every endpoint URL.",
                              "format": "uuid"
                            },
                            "display_name": {
                              "type": "string",
                              "description": "The tenant's display name."
                            },
                            "origin": {
                              "type": "string",
                              "description": "How the tenant was created: Admin, SelfService or Agent."
                            },
                            "created_at": {
                              "type": "string",
                              "description": "When the tenant was created.",
                              "format": "date-time"
                            },
                            "configurations": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "configuration_id",
                                  "name",
                                  "profile",
                                  "endpoints"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "configuration_id": {
                                    "type": "string",
                                    "description": "The configuration_id of every configuration operation.",
                                    "format": "uuid"
                                  },
                                  "name": {
                                    "type": "string",
                                    "description": "The configuration's name."
                                  },
                                  "profile": {
                                    "type": "string",
                                    "description": "Generic, Microsoft or AzureAdB2C."
                                  },
                                  "endpoints": {
                                    "required": [
                                      "issuer",
                                      "discovery",
                                      "authorize",
                                      "token",
                                      "userinfo",
                                      "jwks",
                                      "end_session"
                                    ],
                                    "type": "object",
                                    "properties": {
                                      "issuer": {
                                        "type": "string"
                                      },
                                      "discovery": {
                                        "type": "string"
                                      },
                                      "authorize": {
                                        "type": "string"
                                      },
                                      "token": {
                                        "type": "string"
                                      },
                                      "userinfo": {
                                        "type": "string"
                                      },
                                      "jwks": {
                                        "type": "string"
                                      },
                                      "end_session": {
                                        "type": "string"
                                      }
                                    },
                                    "description": "The OpenID Connect endpoints (issuer = authority)."
                                  },
                                  "entra_endpoints": {
                                    "required": [
                                      "issuer",
                                      "discovery",
                                      "authorize",
                                      "token",
                                      "userinfo",
                                      "jwks",
                                      "end_session"
                                    ],
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "properties": {
                                      "issuer": {
                                        "type": "string"
                                      },
                                      "discovery": {
                                        "type": "string"
                                      },
                                      "authorize": {
                                        "type": "string"
                                      },
                                      "token": {
                                        "type": "string"
                                      },
                                      "userinfo": {
                                        "type": "string"
                                      },
                                      "jwks": {
                                        "type": "string"
                                      },
                                      "end_session": {
                                        "type": "string"
                                      }
                                    },
                                    "description": "Microsoft profile only: the endpoints at the Entra ID URL shape."
                                  },
                                  "entra": {
                                    "required": [
                                      "instance",
                                      "tenant_id",
                                      "authority"
                                    ],
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "properties": {
                                      "instance": {
                                        "type": "string",
                                        "description": "Instance: the HeyIdentity origin."
                                      },
                                      "tenant_id": {
                                        "type": "string",
                                        "description": "TenantId: the configuration id.",
                                        "format": "uuid"
                                      },
                                      "authority": {
                                        "type": "string",
                                        "description": "The authority, for libraries configured with one."
                                      }
                                    },
                                    "description": "Microsoft profile only: the Microsoft.Identity.Web / MSAL settings."
                                  },
                                  "b2c_endpoints": {
                                    "required": [
                                      "issuer",
                                      "discovery",
                                      "authorize",
                                      "token",
                                      "userinfo",
                                      "jwks",
                                      "end_session"
                                    ],
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "properties": {
                                      "issuer": {
                                        "type": "string"
                                      },
                                      "discovery": {
                                        "type": "string"
                                      },
                                      "authorize": {
                                        "type": "string"
                                      },
                                      "token": {
                                        "type": "string"
                                      },
                                      "userinfo": {
                                        "type": "string"
                                      },
                                      "jwks": {
                                        "type": "string"
                                      },
                                      "end_session": {
                                        "type": "string"
                                      }
                                    },
                                    "description": "AzureAdB2C profile only: policy-aware runtime endpoints.",
                                    "default": null
                                  },
                                  "b2c": {
                                    "required": [
                                      "instance",
                                      "domain",
                                      "sign_up_sign_in_policy_id",
                                      "authority"
                                    ],
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "properties": {
                                      "instance": {
                                        "type": "string",
                                        "description": "AzureAdB2C Instance: the app origin followed by a slash."
                                      },
                                      "domain": {
                                        "type": "string",
                                        "description": "AzureAdB2C Domain: the local configuration GUID.",
                                        "format": "uuid"
                                      },
                                      "sign_up_sign_in_policy_id": {
                                        "type": "string",
                                        "description": "The sole synthetic sign-in policy: B2C_1_signin."
                                      },
                                      "authority": {
                                        "type": "string",
                                        "description": "The policy-aware authority base passed to MSAL WithB2CAuthority, without /v2.0."
                                      }
                                    },
                                    "description": "AzureAdB2C profile only: local authority and synthetic policy.",
                                    "default": null
                                  },
                                  "b2c_policy_claim": {
                                    "type": [
                                      "null",
                                      "string"
                                    ],
                                    "description": "B2C policy claim: tfp or acr.",
                                    "default": null
                                  }
                                },
                                "description": "A configuration and the endpoints to configure the application with."
                              },
                              "description": "The tenant's configurations, oldest first."
                            },
                            "limits": {
                              "required": [
                                "max_configurations",
                                "max_clients_per_configuration",
                                "max_users_per_configuration",
                                "max_document_size_bytes",
                                "tokens_per_minute"
                              ],
                              "type": "object",
                              "properties": {
                                "max_configurations": {
                                  "pattern": "^-?(?:0|[1-9]\\d*)$",
                                  "type": [
                                    "integer",
                                    "string"
                                  ]
                                },
                                "max_clients_per_configuration": {
                                  "pattern": "^-?(?:0|[1-9]\\d*)$",
                                  "type": [
                                    "integer",
                                    "string"
                                  ]
                                },
                                "max_users_per_configuration": {
                                  "pattern": "^-?(?:0|[1-9]\\d*)$",
                                  "type": [
                                    "integer",
                                    "string"
                                  ]
                                },
                                "max_document_size_bytes": {
                                  "pattern": "^-?(?:0|[1-9]\\d*)$",
                                  "type": [
                                    "integer",
                                    "string"
                                  ]
                                },
                                "tokens_per_minute": {
                                  "pattern": "^-?(?:0|[1-9]\\d*)$",
                                  "type": [
                                    "integer",
                                    "string"
                                  ]
                                }
                              },
                              "description": "The limits of the tenant's assurance level."
                            }
                          },
                          "description": "The tenant, its configurations with their endpoints, and its limits."
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The agent token is missing, unknown or revoked. Next: Use the saved token. If it was lost or revoked, the tenant owner issues a new one after signing in with email.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "403": {
            "description": "issuer_suspended: The issuing member is suspended because the tenant has more members than its seat maximum allows. Its primary owner can restore access. Next: Stop and tell the user. Ask the primary owner to restore access, then retry with the same token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "410": {
            "description": "tenant_expired: The tenant expired unclaimed and was deleted with its configuration. Next: Create a new tenant, request a claim code and show it with the claim page to the user, and update the application's configuration.\ntenant_deleted: The user deleted the tenant while signed in; deleted_at says when. It can't be restored. Next: Stop and ask the user whether they want a new tenant before creating one; never create one automatically.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: A per-source, per-token, global or per-configuration signing-key rotation limit was hit, or too many unclaimed tenants exist. Next: Wait for the Retry-After time, then continue. Never retry creation in a loop; reuse your tenant.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "agent_token": [ ]
          }
        ]
      }
    },
    "/agent/v1/configurations": {
      "post": {
        "tags": [
          "AgentApi"
        ],
        "summary": "Create a configuration",
        "description": "Creates another configuration in the tenant from the starter content (a demo user and a demo client), with a name unique in the tenant and a profile. Prefer a separate client per environment in one configuration; create a configuration for a different profile or a separate set of users. A retry with the same name answers configuration_exists with the existing configuration instead of creating a second one.",
        "operationId": "create_configuration",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "required": [
                  "name"
                ],
                "type": [
                  "null",
                  "object"
                ],
                "properties": {
                  "name": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "The configuration's name, at most 200 characters and unique in the tenant ignoring case, e.g. staging. A retry with the same name answers configuration_exists with the existing configuration."
                  },
                  "profile": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "Generic (default), Microsoft (Entra ID), or AzureAdB2C (one synthetic sign-in policy)."
                  }
                },
                "additionalProperties": false,
                "description": "Creates another configuration from the starter content (a demo user and a demo client)."
              },
              "example": {
                "name": "staging",
                "profile": "Microsoft"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "The configuration was created; data is the configuration as get_configuration returns it. A retry with the same name answers 409 configuration_exists with the existing configuration.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "required": [
                            "configuration_id",
                            "name",
                            "profile",
                            "validate_client_secrets",
                            "clients",
                            "users",
                            "custom_claims",
                            "standard_claims",
                            "endpoints"
                          ],
                          "type": [
                            "null",
                            "object"
                          ],
                          "properties": {
                            "configuration_id": {
                              "type": "string",
                              "description": "The configuration_id of every configuration operation.",
                              "format": "uuid"
                            },
                            "name": {
                              "type": "string",
                              "description": "The configuration's name."
                            },
                            "profile": {
                              "type": "string",
                              "description": "Generic, Microsoft or AzureAdB2C."
                            },
                            "validate_client_secrets": {
                              "type": "boolean",
                              "description": "Whether client secrets are checked at the token endpoint."
                            },
                            "token_lifetime_minutes": {
                              "pattern": "^-?(?:0|[1-9]\\d*)$",
                              "type": [
                                "null",
                                "integer",
                                "string"
                              ],
                              "description": "Token lifetime in minutes; the default when absent."
                            },
                            "token_shape": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "scope_claim_name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "scope_claim_format": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "roles_claim_name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "roles_nested_key": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "access_token_audience": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                }
                              },
                              "description": "Generic profile: the claim shape options; absent when none are set."
                            },
                            "clients": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "client_id",
                                  "allow_all_return_urls",
                                  "redirect_uris",
                                  "allowed_scopes",
                                  "exposed_scopes"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "client_id": {
                                    "type": "string"
                                  },
                                  "client_secret": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "allow_all_return_urls": {
                                    "type": "boolean"
                                  },
                                  "redirect_uris": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "allowed_scopes": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "exposed_scopes": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "access_token_audience": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "claims": {
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array"
                                        },
                                        {
                                          "type": "object"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "description": "Read by the Generic profile only: this client's own claims in its client credentials access tokens. Seeded configurations may hold any JSON value.",
                                    "default": null
                                  },
                                  "app_permissions": {
                                    "type": [
                                      "null",
                                      "array"
                                    ],
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    },
                                    "description": "Read by the Microsoft and AzureAdB2C profiles only: resource-qualified app permissions, carried for {resource}/.default as roles (Microsoft) or scp (AzureAdB2C).",
                                    "default": null
                                  }
                                }
                              }
                            },
                            "users": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "key",
                                  "claims"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "key": {
                                    "type": "string"
                                  },
                                  "display_name": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "sub": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "icon": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "access_token_sub": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "claims": {
                                    "type": "object",
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array"
                                        },
                                        {
                                          "type": "object"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "description": "The user's claims: name to a string, number, boolean or array of strings. Seeded configurations may hold any JSON value."
                                  },
                                  "claim_targets": {
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "additionalProperties": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    },
                                    "description": "Claims that go into one token only: name to id_token or access_token; absent when all go into both."
                                  },
                                  "sign_in_outcome": {
                                    "type": "string",
                                    "description": "How sign-in goes for this user: normal, access_denied, temporarily_unavailable, interaction_required or refresh_revoked. Only in effect on a Pro or vetted tenant.",
                                    "default": "normal"
                                  }
                                }
                              }
                            },
                            "custom_claims": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "name",
                                  "value",
                                  "target"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "name": {
                                    "type": "string"
                                  },
                                  "value": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "boolean"
                                      },
                                      {
                                        "type": "array"
                                      },
                                      {
                                        "type": "object"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Seeded configurations may hold any JSON value."
                                  },
                                  "target": {
                                    "type": "string",
                                    "description": "both, id_token or access_token."
                                  }
                                }
                              }
                            },
                            "standard_claims": {
                              "required": [
                                "enabled",
                                "available"
                              ],
                              "type": "object",
                              "properties": {
                                "enabled": {
                                  "type": "array",
                                  "items": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "description": "The enabled standard claims."
                                },
                                "available": {
                                  "type": "array",
                                  "items": {
                                    "required": [
                                      "name",
                                      "description"
                                    ],
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "properties": {
                                      "name": {
                                        "type": "string"
                                      },
                                      "description": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "description": "The standard claims the profile offers, for set_standard_claims."
                                }
                              }
                            },
                            "endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": "object",
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "The OpenID Connect endpoints (issuer = authority)."
                            },
                            "entra_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "Microsoft profile only: the endpoints at the Entra ID URL shape."
                            },
                            "entra": {
                              "required": [
                                "instance",
                                "tenant_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "Instance: the HeyIdentity origin."
                                },
                                "tenant_id": {
                                  "type": "string",
                                  "description": "TenantId: the configuration id.",
                                  "format": "uuid"
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The authority, for libraries configured with one."
                                }
                              },
                              "description": "Microsoft profile only: the Microsoft.Identity.Web / MSAL settings."
                            },
                            "b2c_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "AzureAdB2C profile only: policy-aware runtime endpoints.",
                              "default": null
                            },
                            "b2c": {
                              "required": [
                                "instance",
                                "domain",
                                "sign_up_sign_in_policy_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "AzureAdB2C Instance: the app origin followed by a slash."
                                },
                                "domain": {
                                  "type": "string",
                                  "description": "AzureAdB2C Domain: the local configuration GUID.",
                                  "format": "uuid"
                                },
                                "sign_up_sign_in_policy_id": {
                                  "type": "string",
                                  "description": "The sole synthetic sign-in policy: B2C_1_signin."
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The policy-aware authority base passed to MSAL WithB2CAuthority, without /v2.0."
                                }
                              },
                              "description": "AzureAdB2C profile only: local authority and synthetic policy.",
                              "default": null
                            },
                            "b2c_policy_claim": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "description": "B2C policy claim: tfp or acr; inactive stored settings are preserved.",
                              "default": null
                            }
                          },
                          "description": "A configuration as items: settings, clients, users, custom and standard claims, and its endpoints."
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: A field is missing or invalid; field names it. Next: Fix that field and send the request again.\nusage_limit_exceeded: A limit of the tenant's tier was reached; limit names it and its maximum. The tier follows the plan (pro, enterprise) and otherwise the assurance level. Next: Remove an unused item, or ask the user to claim the tenant, which raises the limits. A claimed tenant on the free plan gets higher limits with the Pro plan (next_steps links to the plans). At the configuration limit of a claimed tenant, the user can delete a configuration they no longer need after signing in with email.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The agent token is missing, unknown or revoked. Next: Use the saved token. If it was lost or revoked, the tenant owner issues a new one after signing in with email.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "403": {
            "description": "issuer_suspended: The issuing member is suspended because the tenant has more members than its seat maximum allows. Its primary owner can restore access. Next: Stop and tell the user. Ask the primary owner to restore access, then retry with the same token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "409": {
            "description": "configuration_exists: The tenant already has a configuration with this name (ignoring case); existing_configuration describes it and nothing was created. Next: Reuse that configuration if its profile is the one you need; otherwise choose another name.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "410": {
            "description": "tenant_expired: The tenant expired unclaimed and was deleted with its configuration. Next: Create a new tenant, request a claim code and show it with the claim page to the user, and update the application's configuration.\ntenant_deleted: The user deleted the tenant while signed in; deleted_at says when. It can't be restored. Next: Stop and ask the user whether they want a new tenant before creating one; never create one automatically.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "415": {
            "description": "unsupported_media_type: The request body is not JSON. Next: Send the body as JSON with Content-Type: application/json.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: A per-source, per-token, global or per-configuration signing-key rotation limit was hit, or too many unclaimed tenants exist. Next: Wait for the Retry-After time, then continue. Never retry creation in a loop; reuse your tenant.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "agent_token": [ ]
          }
        ]
      }
    },
    "/agent/v1/configurations/{configuration_id}": {
      "get": {
        "tags": [
          "AgentApi"
        ],
        "summary": "Get a configuration as items",
        "description": "Returns one configuration of the tenant as items: clients, users, custom and standard claims, settings and endpoints.",
        "operationId": "get_configuration",
        "parameters": [
          {
            "name": "configuration_id",
            "in": "path",
            "description": "The configuration id (from create_tenant or get_tenant).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done. The body carries data, the tenant's status, the claim page URL while it is unclaimed, and next_steps.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "required": [
                            "configuration_id",
                            "name",
                            "profile",
                            "validate_client_secrets",
                            "clients",
                            "users",
                            "custom_claims",
                            "standard_claims",
                            "endpoints"
                          ],
                          "type": [
                            "null",
                            "object"
                          ],
                          "properties": {
                            "configuration_id": {
                              "type": "string",
                              "description": "The configuration_id of every configuration operation.",
                              "format": "uuid"
                            },
                            "name": {
                              "type": "string",
                              "description": "The configuration's name."
                            },
                            "profile": {
                              "type": "string",
                              "description": "Generic, Microsoft or AzureAdB2C."
                            },
                            "validate_client_secrets": {
                              "type": "boolean",
                              "description": "Whether client secrets are checked at the token endpoint."
                            },
                            "token_lifetime_minutes": {
                              "pattern": "^-?(?:0|[1-9]\\d*)$",
                              "type": [
                                "null",
                                "integer",
                                "string"
                              ],
                              "description": "Token lifetime in minutes; the default when absent."
                            },
                            "token_shape": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "scope_claim_name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "scope_claim_format": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "roles_claim_name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "roles_nested_key": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "access_token_audience": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                }
                              },
                              "description": "Generic profile: the claim shape options; absent when none are set."
                            },
                            "clients": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "client_id",
                                  "allow_all_return_urls",
                                  "redirect_uris",
                                  "allowed_scopes",
                                  "exposed_scopes"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "client_id": {
                                    "type": "string"
                                  },
                                  "client_secret": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "allow_all_return_urls": {
                                    "type": "boolean"
                                  },
                                  "redirect_uris": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "allowed_scopes": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "exposed_scopes": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "access_token_audience": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "claims": {
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array"
                                        },
                                        {
                                          "type": "object"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "description": "Read by the Generic profile only: this client's own claims in its client credentials access tokens. Seeded configurations may hold any JSON value.",
                                    "default": null
                                  },
                                  "app_permissions": {
                                    "type": [
                                      "null",
                                      "array"
                                    ],
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    },
                                    "description": "Read by the Microsoft and AzureAdB2C profiles only: resource-qualified app permissions, carried for {resource}/.default as roles (Microsoft) or scp (AzureAdB2C).",
                                    "default": null
                                  }
                                }
                              }
                            },
                            "users": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "key",
                                  "claims"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "key": {
                                    "type": "string"
                                  },
                                  "display_name": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "sub": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "icon": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "access_token_sub": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "claims": {
                                    "type": "object",
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array"
                                        },
                                        {
                                          "type": "object"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "description": "The user's claims: name to a string, number, boolean or array of strings. Seeded configurations may hold any JSON value."
                                  },
                                  "claim_targets": {
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "additionalProperties": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    },
                                    "description": "Claims that go into one token only: name to id_token or access_token; absent when all go into both."
                                  },
                                  "sign_in_outcome": {
                                    "type": "string",
                                    "description": "How sign-in goes for this user: normal, access_denied, temporarily_unavailable, interaction_required or refresh_revoked. Only in effect on a Pro or vetted tenant.",
                                    "default": "normal"
                                  }
                                }
                              }
                            },
                            "custom_claims": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "name",
                                  "value",
                                  "target"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "name": {
                                    "type": "string"
                                  },
                                  "value": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "boolean"
                                      },
                                      {
                                        "type": "array"
                                      },
                                      {
                                        "type": "object"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Seeded configurations may hold any JSON value."
                                  },
                                  "target": {
                                    "type": "string",
                                    "description": "both, id_token or access_token."
                                  }
                                }
                              }
                            },
                            "standard_claims": {
                              "required": [
                                "enabled",
                                "available"
                              ],
                              "type": "object",
                              "properties": {
                                "enabled": {
                                  "type": "array",
                                  "items": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "description": "The enabled standard claims."
                                },
                                "available": {
                                  "type": "array",
                                  "items": {
                                    "required": [
                                      "name",
                                      "description"
                                    ],
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "properties": {
                                      "name": {
                                        "type": "string"
                                      },
                                      "description": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "description": "The standard claims the profile offers, for set_standard_claims."
                                }
                              }
                            },
                            "endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": "object",
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "The OpenID Connect endpoints (issuer = authority)."
                            },
                            "entra_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "Microsoft profile only: the endpoints at the Entra ID URL shape."
                            },
                            "entra": {
                              "required": [
                                "instance",
                                "tenant_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "Instance: the HeyIdentity origin."
                                },
                                "tenant_id": {
                                  "type": "string",
                                  "description": "TenantId: the configuration id.",
                                  "format": "uuid"
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The authority, for libraries configured with one."
                                }
                              },
                              "description": "Microsoft profile only: the Microsoft.Identity.Web / MSAL settings."
                            },
                            "b2c_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "AzureAdB2C profile only: policy-aware runtime endpoints.",
                              "default": null
                            },
                            "b2c": {
                              "required": [
                                "instance",
                                "domain",
                                "sign_up_sign_in_policy_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "AzureAdB2C Instance: the app origin followed by a slash."
                                },
                                "domain": {
                                  "type": "string",
                                  "description": "AzureAdB2C Domain: the local configuration GUID.",
                                  "format": "uuid"
                                },
                                "sign_up_sign_in_policy_id": {
                                  "type": "string",
                                  "description": "The sole synthetic sign-in policy: B2C_1_signin."
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The policy-aware authority base passed to MSAL WithB2CAuthority, without /v2.0."
                                }
                              },
                              "description": "AzureAdB2C profile only: local authority and synthetic policy.",
                              "default": null
                            },
                            "b2c_policy_claim": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "description": "B2C policy claim: tfp or acr; inactive stored settings are preserved.",
                              "default": null
                            }
                          },
                          "description": "A configuration as items: settings, clients, users, custom and standard claims, and its endpoints."
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The agent token is missing, unknown or revoked. Next: Use the saved token. If it was lost or revoked, the tenant owner issues a new one after signing in with email.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "403": {
            "description": "issuer_suspended: The issuing member is suspended because the tenant has more members than its seat maximum allows. Its primary owner can restore access. Next: Stop and tell the user. Ask the primary owner to restore access, then retry with the same token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "404": {
            "description": "not_found: No configuration with this id belongs to your tenant, or there is no Agent API endpoint at that path. Next: GET /agent/v1/tenant lists your configurations; the catalog's endpoints list the API.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "409": {
            "description": "configuration_unloadable: This configuration can't be edited as items. Next: Ask the user to delete it after signing in with email, or to contact support.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "410": {
            "description": "tenant_expired: The tenant expired unclaimed and was deleted with its configuration. Next: Create a new tenant, request a claim code and show it with the claim page to the user, and update the application's configuration.\ntenant_deleted: The user deleted the tenant while signed in; deleted_at says when. It can't be restored. Next: Stop and ask the user whether they want a new tenant before creating one; never create one automatically.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: A per-source, per-token, global or per-configuration signing-key rotation limit was hit, or too many unclaimed tenants exist. Next: Wait for the Retry-After time, then continue. Never retry creation in a loop; reuse your tenant.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "agent_token": [ ]
          }
        ]
      }
    },
    "/agent/v1/configurations/{configuration_id}/validate": {
      "post": {
        "tags": [
          "AgentApi"
        ],
        "summary": "Validate a configuration",
        "description": "Reports problems (e.g. a client without a redirect URI) and warnings (e.g. a scope no client requests) without changing anything.",
        "operationId": "validate_configuration",
        "parameters": [
          {
            "name": "configuration_id",
            "in": "path",
            "description": "The configuration id (from create_tenant or get_tenant).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done. The body carries data, the tenant's status, the claim page URL while it is unclaimed, and next_steps.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The agent token is missing, unknown or revoked. Next: Use the saved token. If it was lost or revoked, the tenant owner issues a new one after signing in with email.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "403": {
            "description": "issuer_suspended: The issuing member is suspended because the tenant has more members than its seat maximum allows. Its primary owner can restore access. Next: Stop and tell the user. Ask the primary owner to restore access, then retry with the same token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "404": {
            "description": "not_found: No configuration with this id belongs to your tenant, or there is no Agent API endpoint at that path. Next: GET /agent/v1/tenant lists your configurations; the catalog's endpoints list the API.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "409": {
            "description": "configuration_unloadable: This configuration can't be edited as items. Next: Ask the user to delete it after signing in with email, or to contact support.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "410": {
            "description": "tenant_expired: The tenant expired unclaimed and was deleted with its configuration. Next: Create a new tenant, request a claim code and show it with the claim page to the user, and update the application's configuration.\ntenant_deleted: The user deleted the tenant while signed in; deleted_at says when. It can't be restored. Next: Stop and ask the user whether they want a new tenant before creating one; never create one automatically.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: A per-source, per-token, global or per-configuration signing-key rotation limit was hit, or too many unclaimed tenants exist. Next: Wait for the Retry-After time, then continue. Never retry creation in a loop; reuse your tenant.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "agent_token": [ ]
          }
        ]
      }
    },
    "/agent/v1/configurations/{configuration_id}/clients": {
      "post": {
        "tags": [
          "AgentApi"
        ],
        "summary": "Add a client",
        "description": "Adds a client.",
        "operationId": "add_client",
        "parameters": [
          {
            "name": "configuration_id",
            "in": "path",
            "description": "The configuration id (from create_tenant or get_tenant).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "required": [
                  "client_id"
                ],
                "type": [
                  "null",
                  "object"
                ],
                "properties": {
                  "client_id": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "The client id. Required when adding; fixed afterwards (it is the id in the URL when editing)."
                  },
                  "client_secret": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "The client secret; checked only when the configuration's validate_client_secrets setting is on."
                  },
                  "allow_all_return_urls": {
                    "type": [
                      "null",
                      "boolean"
                    ],
                    "description": "Accept any redirect URI. Convenient for local tests; default false."
                  },
                  "redirect_uris": {
                    "type": [
                      "null",
                      "array"
                    ],
                    "items": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "description": "Exact redirect URIs the app uses, e.g. http://localhost:5173/callback (http(s) with a host, or an app scheme such as com.example.app:/callback or myapp://callback)."
                  },
                  "allowed_scopes": {
                    "type": [
                      "null",
                      "array"
                    ],
                    "items": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "description": "Scopes the client may request, e.g. openid, profile, email, offline_access, api://orders/read. Default when adding: openid, profile."
                  },
                  "exposed_scopes": {
                    "type": [
                      "null",
                      "array"
                    ],
                    "items": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "description": "Scopes this client exposes as an API (resource), e.g. https://weather.example/mcp/tools.read: advertised in discovery scopes_supported. On a Generic configuration each scope's resource (everything before the last /) is an accepted resource parameter value (RFC 8707), which then becomes aud (see the audience rule)."
                  },
                  "access_token_audience": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "Audience value used when the requesting client's request has no resource and no resource-qualified scope; the client id when not set. On a Generic configuration an absolute URI here, e.g. https://weather.example/mcp, is also an accepted resource parameter value (RFC 8707), which then becomes aud (see the audience rule)."
                  },
                  "claims": {
                    "type": [
                      "null",
                      "object"
                    ],
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "boolean"
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      ]
                    },
                    "description": "Read by the Generic profile only: this client's own claims in its client credentials access tokens, name to a string, number, boolean or array of strings, e.g. { \"roles\": [\"sync.all\"], \"tier\": 2 }. They win over custom claims of the same name; roles follows the token shape's roles location. Stored under every profile; when given on edit, replaces the client's claims."
                  },
                  "app_permissions": {
                    "type": [
                      "null",
                      "array"
                    ],
                    "items": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "description": "Read by the Microsoft and AzureAdB2C profiles only: resource-qualified application permissions, e.g. api://orders/Orders.Sync (not .default). A client credentials request for {resource}/.default carries this client's permissions for that resource as roles (Microsoft) or scp (AzureAdB2C). Stored under every profile; when given on edit, replaces the list."
                  }
                },
                "additionalProperties": false,
                "description": "A client (an app that signs in, or an API). On edit, fields left out keep their value."
              },
              "example": {
                "client_id": "orders-spa",
                "redirect_uris": [
                  "http://localhost:5173/callback"
                ],
                "allowed_scopes": [
                  "openid",
                  "profile",
                  "email"
                ]
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Done. The body carries data, the tenant's status, the claim page URL while it is unclaimed, and next_steps.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "required": [
                            "configuration_id",
                            "name",
                            "profile",
                            "validate_client_secrets",
                            "clients",
                            "users",
                            "custom_claims",
                            "standard_claims",
                            "endpoints"
                          ],
                          "type": [
                            "null",
                            "object"
                          ],
                          "properties": {
                            "configuration_id": {
                              "type": "string",
                              "description": "The configuration_id of every configuration operation.",
                              "format": "uuid"
                            },
                            "name": {
                              "type": "string",
                              "description": "The configuration's name."
                            },
                            "profile": {
                              "type": "string",
                              "description": "Generic, Microsoft or AzureAdB2C."
                            },
                            "validate_client_secrets": {
                              "type": "boolean",
                              "description": "Whether client secrets are checked at the token endpoint."
                            },
                            "token_lifetime_minutes": {
                              "pattern": "^-?(?:0|[1-9]\\d*)$",
                              "type": [
                                "null",
                                "integer",
                                "string"
                              ],
                              "description": "Token lifetime in minutes; the default when absent."
                            },
                            "token_shape": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "scope_claim_name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "scope_claim_format": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "roles_claim_name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "roles_nested_key": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "access_token_audience": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                }
                              },
                              "description": "Generic profile: the claim shape options; absent when none are set."
                            },
                            "clients": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "client_id",
                                  "allow_all_return_urls",
                                  "redirect_uris",
                                  "allowed_scopes",
                                  "exposed_scopes"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "client_id": {
                                    "type": "string"
                                  },
                                  "client_secret": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "allow_all_return_urls": {
                                    "type": "boolean"
                                  },
                                  "redirect_uris": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "allowed_scopes": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "exposed_scopes": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "access_token_audience": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "claims": {
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array"
                                        },
                                        {
                                          "type": "object"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "description": "Read by the Generic profile only: this client's own claims in its client credentials access tokens. Seeded configurations may hold any JSON value.",
                                    "default": null
                                  },
                                  "app_permissions": {
                                    "type": [
                                      "null",
                                      "array"
                                    ],
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    },
                                    "description": "Read by the Microsoft and AzureAdB2C profiles only: resource-qualified app permissions, carried for {resource}/.default as roles (Microsoft) or scp (AzureAdB2C).",
                                    "default": null
                                  }
                                }
                              }
                            },
                            "users": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "key",
                                  "claims"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "key": {
                                    "type": "string"
                                  },
                                  "display_name": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "sub": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "icon": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "access_token_sub": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "claims": {
                                    "type": "object",
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array"
                                        },
                                        {
                                          "type": "object"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "description": "The user's claims: name to a string, number, boolean or array of strings. Seeded configurations may hold any JSON value."
                                  },
                                  "claim_targets": {
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "additionalProperties": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    },
                                    "description": "Claims that go into one token only: name to id_token or access_token; absent when all go into both."
                                  },
                                  "sign_in_outcome": {
                                    "type": "string",
                                    "description": "How sign-in goes for this user: normal, access_denied, temporarily_unavailable, interaction_required or refresh_revoked. Only in effect on a Pro or vetted tenant.",
                                    "default": "normal"
                                  }
                                }
                              }
                            },
                            "custom_claims": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "name",
                                  "value",
                                  "target"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "name": {
                                    "type": "string"
                                  },
                                  "value": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "boolean"
                                      },
                                      {
                                        "type": "array"
                                      },
                                      {
                                        "type": "object"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Seeded configurations may hold any JSON value."
                                  },
                                  "target": {
                                    "type": "string",
                                    "description": "both, id_token or access_token."
                                  }
                                }
                              }
                            },
                            "standard_claims": {
                              "required": [
                                "enabled",
                                "available"
                              ],
                              "type": "object",
                              "properties": {
                                "enabled": {
                                  "type": "array",
                                  "items": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "description": "The enabled standard claims."
                                },
                                "available": {
                                  "type": "array",
                                  "items": {
                                    "required": [
                                      "name",
                                      "description"
                                    ],
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "properties": {
                                      "name": {
                                        "type": "string"
                                      },
                                      "description": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "description": "The standard claims the profile offers, for set_standard_claims."
                                }
                              }
                            },
                            "endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": "object",
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "The OpenID Connect endpoints (issuer = authority)."
                            },
                            "entra_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "Microsoft profile only: the endpoints at the Entra ID URL shape."
                            },
                            "entra": {
                              "required": [
                                "instance",
                                "tenant_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "Instance: the HeyIdentity origin."
                                },
                                "tenant_id": {
                                  "type": "string",
                                  "description": "TenantId: the configuration id.",
                                  "format": "uuid"
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The authority, for libraries configured with one."
                                }
                              },
                              "description": "Microsoft profile only: the Microsoft.Identity.Web / MSAL settings."
                            },
                            "b2c_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "AzureAdB2C profile only: policy-aware runtime endpoints.",
                              "default": null
                            },
                            "b2c": {
                              "required": [
                                "instance",
                                "domain",
                                "sign_up_sign_in_policy_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "AzureAdB2C Instance: the app origin followed by a slash."
                                },
                                "domain": {
                                  "type": "string",
                                  "description": "AzureAdB2C Domain: the local configuration GUID.",
                                  "format": "uuid"
                                },
                                "sign_up_sign_in_policy_id": {
                                  "type": "string",
                                  "description": "The sole synthetic sign-in policy: B2C_1_signin."
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The policy-aware authority base passed to MSAL WithB2CAuthority, without /v2.0."
                                }
                              },
                              "description": "AzureAdB2C profile only: local authority and synthetic policy.",
                              "default": null
                            },
                            "b2c_policy_claim": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "description": "B2C policy claim: tfp or acr; inactive stored settings are preserved.",
                              "default": null
                            }
                          },
                          "description": "A configuration as items: settings, clients, users, custom and standard claims, and its endpoints."
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: A field is missing or invalid; field names it. Next: Fix that field and send the request again.\ninvalid_item: The item was rejected: a field is invalid, POST names an item that exists (\"A user with key \"x\" already exists.\"), PUT or DELETE names one that doesn't (\"User \"x\" no longer exists.\"), or the last user would be removed (\"At least one user is required.\"). Next: Read GET /agent/v1/configurations/{configuration_id}, PUT the items it lists and POST the ones it doesn't (fields left out of a PUT keep their value). Add your own users before removing the last one.\nusage_limit_exceeded: A limit of the tenant's tier was reached; limit names it and its maximum. The tier follows the plan (pro, enterprise) and otherwise the assurance level. Next: Remove an unused item, or ask the user to claim the tenant, which raises the limits. A claimed tenant on the free plan gets higher limits with the Pro plan (next_steps links to the plans). At the configuration limit of a claimed tenant, the user can delete a configuration they no longer need after signing in with email.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The agent token is missing, unknown or revoked. Next: Use the saved token. If it was lost or revoked, the tenant owner issues a new one after signing in with email.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "403": {
            "description": "issuer_suspended: The issuing member is suspended because the tenant has more members than its seat maximum allows. Its primary owner can restore access. Next: Stop and tell the user. Ask the primary owner to restore access, then retry with the same token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "404": {
            "description": "not_found: No configuration with this id belongs to your tenant, or there is no Agent API endpoint at that path. Next: GET /agent/v1/tenant lists your configurations; the catalog's endpoints list the API.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "409": {
            "description": "configuration_unloadable: This configuration can't be edited as items. Next: Ask the user to delete it after signing in with email, or to contact support.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "410": {
            "description": "tenant_expired: The tenant expired unclaimed and was deleted with its configuration. Next: Create a new tenant, request a claim code and show it with the claim page to the user, and update the application's configuration.\ntenant_deleted: The user deleted the tenant while signed in; deleted_at says when. It can't be restored. Next: Stop and ask the user whether they want a new tenant before creating one; never create one automatically.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "415": {
            "description": "unsupported_media_type: The request body is not JSON. Next: Send the body as JSON with Content-Type: application/json.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: A per-source, per-token, global or per-configuration signing-key rotation limit was hit, or too many unclaimed tenants exist. Next: Wait for the Retry-After time, then continue. Never retry creation in a loop; reuse your tenant.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "agent_token": [ ]
          }
        ]
      }
    },
    "/agent/v1/configurations/{configuration_id}/clients/{client_id}": {
      "put": {
        "tags": [
          "AgentApi"
        ],
        "summary": "Edit a client",
        "description": "Edits a client; fields left out keep their value.",
        "operationId": "edit_client",
        "parameters": [
          {
            "name": "configuration_id",
            "in": "path",
            "description": "The configuration id (from create_tenant or get_tenant).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "client_id",
            "in": "path",
            "description": "The client's client_id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": [
                  "null",
                  "object"
                ],
                "properties": {
                  "client_id": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "The client id. Required when adding; fixed afterwards (it is the id in the URL when editing)."
                  },
                  "client_secret": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "The client secret; checked only when the configuration's validate_client_secrets setting is on."
                  },
                  "allow_all_return_urls": {
                    "type": [
                      "null",
                      "boolean"
                    ],
                    "description": "Accept any redirect URI. Convenient for local tests; default false."
                  },
                  "redirect_uris": {
                    "type": [
                      "null",
                      "array"
                    ],
                    "items": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "description": "Exact redirect URIs the app uses, e.g. http://localhost:5173/callback (http(s) with a host, or an app scheme such as com.example.app:/callback or myapp://callback)."
                  },
                  "allowed_scopes": {
                    "type": [
                      "null",
                      "array"
                    ],
                    "items": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "description": "Scopes the client may request, e.g. openid, profile, email, offline_access, api://orders/read. Default when adding: openid, profile."
                  },
                  "exposed_scopes": {
                    "type": [
                      "null",
                      "array"
                    ],
                    "items": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "description": "Scopes this client exposes as an API (resource), e.g. https://weather.example/mcp/tools.read: advertised in discovery scopes_supported. On a Generic configuration each scope's resource (everything before the last /) is an accepted resource parameter value (RFC 8707), which then becomes aud (see the audience rule)."
                  },
                  "access_token_audience": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "Audience value used when the requesting client's request has no resource and no resource-qualified scope; the client id when not set. On a Generic configuration an absolute URI here, e.g. https://weather.example/mcp, is also an accepted resource parameter value (RFC 8707), which then becomes aud (see the audience rule)."
                  },
                  "claims": {
                    "type": [
                      "null",
                      "object"
                    ],
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "boolean"
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      ]
                    },
                    "description": "Read by the Generic profile only: this client's own claims in its client credentials access tokens, name to a string, number, boolean or array of strings, e.g. { \"roles\": [\"sync.all\"], \"tier\": 2 }. They win over custom claims of the same name; roles follows the token shape's roles location. Stored under every profile; when given on edit, replaces the client's claims."
                  },
                  "app_permissions": {
                    "type": [
                      "null",
                      "array"
                    ],
                    "items": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "description": "Read by the Microsoft and AzureAdB2C profiles only: resource-qualified application permissions, e.g. api://orders/Orders.Sync (not .default). A client credentials request for {resource}/.default carries this client's permissions for that resource as roles (Microsoft) or scp (AzureAdB2C). Stored under every profile; when given on edit, replaces the list."
                  }
                },
                "additionalProperties": false,
                "description": "A client (an app that signs in, or an API). On edit, fields left out keep their value."
              },
              "example": {
                "redirect_uris": [
                  "http://localhost:5173/callback",
                  "https://orders.example.com/callback"
                ]
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Done. The body carries data, the tenant's status, the claim page URL while it is unclaimed, and next_steps.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "required": [
                            "configuration_id",
                            "name",
                            "profile",
                            "validate_client_secrets",
                            "clients",
                            "users",
                            "custom_claims",
                            "standard_claims",
                            "endpoints"
                          ],
                          "type": [
                            "null",
                            "object"
                          ],
                          "properties": {
                            "configuration_id": {
                              "type": "string",
                              "description": "The configuration_id of every configuration operation.",
                              "format": "uuid"
                            },
                            "name": {
                              "type": "string",
                              "description": "The configuration's name."
                            },
                            "profile": {
                              "type": "string",
                              "description": "Generic, Microsoft or AzureAdB2C."
                            },
                            "validate_client_secrets": {
                              "type": "boolean",
                              "description": "Whether client secrets are checked at the token endpoint."
                            },
                            "token_lifetime_minutes": {
                              "pattern": "^-?(?:0|[1-9]\\d*)$",
                              "type": [
                                "null",
                                "integer",
                                "string"
                              ],
                              "description": "Token lifetime in minutes; the default when absent."
                            },
                            "token_shape": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "scope_claim_name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "scope_claim_format": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "roles_claim_name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "roles_nested_key": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "access_token_audience": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                }
                              },
                              "description": "Generic profile: the claim shape options; absent when none are set."
                            },
                            "clients": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "client_id",
                                  "allow_all_return_urls",
                                  "redirect_uris",
                                  "allowed_scopes",
                                  "exposed_scopes"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "client_id": {
                                    "type": "string"
                                  },
                                  "client_secret": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "allow_all_return_urls": {
                                    "type": "boolean"
                                  },
                                  "redirect_uris": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "allowed_scopes": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "exposed_scopes": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "access_token_audience": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "claims": {
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array"
                                        },
                                        {
                                          "type": "object"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "description": "Read by the Generic profile only: this client's own claims in its client credentials access tokens. Seeded configurations may hold any JSON value.",
                                    "default": null
                                  },
                                  "app_permissions": {
                                    "type": [
                                      "null",
                                      "array"
                                    ],
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    },
                                    "description": "Read by the Microsoft and AzureAdB2C profiles only: resource-qualified app permissions, carried for {resource}/.default as roles (Microsoft) or scp (AzureAdB2C).",
                                    "default": null
                                  }
                                }
                              }
                            },
                            "users": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "key",
                                  "claims"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "key": {
                                    "type": "string"
                                  },
                                  "display_name": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "sub": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "icon": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "access_token_sub": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "claims": {
                                    "type": "object",
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array"
                                        },
                                        {
                                          "type": "object"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "description": "The user's claims: name to a string, number, boolean or array of strings. Seeded configurations may hold any JSON value."
                                  },
                                  "claim_targets": {
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "additionalProperties": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    },
                                    "description": "Claims that go into one token only: name to id_token or access_token; absent when all go into both."
                                  },
                                  "sign_in_outcome": {
                                    "type": "string",
                                    "description": "How sign-in goes for this user: normal, access_denied, temporarily_unavailable, interaction_required or refresh_revoked. Only in effect on a Pro or vetted tenant.",
                                    "default": "normal"
                                  }
                                }
                              }
                            },
                            "custom_claims": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "name",
                                  "value",
                                  "target"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "name": {
                                    "type": "string"
                                  },
                                  "value": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "boolean"
                                      },
                                      {
                                        "type": "array"
                                      },
                                      {
                                        "type": "object"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Seeded configurations may hold any JSON value."
                                  },
                                  "target": {
                                    "type": "string",
                                    "description": "both, id_token or access_token."
                                  }
                                }
                              }
                            },
                            "standard_claims": {
                              "required": [
                                "enabled",
                                "available"
                              ],
                              "type": "object",
                              "properties": {
                                "enabled": {
                                  "type": "array",
                                  "items": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "description": "The enabled standard claims."
                                },
                                "available": {
                                  "type": "array",
                                  "items": {
                                    "required": [
                                      "name",
                                      "description"
                                    ],
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "properties": {
                                      "name": {
                                        "type": "string"
                                      },
                                      "description": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "description": "The standard claims the profile offers, for set_standard_claims."
                                }
                              }
                            },
                            "endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": "object",
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "The OpenID Connect endpoints (issuer = authority)."
                            },
                            "entra_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "Microsoft profile only: the endpoints at the Entra ID URL shape."
                            },
                            "entra": {
                              "required": [
                                "instance",
                                "tenant_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "Instance: the HeyIdentity origin."
                                },
                                "tenant_id": {
                                  "type": "string",
                                  "description": "TenantId: the configuration id.",
                                  "format": "uuid"
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The authority, for libraries configured with one."
                                }
                              },
                              "description": "Microsoft profile only: the Microsoft.Identity.Web / MSAL settings."
                            },
                            "b2c_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "AzureAdB2C profile only: policy-aware runtime endpoints.",
                              "default": null
                            },
                            "b2c": {
                              "required": [
                                "instance",
                                "domain",
                                "sign_up_sign_in_policy_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "AzureAdB2C Instance: the app origin followed by a slash."
                                },
                                "domain": {
                                  "type": "string",
                                  "description": "AzureAdB2C Domain: the local configuration GUID.",
                                  "format": "uuid"
                                },
                                "sign_up_sign_in_policy_id": {
                                  "type": "string",
                                  "description": "The sole synthetic sign-in policy: B2C_1_signin."
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The policy-aware authority base passed to MSAL WithB2CAuthority, without /v2.0."
                                }
                              },
                              "description": "AzureAdB2C profile only: local authority and synthetic policy.",
                              "default": null
                            },
                            "b2c_policy_claim": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "description": "B2C policy claim: tfp or acr; inactive stored settings are preserved.",
                              "default": null
                            }
                          },
                          "description": "A configuration as items: settings, clients, users, custom and standard claims, and its endpoints."
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: A field is missing or invalid; field names it. Next: Fix that field and send the request again.\ninvalid_item: The item was rejected: a field is invalid, POST names an item that exists (\"A user with key \"x\" already exists.\"), PUT or DELETE names one that doesn't (\"User \"x\" no longer exists.\"), or the last user would be removed (\"At least one user is required.\"). Next: Read GET /agent/v1/configurations/{configuration_id}, PUT the items it lists and POST the ones it doesn't (fields left out of a PUT keep their value). Add your own users before removing the last one.\nusage_limit_exceeded: A limit of the tenant's tier was reached; limit names it and its maximum. The tier follows the plan (pro, enterprise) and otherwise the assurance level. Next: Remove an unused item, or ask the user to claim the tenant, which raises the limits. A claimed tenant on the free plan gets higher limits with the Pro plan (next_steps links to the plans). At the configuration limit of a claimed tenant, the user can delete a configuration they no longer need after signing in with email.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The agent token is missing, unknown or revoked. Next: Use the saved token. If it was lost or revoked, the tenant owner issues a new one after signing in with email.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "403": {
            "description": "issuer_suspended: The issuing member is suspended because the tenant has more members than its seat maximum allows. Its primary owner can restore access. Next: Stop and tell the user. Ask the primary owner to restore access, then retry with the same token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "404": {
            "description": "not_found: No configuration with this id belongs to your tenant, or there is no Agent API endpoint at that path. Next: GET /agent/v1/tenant lists your configurations; the catalog's endpoints list the API.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "409": {
            "description": "configuration_unloadable: This configuration can't be edited as items. Next: Ask the user to delete it after signing in with email, or to contact support.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "410": {
            "description": "tenant_expired: The tenant expired unclaimed and was deleted with its configuration. Next: Create a new tenant, request a claim code and show it with the claim page to the user, and update the application's configuration.\ntenant_deleted: The user deleted the tenant while signed in; deleted_at says when. It can't be restored. Next: Stop and ask the user whether they want a new tenant before creating one; never create one automatically.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "415": {
            "description": "unsupported_media_type: The request body is not JSON. Next: Send the body as JSON with Content-Type: application/json.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: A per-source, per-token, global or per-configuration signing-key rotation limit was hit, or too many unclaimed tenants exist. Next: Wait for the Retry-After time, then continue. Never retry creation in a loop; reuse your tenant.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "agent_token": [ ]
          }
        ]
      },
      "delete": {
        "tags": [
          "AgentApi"
        ],
        "summary": "Remove a client",
        "description": "Removes a client.",
        "operationId": "remove_client",
        "parameters": [
          {
            "name": "configuration_id",
            "in": "path",
            "description": "The configuration id (from create_tenant or get_tenant).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "client_id",
            "in": "path",
            "description": "The client's client_id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done. The body carries data, the tenant's status, the claim page URL while it is unclaimed, and next_steps.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "required": [
                            "configuration_id",
                            "name",
                            "profile",
                            "validate_client_secrets",
                            "clients",
                            "users",
                            "custom_claims",
                            "standard_claims",
                            "endpoints"
                          ],
                          "type": [
                            "null",
                            "object"
                          ],
                          "properties": {
                            "configuration_id": {
                              "type": "string",
                              "description": "The configuration_id of every configuration operation.",
                              "format": "uuid"
                            },
                            "name": {
                              "type": "string",
                              "description": "The configuration's name."
                            },
                            "profile": {
                              "type": "string",
                              "description": "Generic, Microsoft or AzureAdB2C."
                            },
                            "validate_client_secrets": {
                              "type": "boolean",
                              "description": "Whether client secrets are checked at the token endpoint."
                            },
                            "token_lifetime_minutes": {
                              "pattern": "^-?(?:0|[1-9]\\d*)$",
                              "type": [
                                "null",
                                "integer",
                                "string"
                              ],
                              "description": "Token lifetime in minutes; the default when absent."
                            },
                            "token_shape": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "scope_claim_name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "scope_claim_format": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "roles_claim_name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "roles_nested_key": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "access_token_audience": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                }
                              },
                              "description": "Generic profile: the claim shape options; absent when none are set."
                            },
                            "clients": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "client_id",
                                  "allow_all_return_urls",
                                  "redirect_uris",
                                  "allowed_scopes",
                                  "exposed_scopes"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "client_id": {
                                    "type": "string"
                                  },
                                  "client_secret": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "allow_all_return_urls": {
                                    "type": "boolean"
                                  },
                                  "redirect_uris": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "allowed_scopes": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "exposed_scopes": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "access_token_audience": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "claims": {
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array"
                                        },
                                        {
                                          "type": "object"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "description": "Read by the Generic profile only: this client's own claims in its client credentials access tokens. Seeded configurations may hold any JSON value.",
                                    "default": null
                                  },
                                  "app_permissions": {
                                    "type": [
                                      "null",
                                      "array"
                                    ],
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    },
                                    "description": "Read by the Microsoft and AzureAdB2C profiles only: resource-qualified app permissions, carried for {resource}/.default as roles (Microsoft) or scp (AzureAdB2C).",
                                    "default": null
                                  }
                                }
                              }
                            },
                            "users": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "key",
                                  "claims"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "key": {
                                    "type": "string"
                                  },
                                  "display_name": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "sub": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "icon": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "access_token_sub": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "claims": {
                                    "type": "object",
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array"
                                        },
                                        {
                                          "type": "object"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "description": "The user's claims: name to a string, number, boolean or array of strings. Seeded configurations may hold any JSON value."
                                  },
                                  "claim_targets": {
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "additionalProperties": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    },
                                    "description": "Claims that go into one token only: name to id_token or access_token; absent when all go into both."
                                  },
                                  "sign_in_outcome": {
                                    "type": "string",
                                    "description": "How sign-in goes for this user: normal, access_denied, temporarily_unavailable, interaction_required or refresh_revoked. Only in effect on a Pro or vetted tenant.",
                                    "default": "normal"
                                  }
                                }
                              }
                            },
                            "custom_claims": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "name",
                                  "value",
                                  "target"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "name": {
                                    "type": "string"
                                  },
                                  "value": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "boolean"
                                      },
                                      {
                                        "type": "array"
                                      },
                                      {
                                        "type": "object"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Seeded configurations may hold any JSON value."
                                  },
                                  "target": {
                                    "type": "string",
                                    "description": "both, id_token or access_token."
                                  }
                                }
                              }
                            },
                            "standard_claims": {
                              "required": [
                                "enabled",
                                "available"
                              ],
                              "type": "object",
                              "properties": {
                                "enabled": {
                                  "type": "array",
                                  "items": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "description": "The enabled standard claims."
                                },
                                "available": {
                                  "type": "array",
                                  "items": {
                                    "required": [
                                      "name",
                                      "description"
                                    ],
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "properties": {
                                      "name": {
                                        "type": "string"
                                      },
                                      "description": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "description": "The standard claims the profile offers, for set_standard_claims."
                                }
                              }
                            },
                            "endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": "object",
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "The OpenID Connect endpoints (issuer = authority)."
                            },
                            "entra_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "Microsoft profile only: the endpoints at the Entra ID URL shape."
                            },
                            "entra": {
                              "required": [
                                "instance",
                                "tenant_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "Instance: the HeyIdentity origin."
                                },
                                "tenant_id": {
                                  "type": "string",
                                  "description": "TenantId: the configuration id.",
                                  "format": "uuid"
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The authority, for libraries configured with one."
                                }
                              },
                              "description": "Microsoft profile only: the Microsoft.Identity.Web / MSAL settings."
                            },
                            "b2c_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "AzureAdB2C profile only: policy-aware runtime endpoints.",
                              "default": null
                            },
                            "b2c": {
                              "required": [
                                "instance",
                                "domain",
                                "sign_up_sign_in_policy_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "AzureAdB2C Instance: the app origin followed by a slash."
                                },
                                "domain": {
                                  "type": "string",
                                  "description": "AzureAdB2C Domain: the local configuration GUID.",
                                  "format": "uuid"
                                },
                                "sign_up_sign_in_policy_id": {
                                  "type": "string",
                                  "description": "The sole synthetic sign-in policy: B2C_1_signin."
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The policy-aware authority base passed to MSAL WithB2CAuthority, without /v2.0."
                                }
                              },
                              "description": "AzureAdB2C profile only: local authority and synthetic policy.",
                              "default": null
                            },
                            "b2c_policy_claim": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "description": "B2C policy claim: tfp or acr; inactive stored settings are preserved.",
                              "default": null
                            }
                          },
                          "description": "A configuration as items: settings, clients, users, custom and standard claims, and its endpoints."
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_item: The item was rejected: a field is invalid, POST names an item that exists (\"A user with key \"x\" already exists.\"), PUT or DELETE names one that doesn't (\"User \"x\" no longer exists.\"), or the last user would be removed (\"At least one user is required.\"). Next: Read GET /agent/v1/configurations/{configuration_id}, PUT the items it lists and POST the ones it doesn't (fields left out of a PUT keep their value). Add your own users before removing the last one.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The agent token is missing, unknown or revoked. Next: Use the saved token. If it was lost or revoked, the tenant owner issues a new one after signing in with email.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "403": {
            "description": "issuer_suspended: The issuing member is suspended because the tenant has more members than its seat maximum allows. Its primary owner can restore access. Next: Stop and tell the user. Ask the primary owner to restore access, then retry with the same token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "404": {
            "description": "not_found: No configuration with this id belongs to your tenant, or there is no Agent API endpoint at that path. Next: GET /agent/v1/tenant lists your configurations; the catalog's endpoints list the API.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "409": {
            "description": "configuration_unloadable: This configuration can't be edited as items. Next: Ask the user to delete it after signing in with email, or to contact support.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "410": {
            "description": "tenant_expired: The tenant expired unclaimed and was deleted with its configuration. Next: Create a new tenant, request a claim code and show it with the claim page to the user, and update the application's configuration.\ntenant_deleted: The user deleted the tenant while signed in; deleted_at says when. It can't be restored. Next: Stop and ask the user whether they want a new tenant before creating one; never create one automatically.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: A per-source, per-token, global or per-configuration signing-key rotation limit was hit, or too many unclaimed tenants exist. Next: Wait for the Retry-After time, then continue. Never retry creation in a loop; reuse your tenant.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "agent_token": [ ]
          }
        ]
      }
    },
    "/agent/v1/configurations/{configuration_id}/users": {
      "post": {
        "tags": [
          "AgentApi"
        ],
        "summary": "Add a fictional test user",
        "description": "Adds a fictional test user.",
        "operationId": "add_user",
        "parameters": [
          {
            "name": "configuration_id",
            "in": "path",
            "description": "The configuration id (from create_tenant or get_tenant).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "required": [
                  "key"
                ],
                "type": [
                  "null",
                  "object"
                ],
                "properties": {
                  "key": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "The user key shown on the sign-in page and used as sub by default. Required when adding; fixed afterwards."
                  },
                  "display_name": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "The name shown on the sign-in page and emitted as the name claim."
                  },
                  "sub": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "The sub claim; the key when not set."
                  },
                  "icon": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "A built-in icon id for the sign-in page."
                  },
                  "access_token_sub": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "A different sub for access tokens only."
                  },
                  "claims": {
                    "type": [
                      "null",
                      "object"
                    ],
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "boolean"
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      ]
                    },
                    "description": "The user's claims: name to a string, number, boolean or array of strings, e.g. { \"email\": \"alice@example.com\", \"roles\": [\"admin\"] }. Use fictional people only."
                  },
                  "claim_targets": {
                    "type": [
                      "null",
                      "object"
                    ],
                    "additionalProperties": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "description": "Which token each claim goes into: name to both (default), id_token or access_token."
                  },
                  "sign_in_outcome": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "How sign-in goes for this user: normal (default), access_denied, temporarily_unavailable, interaction_required (prompt=none fails) or refresh_revoked (refreshing fails with invalid_grant). Any value other than normal is a Pro feature (plan_required otherwise)."
                  }
                },
                "additionalProperties": false,
                "description": "A fictional test user. On edit, fields left out keep their value; claims, when given, replaces the user's claims."
              },
              "example": {
                "key": "alice",
                "display_name": "Alice Example",
                "claims": {
                  "email": "alice@example.com",
                  "roles": [
                    "admin"
                  ]
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Done. The body carries data, the tenant's status, the claim page URL while it is unclaimed, and next_steps.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "required": [
                            "configuration_id",
                            "name",
                            "profile",
                            "validate_client_secrets",
                            "clients",
                            "users",
                            "custom_claims",
                            "standard_claims",
                            "endpoints"
                          ],
                          "type": [
                            "null",
                            "object"
                          ],
                          "properties": {
                            "configuration_id": {
                              "type": "string",
                              "description": "The configuration_id of every configuration operation.",
                              "format": "uuid"
                            },
                            "name": {
                              "type": "string",
                              "description": "The configuration's name."
                            },
                            "profile": {
                              "type": "string",
                              "description": "Generic, Microsoft or AzureAdB2C."
                            },
                            "validate_client_secrets": {
                              "type": "boolean",
                              "description": "Whether client secrets are checked at the token endpoint."
                            },
                            "token_lifetime_minutes": {
                              "pattern": "^-?(?:0|[1-9]\\d*)$",
                              "type": [
                                "null",
                                "integer",
                                "string"
                              ],
                              "description": "Token lifetime in minutes; the default when absent."
                            },
                            "token_shape": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "scope_claim_name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "scope_claim_format": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "roles_claim_name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "roles_nested_key": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "access_token_audience": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                }
                              },
                              "description": "Generic profile: the claim shape options; absent when none are set."
                            },
                            "clients": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "client_id",
                                  "allow_all_return_urls",
                                  "redirect_uris",
                                  "allowed_scopes",
                                  "exposed_scopes"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "client_id": {
                                    "type": "string"
                                  },
                                  "client_secret": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "allow_all_return_urls": {
                                    "type": "boolean"
                                  },
                                  "redirect_uris": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "allowed_scopes": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "exposed_scopes": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "access_token_audience": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "claims": {
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array"
                                        },
                                        {
                                          "type": "object"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "description": "Read by the Generic profile only: this client's own claims in its client credentials access tokens. Seeded configurations may hold any JSON value.",
                                    "default": null
                                  },
                                  "app_permissions": {
                                    "type": [
                                      "null",
                                      "array"
                                    ],
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    },
                                    "description": "Read by the Microsoft and AzureAdB2C profiles only: resource-qualified app permissions, carried for {resource}/.default as roles (Microsoft) or scp (AzureAdB2C).",
                                    "default": null
                                  }
                                }
                              }
                            },
                            "users": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "key",
                                  "claims"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "key": {
                                    "type": "string"
                                  },
                                  "display_name": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "sub": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "icon": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "access_token_sub": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "claims": {
                                    "type": "object",
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array"
                                        },
                                        {
                                          "type": "object"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "description": "The user's claims: name to a string, number, boolean or array of strings. Seeded configurations may hold any JSON value."
                                  },
                                  "claim_targets": {
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "additionalProperties": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    },
                                    "description": "Claims that go into one token only: name to id_token or access_token; absent when all go into both."
                                  },
                                  "sign_in_outcome": {
                                    "type": "string",
                                    "description": "How sign-in goes for this user: normal, access_denied, temporarily_unavailable, interaction_required or refresh_revoked. Only in effect on a Pro or vetted tenant.",
                                    "default": "normal"
                                  }
                                }
                              }
                            },
                            "custom_claims": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "name",
                                  "value",
                                  "target"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "name": {
                                    "type": "string"
                                  },
                                  "value": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "boolean"
                                      },
                                      {
                                        "type": "array"
                                      },
                                      {
                                        "type": "object"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Seeded configurations may hold any JSON value."
                                  },
                                  "target": {
                                    "type": "string",
                                    "description": "both, id_token or access_token."
                                  }
                                }
                              }
                            },
                            "standard_claims": {
                              "required": [
                                "enabled",
                                "available"
                              ],
                              "type": "object",
                              "properties": {
                                "enabled": {
                                  "type": "array",
                                  "items": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "description": "The enabled standard claims."
                                },
                                "available": {
                                  "type": "array",
                                  "items": {
                                    "required": [
                                      "name",
                                      "description"
                                    ],
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "properties": {
                                      "name": {
                                        "type": "string"
                                      },
                                      "description": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "description": "The standard claims the profile offers, for set_standard_claims."
                                }
                              }
                            },
                            "endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": "object",
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "The OpenID Connect endpoints (issuer = authority)."
                            },
                            "entra_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "Microsoft profile only: the endpoints at the Entra ID URL shape."
                            },
                            "entra": {
                              "required": [
                                "instance",
                                "tenant_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "Instance: the HeyIdentity origin."
                                },
                                "tenant_id": {
                                  "type": "string",
                                  "description": "TenantId: the configuration id.",
                                  "format": "uuid"
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The authority, for libraries configured with one."
                                }
                              },
                              "description": "Microsoft profile only: the Microsoft.Identity.Web / MSAL settings."
                            },
                            "b2c_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "AzureAdB2C profile only: policy-aware runtime endpoints.",
                              "default": null
                            },
                            "b2c": {
                              "required": [
                                "instance",
                                "domain",
                                "sign_up_sign_in_policy_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "AzureAdB2C Instance: the app origin followed by a slash."
                                },
                                "domain": {
                                  "type": "string",
                                  "description": "AzureAdB2C Domain: the local configuration GUID.",
                                  "format": "uuid"
                                },
                                "sign_up_sign_in_policy_id": {
                                  "type": "string",
                                  "description": "The sole synthetic sign-in policy: B2C_1_signin."
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The policy-aware authority base passed to MSAL WithB2CAuthority, without /v2.0."
                                }
                              },
                              "description": "AzureAdB2C profile only: local authority and synthetic policy.",
                              "default": null
                            },
                            "b2c_policy_claim": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "description": "B2C policy claim: tfp or acr; inactive stored settings are preserved.",
                              "default": null
                            }
                          },
                          "description": "A configuration as items: settings, clients, users, custom and standard claims, and its endpoints."
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: A field is missing or invalid; field names it. Next: Fix that field and send the request again.\ninvalid_item: The item was rejected: a field is invalid, POST names an item that exists (\"A user with key \"x\" already exists.\"), PUT or DELETE names one that doesn't (\"User \"x\" no longer exists.\"), or the last user would be removed (\"At least one user is required.\"). Next: Read GET /agent/v1/configurations/{configuration_id}, PUT the items it lists and POST the ones it doesn't (fields left out of a PUT keep their value). Add your own users before removing the last one.\nusage_limit_exceeded: A limit of the tenant's tier was reached; limit names it and its maximum. The tier follows the plan (pro, enterprise) and otherwise the assurance level. Next: Remove an unused item, or ask the user to claim the tenant, which raises the limits. A claimed tenant on the free plan gets higher limits with the Pro plan (next_steps links to the plans). At the configuration limit of a claimed tenant, the user can delete a configuration they no longer need after signing in with email.\nplan_required: Signing-key rotation, or the field named by field (such as sign_in_outcome), needs an active Pro or Enterprise plan, or a vetted tenant. Nothing was saved. Next: For a field edit, leave it out, send the stored value or send normal. For signing-key rotation, ask the owner to activate Pro; reading keys works on every plan. Tell the user they can see the plans (next_steps links to them); an unverified tenant needs to be claimed first.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The agent token is missing, unknown or revoked. Next: Use the saved token. If it was lost or revoked, the tenant owner issues a new one after signing in with email.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "403": {
            "description": "issuer_suspended: The issuing member is suspended because the tenant has more members than its seat maximum allows. Its primary owner can restore access. Next: Stop and tell the user. Ask the primary owner to restore access, then retry with the same token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "404": {
            "description": "not_found: No configuration with this id belongs to your tenant, or there is no Agent API endpoint at that path. Next: GET /agent/v1/tenant lists your configurations; the catalog's endpoints list the API.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "409": {
            "description": "configuration_unloadable: This configuration can't be edited as items. Next: Ask the user to delete it after signing in with email, or to contact support.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "410": {
            "description": "tenant_expired: The tenant expired unclaimed and was deleted with its configuration. Next: Create a new tenant, request a claim code and show it with the claim page to the user, and update the application's configuration.\ntenant_deleted: The user deleted the tenant while signed in; deleted_at says when. It can't be restored. Next: Stop and ask the user whether they want a new tenant before creating one; never create one automatically.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "415": {
            "description": "unsupported_media_type: The request body is not JSON. Next: Send the body as JSON with Content-Type: application/json.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: A per-source, per-token, global or per-configuration signing-key rotation limit was hit, or too many unclaimed tenants exist. Next: Wait for the Retry-After time, then continue. Never retry creation in a loop; reuse your tenant.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "agent_token": [ ]
          }
        ]
      }
    },
    "/agent/v1/configurations/{configuration_id}/users/{key}": {
      "put": {
        "tags": [
          "AgentApi"
        ],
        "summary": "Edit a user",
        "description": "Edits a user; fields left out keep their value, and claims, when given, replace the user's claims.",
        "operationId": "edit_user",
        "parameters": [
          {
            "name": "configuration_id",
            "in": "path",
            "description": "The configuration id (from create_tenant or get_tenant).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "key",
            "in": "path",
            "description": "The user's key.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": [
                  "null",
                  "object"
                ],
                "properties": {
                  "key": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "The user key shown on the sign-in page and used as sub by default. Required when adding; fixed afterwards."
                  },
                  "display_name": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "The name shown on the sign-in page and emitted as the name claim."
                  },
                  "sub": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "The sub claim; the key when not set."
                  },
                  "icon": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "A built-in icon id for the sign-in page."
                  },
                  "access_token_sub": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "A different sub for access tokens only."
                  },
                  "claims": {
                    "type": [
                      "null",
                      "object"
                    ],
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "boolean"
                        },
                        {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      ]
                    },
                    "description": "The user's claims: name to a string, number, boolean or array of strings, e.g. { \"email\": \"alice@example.com\", \"roles\": [\"admin\"] }. Use fictional people only."
                  },
                  "claim_targets": {
                    "type": [
                      "null",
                      "object"
                    ],
                    "additionalProperties": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "description": "Which token each claim goes into: name to both (default), id_token or access_token."
                  },
                  "sign_in_outcome": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "How sign-in goes for this user: normal (default), access_denied, temporarily_unavailable, interaction_required (prompt=none fails) or refresh_revoked (refreshing fails with invalid_grant). Any value other than normal is a Pro feature (plan_required otherwise)."
                  }
                },
                "additionalProperties": false,
                "description": "A fictional test user. On edit, fields left out keep their value; claims, when given, replaces the user's claims."
              },
              "example": {
                "claims": {
                  "email": "alice@example.com",
                  "roles": [
                    "admin",
                    "reader"
                  ]
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Done. The body carries data, the tenant's status, the claim page URL while it is unclaimed, and next_steps.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "required": [
                            "configuration_id",
                            "name",
                            "profile",
                            "validate_client_secrets",
                            "clients",
                            "users",
                            "custom_claims",
                            "standard_claims",
                            "endpoints"
                          ],
                          "type": [
                            "null",
                            "object"
                          ],
                          "properties": {
                            "configuration_id": {
                              "type": "string",
                              "description": "The configuration_id of every configuration operation.",
                              "format": "uuid"
                            },
                            "name": {
                              "type": "string",
                              "description": "The configuration's name."
                            },
                            "profile": {
                              "type": "string",
                              "description": "Generic, Microsoft or AzureAdB2C."
                            },
                            "validate_client_secrets": {
                              "type": "boolean",
                              "description": "Whether client secrets are checked at the token endpoint."
                            },
                            "token_lifetime_minutes": {
                              "pattern": "^-?(?:0|[1-9]\\d*)$",
                              "type": [
                                "null",
                                "integer",
                                "string"
                              ],
                              "description": "Token lifetime in minutes; the default when absent."
                            },
                            "token_shape": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "scope_claim_name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "scope_claim_format": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "roles_claim_name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "roles_nested_key": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "access_token_audience": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                }
                              },
                              "description": "Generic profile: the claim shape options; absent when none are set."
                            },
                            "clients": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "client_id",
                                  "allow_all_return_urls",
                                  "redirect_uris",
                                  "allowed_scopes",
                                  "exposed_scopes"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "client_id": {
                                    "type": "string"
                                  },
                                  "client_secret": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "allow_all_return_urls": {
                                    "type": "boolean"
                                  },
                                  "redirect_uris": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "allowed_scopes": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "exposed_scopes": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "access_token_audience": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "claims": {
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array"
                                        },
                                        {
                                          "type": "object"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "description": "Read by the Generic profile only: this client's own claims in its client credentials access tokens. Seeded configurations may hold any JSON value.",
                                    "default": null
                                  },
                                  "app_permissions": {
                                    "type": [
                                      "null",
                                      "array"
                                    ],
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    },
                                    "description": "Read by the Microsoft and AzureAdB2C profiles only: resource-qualified app permissions, carried for {resource}/.default as roles (Microsoft) or scp (AzureAdB2C).",
                                    "default": null
                                  }
                                }
                              }
                            },
                            "users": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "key",
                                  "claims"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "key": {
                                    "type": "string"
                                  },
                                  "display_name": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "sub": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "icon": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "access_token_sub": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "claims": {
                                    "type": "object",
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array"
                                        },
                                        {
                                          "type": "object"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "description": "The user's claims: name to a string, number, boolean or array of strings. Seeded configurations may hold any JSON value."
                                  },
                                  "claim_targets": {
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "additionalProperties": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    },
                                    "description": "Claims that go into one token only: name to id_token or access_token; absent when all go into both."
                                  },
                                  "sign_in_outcome": {
                                    "type": "string",
                                    "description": "How sign-in goes for this user: normal, access_denied, temporarily_unavailable, interaction_required or refresh_revoked. Only in effect on a Pro or vetted tenant.",
                                    "default": "normal"
                                  }
                                }
                              }
                            },
                            "custom_claims": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "name",
                                  "value",
                                  "target"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "name": {
                                    "type": "string"
                                  },
                                  "value": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "boolean"
                                      },
                                      {
                                        "type": "array"
                                      },
                                      {
                                        "type": "object"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Seeded configurations may hold any JSON value."
                                  },
                                  "target": {
                                    "type": "string",
                                    "description": "both, id_token or access_token."
                                  }
                                }
                              }
                            },
                            "standard_claims": {
                              "required": [
                                "enabled",
                                "available"
                              ],
                              "type": "object",
                              "properties": {
                                "enabled": {
                                  "type": "array",
                                  "items": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "description": "The enabled standard claims."
                                },
                                "available": {
                                  "type": "array",
                                  "items": {
                                    "required": [
                                      "name",
                                      "description"
                                    ],
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "properties": {
                                      "name": {
                                        "type": "string"
                                      },
                                      "description": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "description": "The standard claims the profile offers, for set_standard_claims."
                                }
                              }
                            },
                            "endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": "object",
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "The OpenID Connect endpoints (issuer = authority)."
                            },
                            "entra_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "Microsoft profile only: the endpoints at the Entra ID URL shape."
                            },
                            "entra": {
                              "required": [
                                "instance",
                                "tenant_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "Instance: the HeyIdentity origin."
                                },
                                "tenant_id": {
                                  "type": "string",
                                  "description": "TenantId: the configuration id.",
                                  "format": "uuid"
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The authority, for libraries configured with one."
                                }
                              },
                              "description": "Microsoft profile only: the Microsoft.Identity.Web / MSAL settings."
                            },
                            "b2c_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "AzureAdB2C profile only: policy-aware runtime endpoints.",
                              "default": null
                            },
                            "b2c": {
                              "required": [
                                "instance",
                                "domain",
                                "sign_up_sign_in_policy_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "AzureAdB2C Instance: the app origin followed by a slash."
                                },
                                "domain": {
                                  "type": "string",
                                  "description": "AzureAdB2C Domain: the local configuration GUID.",
                                  "format": "uuid"
                                },
                                "sign_up_sign_in_policy_id": {
                                  "type": "string",
                                  "description": "The sole synthetic sign-in policy: B2C_1_signin."
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The policy-aware authority base passed to MSAL WithB2CAuthority, without /v2.0."
                                }
                              },
                              "description": "AzureAdB2C profile only: local authority and synthetic policy.",
                              "default": null
                            },
                            "b2c_policy_claim": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "description": "B2C policy claim: tfp or acr; inactive stored settings are preserved.",
                              "default": null
                            }
                          },
                          "description": "A configuration as items: settings, clients, users, custom and standard claims, and its endpoints."
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: A field is missing or invalid; field names it. Next: Fix that field and send the request again.\ninvalid_item: The item was rejected: a field is invalid, POST names an item that exists (\"A user with key \"x\" already exists.\"), PUT or DELETE names one that doesn't (\"User \"x\" no longer exists.\"), or the last user would be removed (\"At least one user is required.\"). Next: Read GET /agent/v1/configurations/{configuration_id}, PUT the items it lists and POST the ones it doesn't (fields left out of a PUT keep their value). Add your own users before removing the last one.\nusage_limit_exceeded: A limit of the tenant's tier was reached; limit names it and its maximum. The tier follows the plan (pro, enterprise) and otherwise the assurance level. Next: Remove an unused item, or ask the user to claim the tenant, which raises the limits. A claimed tenant on the free plan gets higher limits with the Pro plan (next_steps links to the plans). At the configuration limit of a claimed tenant, the user can delete a configuration they no longer need after signing in with email.\nplan_required: Signing-key rotation, or the field named by field (such as sign_in_outcome), needs an active Pro or Enterprise plan, or a vetted tenant. Nothing was saved. Next: For a field edit, leave it out, send the stored value or send normal. For signing-key rotation, ask the owner to activate Pro; reading keys works on every plan. Tell the user they can see the plans (next_steps links to them); an unverified tenant needs to be claimed first.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The agent token is missing, unknown or revoked. Next: Use the saved token. If it was lost or revoked, the tenant owner issues a new one after signing in with email.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "403": {
            "description": "issuer_suspended: The issuing member is suspended because the tenant has more members than its seat maximum allows. Its primary owner can restore access. Next: Stop and tell the user. Ask the primary owner to restore access, then retry with the same token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "404": {
            "description": "not_found: No configuration with this id belongs to your tenant, or there is no Agent API endpoint at that path. Next: GET /agent/v1/tenant lists your configurations; the catalog's endpoints list the API.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "409": {
            "description": "configuration_unloadable: This configuration can't be edited as items. Next: Ask the user to delete it after signing in with email, or to contact support.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "410": {
            "description": "tenant_expired: The tenant expired unclaimed and was deleted with its configuration. Next: Create a new tenant, request a claim code and show it with the claim page to the user, and update the application's configuration.\ntenant_deleted: The user deleted the tenant while signed in; deleted_at says when. It can't be restored. Next: Stop and ask the user whether they want a new tenant before creating one; never create one automatically.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "415": {
            "description": "unsupported_media_type: The request body is not JSON. Next: Send the body as JSON with Content-Type: application/json.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: A per-source, per-token, global or per-configuration signing-key rotation limit was hit, or too many unclaimed tenants exist. Next: Wait for the Retry-After time, then continue. Never retry creation in a loop; reuse your tenant.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "agent_token": [ ]
          }
        ]
      },
      "delete": {
        "tags": [
          "AgentApi"
        ],
        "summary": "Remove a user",
        "description": "Removes a user (at least one must remain).",
        "operationId": "remove_user",
        "parameters": [
          {
            "name": "configuration_id",
            "in": "path",
            "description": "The configuration id (from create_tenant or get_tenant).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "key",
            "in": "path",
            "description": "The user's key.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done. The body carries data, the tenant's status, the claim page URL while it is unclaimed, and next_steps.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "required": [
                            "configuration_id",
                            "name",
                            "profile",
                            "validate_client_secrets",
                            "clients",
                            "users",
                            "custom_claims",
                            "standard_claims",
                            "endpoints"
                          ],
                          "type": [
                            "null",
                            "object"
                          ],
                          "properties": {
                            "configuration_id": {
                              "type": "string",
                              "description": "The configuration_id of every configuration operation.",
                              "format": "uuid"
                            },
                            "name": {
                              "type": "string",
                              "description": "The configuration's name."
                            },
                            "profile": {
                              "type": "string",
                              "description": "Generic, Microsoft or AzureAdB2C."
                            },
                            "validate_client_secrets": {
                              "type": "boolean",
                              "description": "Whether client secrets are checked at the token endpoint."
                            },
                            "token_lifetime_minutes": {
                              "pattern": "^-?(?:0|[1-9]\\d*)$",
                              "type": [
                                "null",
                                "integer",
                                "string"
                              ],
                              "description": "Token lifetime in minutes; the default when absent."
                            },
                            "token_shape": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "scope_claim_name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "scope_claim_format": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "roles_claim_name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "roles_nested_key": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "access_token_audience": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                }
                              },
                              "description": "Generic profile: the claim shape options; absent when none are set."
                            },
                            "clients": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "client_id",
                                  "allow_all_return_urls",
                                  "redirect_uris",
                                  "allowed_scopes",
                                  "exposed_scopes"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "client_id": {
                                    "type": "string"
                                  },
                                  "client_secret": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "allow_all_return_urls": {
                                    "type": "boolean"
                                  },
                                  "redirect_uris": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "allowed_scopes": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "exposed_scopes": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "access_token_audience": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "claims": {
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array"
                                        },
                                        {
                                          "type": "object"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "description": "Read by the Generic profile only: this client's own claims in its client credentials access tokens. Seeded configurations may hold any JSON value.",
                                    "default": null
                                  },
                                  "app_permissions": {
                                    "type": [
                                      "null",
                                      "array"
                                    ],
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    },
                                    "description": "Read by the Microsoft and AzureAdB2C profiles only: resource-qualified app permissions, carried for {resource}/.default as roles (Microsoft) or scp (AzureAdB2C).",
                                    "default": null
                                  }
                                }
                              }
                            },
                            "users": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "key",
                                  "claims"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "key": {
                                    "type": "string"
                                  },
                                  "display_name": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "sub": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "icon": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "access_token_sub": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "claims": {
                                    "type": "object",
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array"
                                        },
                                        {
                                          "type": "object"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "description": "The user's claims: name to a string, number, boolean or array of strings. Seeded configurations may hold any JSON value."
                                  },
                                  "claim_targets": {
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "additionalProperties": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    },
                                    "description": "Claims that go into one token only: name to id_token or access_token; absent when all go into both."
                                  },
                                  "sign_in_outcome": {
                                    "type": "string",
                                    "description": "How sign-in goes for this user: normal, access_denied, temporarily_unavailable, interaction_required or refresh_revoked. Only in effect on a Pro or vetted tenant.",
                                    "default": "normal"
                                  }
                                }
                              }
                            },
                            "custom_claims": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "name",
                                  "value",
                                  "target"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "name": {
                                    "type": "string"
                                  },
                                  "value": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "boolean"
                                      },
                                      {
                                        "type": "array"
                                      },
                                      {
                                        "type": "object"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Seeded configurations may hold any JSON value."
                                  },
                                  "target": {
                                    "type": "string",
                                    "description": "both, id_token or access_token."
                                  }
                                }
                              }
                            },
                            "standard_claims": {
                              "required": [
                                "enabled",
                                "available"
                              ],
                              "type": "object",
                              "properties": {
                                "enabled": {
                                  "type": "array",
                                  "items": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "description": "The enabled standard claims."
                                },
                                "available": {
                                  "type": "array",
                                  "items": {
                                    "required": [
                                      "name",
                                      "description"
                                    ],
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "properties": {
                                      "name": {
                                        "type": "string"
                                      },
                                      "description": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "description": "The standard claims the profile offers, for set_standard_claims."
                                }
                              }
                            },
                            "endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": "object",
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "The OpenID Connect endpoints (issuer = authority)."
                            },
                            "entra_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "Microsoft profile only: the endpoints at the Entra ID URL shape."
                            },
                            "entra": {
                              "required": [
                                "instance",
                                "tenant_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "Instance: the HeyIdentity origin."
                                },
                                "tenant_id": {
                                  "type": "string",
                                  "description": "TenantId: the configuration id.",
                                  "format": "uuid"
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The authority, for libraries configured with one."
                                }
                              },
                              "description": "Microsoft profile only: the Microsoft.Identity.Web / MSAL settings."
                            },
                            "b2c_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "AzureAdB2C profile only: policy-aware runtime endpoints.",
                              "default": null
                            },
                            "b2c": {
                              "required": [
                                "instance",
                                "domain",
                                "sign_up_sign_in_policy_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "AzureAdB2C Instance: the app origin followed by a slash."
                                },
                                "domain": {
                                  "type": "string",
                                  "description": "AzureAdB2C Domain: the local configuration GUID.",
                                  "format": "uuid"
                                },
                                "sign_up_sign_in_policy_id": {
                                  "type": "string",
                                  "description": "The sole synthetic sign-in policy: B2C_1_signin."
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The policy-aware authority base passed to MSAL WithB2CAuthority, without /v2.0."
                                }
                              },
                              "description": "AzureAdB2C profile only: local authority and synthetic policy.",
                              "default": null
                            },
                            "b2c_policy_claim": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "description": "B2C policy claim: tfp or acr; inactive stored settings are preserved.",
                              "default": null
                            }
                          },
                          "description": "A configuration as items: settings, clients, users, custom and standard claims, and its endpoints."
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_item: The item was rejected: a field is invalid, POST names an item that exists (\"A user with key \"x\" already exists.\"), PUT or DELETE names one that doesn't (\"User \"x\" no longer exists.\"), or the last user would be removed (\"At least one user is required.\"). Next: Read GET /agent/v1/configurations/{configuration_id}, PUT the items it lists and POST the ones it doesn't (fields left out of a PUT keep their value). Add your own users before removing the last one.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The agent token is missing, unknown or revoked. Next: Use the saved token. If it was lost or revoked, the tenant owner issues a new one after signing in with email.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "403": {
            "description": "issuer_suspended: The issuing member is suspended because the tenant has more members than its seat maximum allows. Its primary owner can restore access. Next: Stop and tell the user. Ask the primary owner to restore access, then retry with the same token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "404": {
            "description": "not_found: No configuration with this id belongs to your tenant, or there is no Agent API endpoint at that path. Next: GET /agent/v1/tenant lists your configurations; the catalog's endpoints list the API.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "409": {
            "description": "configuration_unloadable: This configuration can't be edited as items. Next: Ask the user to delete it after signing in with email, or to contact support.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "410": {
            "description": "tenant_expired: The tenant expired unclaimed and was deleted with its configuration. Next: Create a new tenant, request a claim code and show it with the claim page to the user, and update the application's configuration.\ntenant_deleted: The user deleted the tenant while signed in; deleted_at says when. It can't be restored. Next: Stop and ask the user whether they want a new tenant before creating one; never create one automatically.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: A per-source, per-token, global or per-configuration signing-key rotation limit was hit, or too many unclaimed tenants exist. Next: Wait for the Retry-After time, then continue. Never retry creation in a loop; reuse your tenant.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "agent_token": [ ]
          }
        ]
      }
    },
    "/agent/v1/configurations/{configuration_id}/claims/custom": {
      "post": {
        "tags": [
          "AgentApi"
        ],
        "summary": "Add a custom claim",
        "description": "Adds a custom claim. Custom claims apply across the configuration. Claims targeting access tokens also apply to client-credentials tokens. A custom roles claim can give roles to clients without their own roles.",
        "operationId": "add_custom_claim",
        "parameters": [
          {
            "name": "configuration_id",
            "in": "path",
            "description": "The configuration id (from create_tenant or get_tenant).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "required": [
                  "name"
                ],
                "type": [
                  "null",
                  "object"
                ],
                "properties": {
                  "name": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "The claim name. Required when adding; fixed afterwards."
                  },
                  "value": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "number"
                      },
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    ],
                    "description": "The claim value: a string, number, boolean or array of strings, stored and emitted with that JSON type. Omitted or null: the empty string when adding, the stored value when editing."
                  },
                  "target": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "both (default), id_token or access_token."
                  }
                },
                "additionalProperties": false,
                "description": "Custom claims apply across the configuration. Claims targeting access tokens also apply to client-credentials tokens. A custom roles claim can give roles to clients without their own roles."
              },
              "example": {
                "name": "groups",
                "value": [
                  "testers",
                  "beta"
                ],
                "target": "access_token"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Done. The body carries data, the tenant's status, the claim page URL while it is unclaimed, and next_steps.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "required": [
                            "configuration_id",
                            "name",
                            "profile",
                            "validate_client_secrets",
                            "clients",
                            "users",
                            "custom_claims",
                            "standard_claims",
                            "endpoints"
                          ],
                          "type": [
                            "null",
                            "object"
                          ],
                          "properties": {
                            "configuration_id": {
                              "type": "string",
                              "description": "The configuration_id of every configuration operation.",
                              "format": "uuid"
                            },
                            "name": {
                              "type": "string",
                              "description": "The configuration's name."
                            },
                            "profile": {
                              "type": "string",
                              "description": "Generic, Microsoft or AzureAdB2C."
                            },
                            "validate_client_secrets": {
                              "type": "boolean",
                              "description": "Whether client secrets are checked at the token endpoint."
                            },
                            "token_lifetime_minutes": {
                              "pattern": "^-?(?:0|[1-9]\\d*)$",
                              "type": [
                                "null",
                                "integer",
                                "string"
                              ],
                              "description": "Token lifetime in minutes; the default when absent."
                            },
                            "token_shape": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "scope_claim_name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "scope_claim_format": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "roles_claim_name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "roles_nested_key": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "access_token_audience": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                }
                              },
                              "description": "Generic profile: the claim shape options; absent when none are set."
                            },
                            "clients": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "client_id",
                                  "allow_all_return_urls",
                                  "redirect_uris",
                                  "allowed_scopes",
                                  "exposed_scopes"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "client_id": {
                                    "type": "string"
                                  },
                                  "client_secret": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "allow_all_return_urls": {
                                    "type": "boolean"
                                  },
                                  "redirect_uris": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "allowed_scopes": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "exposed_scopes": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "access_token_audience": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "claims": {
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array"
                                        },
                                        {
                                          "type": "object"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "description": "Read by the Generic profile only: this client's own claims in its client credentials access tokens. Seeded configurations may hold any JSON value.",
                                    "default": null
                                  },
                                  "app_permissions": {
                                    "type": [
                                      "null",
                                      "array"
                                    ],
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    },
                                    "description": "Read by the Microsoft and AzureAdB2C profiles only: resource-qualified app permissions, carried for {resource}/.default as roles (Microsoft) or scp (AzureAdB2C).",
                                    "default": null
                                  }
                                }
                              }
                            },
                            "users": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "key",
                                  "claims"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "key": {
                                    "type": "string"
                                  },
                                  "display_name": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "sub": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "icon": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "access_token_sub": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "claims": {
                                    "type": "object",
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array"
                                        },
                                        {
                                          "type": "object"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "description": "The user's claims: name to a string, number, boolean or array of strings. Seeded configurations may hold any JSON value."
                                  },
                                  "claim_targets": {
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "additionalProperties": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    },
                                    "description": "Claims that go into one token only: name to id_token or access_token; absent when all go into both."
                                  },
                                  "sign_in_outcome": {
                                    "type": "string",
                                    "description": "How sign-in goes for this user: normal, access_denied, temporarily_unavailable, interaction_required or refresh_revoked. Only in effect on a Pro or vetted tenant.",
                                    "default": "normal"
                                  }
                                }
                              }
                            },
                            "custom_claims": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "name",
                                  "value",
                                  "target"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "name": {
                                    "type": "string"
                                  },
                                  "value": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "boolean"
                                      },
                                      {
                                        "type": "array"
                                      },
                                      {
                                        "type": "object"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Seeded configurations may hold any JSON value."
                                  },
                                  "target": {
                                    "type": "string",
                                    "description": "both, id_token or access_token."
                                  }
                                }
                              }
                            },
                            "standard_claims": {
                              "required": [
                                "enabled",
                                "available"
                              ],
                              "type": "object",
                              "properties": {
                                "enabled": {
                                  "type": "array",
                                  "items": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "description": "The enabled standard claims."
                                },
                                "available": {
                                  "type": "array",
                                  "items": {
                                    "required": [
                                      "name",
                                      "description"
                                    ],
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "properties": {
                                      "name": {
                                        "type": "string"
                                      },
                                      "description": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "description": "The standard claims the profile offers, for set_standard_claims."
                                }
                              }
                            },
                            "endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": "object",
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "The OpenID Connect endpoints (issuer = authority)."
                            },
                            "entra_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "Microsoft profile only: the endpoints at the Entra ID URL shape."
                            },
                            "entra": {
                              "required": [
                                "instance",
                                "tenant_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "Instance: the HeyIdentity origin."
                                },
                                "tenant_id": {
                                  "type": "string",
                                  "description": "TenantId: the configuration id.",
                                  "format": "uuid"
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The authority, for libraries configured with one."
                                }
                              },
                              "description": "Microsoft profile only: the Microsoft.Identity.Web / MSAL settings."
                            },
                            "b2c_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "AzureAdB2C profile only: policy-aware runtime endpoints.",
                              "default": null
                            },
                            "b2c": {
                              "required": [
                                "instance",
                                "domain",
                                "sign_up_sign_in_policy_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "AzureAdB2C Instance: the app origin followed by a slash."
                                },
                                "domain": {
                                  "type": "string",
                                  "description": "AzureAdB2C Domain: the local configuration GUID.",
                                  "format": "uuid"
                                },
                                "sign_up_sign_in_policy_id": {
                                  "type": "string",
                                  "description": "The sole synthetic sign-in policy: B2C_1_signin."
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The policy-aware authority base passed to MSAL WithB2CAuthority, without /v2.0."
                                }
                              },
                              "description": "AzureAdB2C profile only: local authority and synthetic policy.",
                              "default": null
                            },
                            "b2c_policy_claim": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "description": "B2C policy claim: tfp or acr; inactive stored settings are preserved.",
                              "default": null
                            }
                          },
                          "description": "A configuration as items: settings, clients, users, custom and standard claims, and its endpoints."
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: A field is missing or invalid; field names it. Next: Fix that field and send the request again.\ninvalid_item: The item was rejected: a field is invalid, POST names an item that exists (\"A user with key \"x\" already exists.\"), PUT or DELETE names one that doesn't (\"User \"x\" no longer exists.\"), or the last user would be removed (\"At least one user is required.\"). Next: Read GET /agent/v1/configurations/{configuration_id}, PUT the items it lists and POST the ones it doesn't (fields left out of a PUT keep their value). Add your own users before removing the last one.\nusage_limit_exceeded: A limit of the tenant's tier was reached; limit names it and its maximum. The tier follows the plan (pro, enterprise) and otherwise the assurance level. Next: Remove an unused item, or ask the user to claim the tenant, which raises the limits. A claimed tenant on the free plan gets higher limits with the Pro plan (next_steps links to the plans). At the configuration limit of a claimed tenant, the user can delete a configuration they no longer need after signing in with email.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The agent token is missing, unknown or revoked. Next: Use the saved token. If it was lost or revoked, the tenant owner issues a new one after signing in with email.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "403": {
            "description": "issuer_suspended: The issuing member is suspended because the tenant has more members than its seat maximum allows. Its primary owner can restore access. Next: Stop and tell the user. Ask the primary owner to restore access, then retry with the same token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "404": {
            "description": "not_found: No configuration with this id belongs to your tenant, or there is no Agent API endpoint at that path. Next: GET /agent/v1/tenant lists your configurations; the catalog's endpoints list the API.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "409": {
            "description": "configuration_unloadable: This configuration can't be edited as items. Next: Ask the user to delete it after signing in with email, or to contact support.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "410": {
            "description": "tenant_expired: The tenant expired unclaimed and was deleted with its configuration. Next: Create a new tenant, request a claim code and show it with the claim page to the user, and update the application's configuration.\ntenant_deleted: The user deleted the tenant while signed in; deleted_at says when. It can't be restored. Next: Stop and ask the user whether they want a new tenant before creating one; never create one automatically.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "415": {
            "description": "unsupported_media_type: The request body is not JSON. Next: Send the body as JSON with Content-Type: application/json.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: A per-source, per-token, global or per-configuration signing-key rotation limit was hit, or too many unclaimed tenants exist. Next: Wait for the Retry-After time, then continue. Never retry creation in a loop; reuse your tenant.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "agent_token": [ ]
          }
        ]
      }
    },
    "/agent/v1/configurations/{configuration_id}/claims/custom/{name}": {
      "put": {
        "tags": [
          "AgentApi"
        ],
        "summary": "Edit a custom claim",
        "description": "Edits a custom claim's value or target; fields left out keep their value.",
        "operationId": "edit_custom_claim",
        "parameters": [
          {
            "name": "configuration_id",
            "in": "path",
            "description": "The configuration id (from create_tenant or get_tenant).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "name",
            "in": "path",
            "description": "The custom claim's name.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": [
                  "null",
                  "object"
                ],
                "properties": {
                  "name": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "The claim name. Required when adding; fixed afterwards."
                  },
                  "value": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "number"
                      },
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    ],
                    "description": "The claim value: a string, number, boolean or array of strings, stored and emitted with that JSON type. Omitted or null: the empty string when adding, the stored value when editing."
                  },
                  "target": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "both (default), id_token or access_token."
                  }
                },
                "additionalProperties": false,
                "description": "Custom claims apply across the configuration. Claims targeting access tokens also apply to client-credentials tokens. A custom roles claim can give roles to clients without their own roles."
              },
              "example": {
                "value": "quality"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Done. The body carries data, the tenant's status, the claim page URL while it is unclaimed, and next_steps.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "required": [
                            "configuration_id",
                            "name",
                            "profile",
                            "validate_client_secrets",
                            "clients",
                            "users",
                            "custom_claims",
                            "standard_claims",
                            "endpoints"
                          ],
                          "type": [
                            "null",
                            "object"
                          ],
                          "properties": {
                            "configuration_id": {
                              "type": "string",
                              "description": "The configuration_id of every configuration operation.",
                              "format": "uuid"
                            },
                            "name": {
                              "type": "string",
                              "description": "The configuration's name."
                            },
                            "profile": {
                              "type": "string",
                              "description": "Generic, Microsoft or AzureAdB2C."
                            },
                            "validate_client_secrets": {
                              "type": "boolean",
                              "description": "Whether client secrets are checked at the token endpoint."
                            },
                            "token_lifetime_minutes": {
                              "pattern": "^-?(?:0|[1-9]\\d*)$",
                              "type": [
                                "null",
                                "integer",
                                "string"
                              ],
                              "description": "Token lifetime in minutes; the default when absent."
                            },
                            "token_shape": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "scope_claim_name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "scope_claim_format": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "roles_claim_name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "roles_nested_key": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "access_token_audience": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                }
                              },
                              "description": "Generic profile: the claim shape options; absent when none are set."
                            },
                            "clients": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "client_id",
                                  "allow_all_return_urls",
                                  "redirect_uris",
                                  "allowed_scopes",
                                  "exposed_scopes"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "client_id": {
                                    "type": "string"
                                  },
                                  "client_secret": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "allow_all_return_urls": {
                                    "type": "boolean"
                                  },
                                  "redirect_uris": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "allowed_scopes": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "exposed_scopes": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "access_token_audience": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "claims": {
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array"
                                        },
                                        {
                                          "type": "object"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "description": "Read by the Generic profile only: this client's own claims in its client credentials access tokens. Seeded configurations may hold any JSON value.",
                                    "default": null
                                  },
                                  "app_permissions": {
                                    "type": [
                                      "null",
                                      "array"
                                    ],
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    },
                                    "description": "Read by the Microsoft and AzureAdB2C profiles only: resource-qualified app permissions, carried for {resource}/.default as roles (Microsoft) or scp (AzureAdB2C).",
                                    "default": null
                                  }
                                }
                              }
                            },
                            "users": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "key",
                                  "claims"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "key": {
                                    "type": "string"
                                  },
                                  "display_name": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "sub": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "icon": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "access_token_sub": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "claims": {
                                    "type": "object",
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array"
                                        },
                                        {
                                          "type": "object"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "description": "The user's claims: name to a string, number, boolean or array of strings. Seeded configurations may hold any JSON value."
                                  },
                                  "claim_targets": {
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "additionalProperties": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    },
                                    "description": "Claims that go into one token only: name to id_token or access_token; absent when all go into both."
                                  },
                                  "sign_in_outcome": {
                                    "type": "string",
                                    "description": "How sign-in goes for this user: normal, access_denied, temporarily_unavailable, interaction_required or refresh_revoked. Only in effect on a Pro or vetted tenant.",
                                    "default": "normal"
                                  }
                                }
                              }
                            },
                            "custom_claims": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "name",
                                  "value",
                                  "target"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "name": {
                                    "type": "string"
                                  },
                                  "value": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "boolean"
                                      },
                                      {
                                        "type": "array"
                                      },
                                      {
                                        "type": "object"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Seeded configurations may hold any JSON value."
                                  },
                                  "target": {
                                    "type": "string",
                                    "description": "both, id_token or access_token."
                                  }
                                }
                              }
                            },
                            "standard_claims": {
                              "required": [
                                "enabled",
                                "available"
                              ],
                              "type": "object",
                              "properties": {
                                "enabled": {
                                  "type": "array",
                                  "items": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "description": "The enabled standard claims."
                                },
                                "available": {
                                  "type": "array",
                                  "items": {
                                    "required": [
                                      "name",
                                      "description"
                                    ],
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "properties": {
                                      "name": {
                                        "type": "string"
                                      },
                                      "description": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "description": "The standard claims the profile offers, for set_standard_claims."
                                }
                              }
                            },
                            "endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": "object",
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "The OpenID Connect endpoints (issuer = authority)."
                            },
                            "entra_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "Microsoft profile only: the endpoints at the Entra ID URL shape."
                            },
                            "entra": {
                              "required": [
                                "instance",
                                "tenant_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "Instance: the HeyIdentity origin."
                                },
                                "tenant_id": {
                                  "type": "string",
                                  "description": "TenantId: the configuration id.",
                                  "format": "uuid"
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The authority, for libraries configured with one."
                                }
                              },
                              "description": "Microsoft profile only: the Microsoft.Identity.Web / MSAL settings."
                            },
                            "b2c_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "AzureAdB2C profile only: policy-aware runtime endpoints.",
                              "default": null
                            },
                            "b2c": {
                              "required": [
                                "instance",
                                "domain",
                                "sign_up_sign_in_policy_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "AzureAdB2C Instance: the app origin followed by a slash."
                                },
                                "domain": {
                                  "type": "string",
                                  "description": "AzureAdB2C Domain: the local configuration GUID.",
                                  "format": "uuid"
                                },
                                "sign_up_sign_in_policy_id": {
                                  "type": "string",
                                  "description": "The sole synthetic sign-in policy: B2C_1_signin."
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The policy-aware authority base passed to MSAL WithB2CAuthority, without /v2.0."
                                }
                              },
                              "description": "AzureAdB2C profile only: local authority and synthetic policy.",
                              "default": null
                            },
                            "b2c_policy_claim": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "description": "B2C policy claim: tfp or acr; inactive stored settings are preserved.",
                              "default": null
                            }
                          },
                          "description": "A configuration as items: settings, clients, users, custom and standard claims, and its endpoints."
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: A field is missing or invalid; field names it. Next: Fix that field and send the request again.\ninvalid_item: The item was rejected: a field is invalid, POST names an item that exists (\"A user with key \"x\" already exists.\"), PUT or DELETE names one that doesn't (\"User \"x\" no longer exists.\"), or the last user would be removed (\"At least one user is required.\"). Next: Read GET /agent/v1/configurations/{configuration_id}, PUT the items it lists and POST the ones it doesn't (fields left out of a PUT keep their value). Add your own users before removing the last one.\nusage_limit_exceeded: A limit of the tenant's tier was reached; limit names it and its maximum. The tier follows the plan (pro, enterprise) and otherwise the assurance level. Next: Remove an unused item, or ask the user to claim the tenant, which raises the limits. A claimed tenant on the free plan gets higher limits with the Pro plan (next_steps links to the plans). At the configuration limit of a claimed tenant, the user can delete a configuration they no longer need after signing in with email.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The agent token is missing, unknown or revoked. Next: Use the saved token. If it was lost or revoked, the tenant owner issues a new one after signing in with email.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "403": {
            "description": "issuer_suspended: The issuing member is suspended because the tenant has more members than its seat maximum allows. Its primary owner can restore access. Next: Stop and tell the user. Ask the primary owner to restore access, then retry with the same token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "404": {
            "description": "not_found: No configuration with this id belongs to your tenant, or there is no Agent API endpoint at that path. Next: GET /agent/v1/tenant lists your configurations; the catalog's endpoints list the API.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "409": {
            "description": "configuration_unloadable: This configuration can't be edited as items. Next: Ask the user to delete it after signing in with email, or to contact support.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "410": {
            "description": "tenant_expired: The tenant expired unclaimed and was deleted with its configuration. Next: Create a new tenant, request a claim code and show it with the claim page to the user, and update the application's configuration.\ntenant_deleted: The user deleted the tenant while signed in; deleted_at says when. It can't be restored. Next: Stop and ask the user whether they want a new tenant before creating one; never create one automatically.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "415": {
            "description": "unsupported_media_type: The request body is not JSON. Next: Send the body as JSON with Content-Type: application/json.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: A per-source, per-token, global or per-configuration signing-key rotation limit was hit, or too many unclaimed tenants exist. Next: Wait for the Retry-After time, then continue. Never retry creation in a loop; reuse your tenant.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "agent_token": [ ]
          }
        ]
      },
      "delete": {
        "tags": [
          "AgentApi"
        ],
        "summary": "Remove a custom claim",
        "description": "Removes a custom claim.",
        "operationId": "remove_custom_claim",
        "parameters": [
          {
            "name": "configuration_id",
            "in": "path",
            "description": "The configuration id (from create_tenant or get_tenant).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "name",
            "in": "path",
            "description": "The custom claim's name.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Done. The body carries data, the tenant's status, the claim page URL while it is unclaimed, and next_steps.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "required": [
                            "configuration_id",
                            "name",
                            "profile",
                            "validate_client_secrets",
                            "clients",
                            "users",
                            "custom_claims",
                            "standard_claims",
                            "endpoints"
                          ],
                          "type": [
                            "null",
                            "object"
                          ],
                          "properties": {
                            "configuration_id": {
                              "type": "string",
                              "description": "The configuration_id of every configuration operation.",
                              "format": "uuid"
                            },
                            "name": {
                              "type": "string",
                              "description": "The configuration's name."
                            },
                            "profile": {
                              "type": "string",
                              "description": "Generic, Microsoft or AzureAdB2C."
                            },
                            "validate_client_secrets": {
                              "type": "boolean",
                              "description": "Whether client secrets are checked at the token endpoint."
                            },
                            "token_lifetime_minutes": {
                              "pattern": "^-?(?:0|[1-9]\\d*)$",
                              "type": [
                                "null",
                                "integer",
                                "string"
                              ],
                              "description": "Token lifetime in minutes; the default when absent."
                            },
                            "token_shape": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "scope_claim_name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "scope_claim_format": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "roles_claim_name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "roles_nested_key": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "access_token_audience": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                }
                              },
                              "description": "Generic profile: the claim shape options; absent when none are set."
                            },
                            "clients": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "client_id",
                                  "allow_all_return_urls",
                                  "redirect_uris",
                                  "allowed_scopes",
                                  "exposed_scopes"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "client_id": {
                                    "type": "string"
                                  },
                                  "client_secret": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "allow_all_return_urls": {
                                    "type": "boolean"
                                  },
                                  "redirect_uris": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "allowed_scopes": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "exposed_scopes": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "access_token_audience": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "claims": {
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array"
                                        },
                                        {
                                          "type": "object"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "description": "Read by the Generic profile only: this client's own claims in its client credentials access tokens. Seeded configurations may hold any JSON value.",
                                    "default": null
                                  },
                                  "app_permissions": {
                                    "type": [
                                      "null",
                                      "array"
                                    ],
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    },
                                    "description": "Read by the Microsoft and AzureAdB2C profiles only: resource-qualified app permissions, carried for {resource}/.default as roles (Microsoft) or scp (AzureAdB2C).",
                                    "default": null
                                  }
                                }
                              }
                            },
                            "users": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "key",
                                  "claims"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "key": {
                                    "type": "string"
                                  },
                                  "display_name": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "sub": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "icon": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "access_token_sub": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "claims": {
                                    "type": "object",
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array"
                                        },
                                        {
                                          "type": "object"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "description": "The user's claims: name to a string, number, boolean or array of strings. Seeded configurations may hold any JSON value."
                                  },
                                  "claim_targets": {
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "additionalProperties": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    },
                                    "description": "Claims that go into one token only: name to id_token or access_token; absent when all go into both."
                                  },
                                  "sign_in_outcome": {
                                    "type": "string",
                                    "description": "How sign-in goes for this user: normal, access_denied, temporarily_unavailable, interaction_required or refresh_revoked. Only in effect on a Pro or vetted tenant.",
                                    "default": "normal"
                                  }
                                }
                              }
                            },
                            "custom_claims": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "name",
                                  "value",
                                  "target"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "name": {
                                    "type": "string"
                                  },
                                  "value": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "boolean"
                                      },
                                      {
                                        "type": "array"
                                      },
                                      {
                                        "type": "object"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Seeded configurations may hold any JSON value."
                                  },
                                  "target": {
                                    "type": "string",
                                    "description": "both, id_token or access_token."
                                  }
                                }
                              }
                            },
                            "standard_claims": {
                              "required": [
                                "enabled",
                                "available"
                              ],
                              "type": "object",
                              "properties": {
                                "enabled": {
                                  "type": "array",
                                  "items": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "description": "The enabled standard claims."
                                },
                                "available": {
                                  "type": "array",
                                  "items": {
                                    "required": [
                                      "name",
                                      "description"
                                    ],
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "properties": {
                                      "name": {
                                        "type": "string"
                                      },
                                      "description": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "description": "The standard claims the profile offers, for set_standard_claims."
                                }
                              }
                            },
                            "endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": "object",
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "The OpenID Connect endpoints (issuer = authority)."
                            },
                            "entra_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "Microsoft profile only: the endpoints at the Entra ID URL shape."
                            },
                            "entra": {
                              "required": [
                                "instance",
                                "tenant_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "Instance: the HeyIdentity origin."
                                },
                                "tenant_id": {
                                  "type": "string",
                                  "description": "TenantId: the configuration id.",
                                  "format": "uuid"
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The authority, for libraries configured with one."
                                }
                              },
                              "description": "Microsoft profile only: the Microsoft.Identity.Web / MSAL settings."
                            },
                            "b2c_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "AzureAdB2C profile only: policy-aware runtime endpoints.",
                              "default": null
                            },
                            "b2c": {
                              "required": [
                                "instance",
                                "domain",
                                "sign_up_sign_in_policy_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "AzureAdB2C Instance: the app origin followed by a slash."
                                },
                                "domain": {
                                  "type": "string",
                                  "description": "AzureAdB2C Domain: the local configuration GUID.",
                                  "format": "uuid"
                                },
                                "sign_up_sign_in_policy_id": {
                                  "type": "string",
                                  "description": "The sole synthetic sign-in policy: B2C_1_signin."
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The policy-aware authority base passed to MSAL WithB2CAuthority, without /v2.0."
                                }
                              },
                              "description": "AzureAdB2C profile only: local authority and synthetic policy.",
                              "default": null
                            },
                            "b2c_policy_claim": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "description": "B2C policy claim: tfp or acr; inactive stored settings are preserved.",
                              "default": null
                            }
                          },
                          "description": "A configuration as items: settings, clients, users, custom and standard claims, and its endpoints."
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_item: The item was rejected: a field is invalid, POST names an item that exists (\"A user with key \"x\" already exists.\"), PUT or DELETE names one that doesn't (\"User \"x\" no longer exists.\"), or the last user would be removed (\"At least one user is required.\"). Next: Read GET /agent/v1/configurations/{configuration_id}, PUT the items it lists and POST the ones it doesn't (fields left out of a PUT keep their value). Add your own users before removing the last one.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The agent token is missing, unknown or revoked. Next: Use the saved token. If it was lost or revoked, the tenant owner issues a new one after signing in with email.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "403": {
            "description": "issuer_suspended: The issuing member is suspended because the tenant has more members than its seat maximum allows. Its primary owner can restore access. Next: Stop and tell the user. Ask the primary owner to restore access, then retry with the same token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "404": {
            "description": "not_found: No configuration with this id belongs to your tenant, or there is no Agent API endpoint at that path. Next: GET /agent/v1/tenant lists your configurations; the catalog's endpoints list the API.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "409": {
            "description": "configuration_unloadable: This configuration can't be edited as items. Next: Ask the user to delete it after signing in with email, or to contact support.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "410": {
            "description": "tenant_expired: The tenant expired unclaimed and was deleted with its configuration. Next: Create a new tenant, request a claim code and show it with the claim page to the user, and update the application's configuration.\ntenant_deleted: The user deleted the tenant while signed in; deleted_at says when. It can't be restored. Next: Stop and ask the user whether they want a new tenant before creating one; never create one automatically.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: A per-source, per-token, global or per-configuration signing-key rotation limit was hit, or too many unclaimed tenants exist. Next: Wait for the Retry-After time, then continue. Never retry creation in a loop; reuse your tenant.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "agent_token": [ ]
          }
        ]
      }
    },
    "/agent/v1/configurations/{configuration_id}/claims/standard": {
      "put": {
        "tags": [
          "AgentApi"
        ],
        "summary": "Set the enabled standard claims",
        "description": "Sets which of the profile's generated standard claims are enabled (see get_configuration's standard_claims.available).",
        "operationId": "set_standard_claims",
        "parameters": [
          {
            "name": "configuration_id",
            "in": "path",
            "description": "The configuration id (from create_tenant or get_tenant).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "required": [
                  "enabled"
                ],
                "type": [
                  "null",
                  "object"
                ],
                "properties": {
                  "enabled": {
                    "type": [
                      "null",
                      "array"
                    ],
                    "items": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "description": "The standard claims to enable, e.g. [\"auth_time\", \"jti\"]. Required. PUT .../claims/standard replaces the whole list: send the current list (GET /agent/v1/configurations/{configuration_id}) plus the new claim."
                  }
                },
                "additionalProperties": false,
                "description": "The profile's generated standard claims to enable (see the catalog's profiles[].standard_claims)."
              },
              "example": {
                "enabled": [
                  "auth_time",
                  "jti"
                ]
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Done. The body carries data, the tenant's status, the claim page URL while it is unclaimed, and next_steps.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "required": [
                            "configuration_id",
                            "name",
                            "profile",
                            "validate_client_secrets",
                            "clients",
                            "users",
                            "custom_claims",
                            "standard_claims",
                            "endpoints"
                          ],
                          "type": [
                            "null",
                            "object"
                          ],
                          "properties": {
                            "configuration_id": {
                              "type": "string",
                              "description": "The configuration_id of every configuration operation.",
                              "format": "uuid"
                            },
                            "name": {
                              "type": "string",
                              "description": "The configuration's name."
                            },
                            "profile": {
                              "type": "string",
                              "description": "Generic, Microsoft or AzureAdB2C."
                            },
                            "validate_client_secrets": {
                              "type": "boolean",
                              "description": "Whether client secrets are checked at the token endpoint."
                            },
                            "token_lifetime_minutes": {
                              "pattern": "^-?(?:0|[1-9]\\d*)$",
                              "type": [
                                "null",
                                "integer",
                                "string"
                              ],
                              "description": "Token lifetime in minutes; the default when absent."
                            },
                            "token_shape": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "scope_claim_name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "scope_claim_format": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "roles_claim_name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "roles_nested_key": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "access_token_audience": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                }
                              },
                              "description": "Generic profile: the claim shape options; absent when none are set."
                            },
                            "clients": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "client_id",
                                  "allow_all_return_urls",
                                  "redirect_uris",
                                  "allowed_scopes",
                                  "exposed_scopes"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "client_id": {
                                    "type": "string"
                                  },
                                  "client_secret": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "allow_all_return_urls": {
                                    "type": "boolean"
                                  },
                                  "redirect_uris": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "allowed_scopes": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "exposed_scopes": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "access_token_audience": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "claims": {
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array"
                                        },
                                        {
                                          "type": "object"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "description": "Read by the Generic profile only: this client's own claims in its client credentials access tokens. Seeded configurations may hold any JSON value.",
                                    "default": null
                                  },
                                  "app_permissions": {
                                    "type": [
                                      "null",
                                      "array"
                                    ],
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    },
                                    "description": "Read by the Microsoft and AzureAdB2C profiles only: resource-qualified app permissions, carried for {resource}/.default as roles (Microsoft) or scp (AzureAdB2C).",
                                    "default": null
                                  }
                                }
                              }
                            },
                            "users": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "key",
                                  "claims"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "key": {
                                    "type": "string"
                                  },
                                  "display_name": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "sub": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "icon": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "access_token_sub": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "claims": {
                                    "type": "object",
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array"
                                        },
                                        {
                                          "type": "object"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "description": "The user's claims: name to a string, number, boolean or array of strings. Seeded configurations may hold any JSON value."
                                  },
                                  "claim_targets": {
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "additionalProperties": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    },
                                    "description": "Claims that go into one token only: name to id_token or access_token; absent when all go into both."
                                  },
                                  "sign_in_outcome": {
                                    "type": "string",
                                    "description": "How sign-in goes for this user: normal, access_denied, temporarily_unavailable, interaction_required or refresh_revoked. Only in effect on a Pro or vetted tenant.",
                                    "default": "normal"
                                  }
                                }
                              }
                            },
                            "custom_claims": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "name",
                                  "value",
                                  "target"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "name": {
                                    "type": "string"
                                  },
                                  "value": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "boolean"
                                      },
                                      {
                                        "type": "array"
                                      },
                                      {
                                        "type": "object"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Seeded configurations may hold any JSON value."
                                  },
                                  "target": {
                                    "type": "string",
                                    "description": "both, id_token or access_token."
                                  }
                                }
                              }
                            },
                            "standard_claims": {
                              "required": [
                                "enabled",
                                "available"
                              ],
                              "type": "object",
                              "properties": {
                                "enabled": {
                                  "type": "array",
                                  "items": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "description": "The enabled standard claims."
                                },
                                "available": {
                                  "type": "array",
                                  "items": {
                                    "required": [
                                      "name",
                                      "description"
                                    ],
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "properties": {
                                      "name": {
                                        "type": "string"
                                      },
                                      "description": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "description": "The standard claims the profile offers, for set_standard_claims."
                                }
                              }
                            },
                            "endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": "object",
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "The OpenID Connect endpoints (issuer = authority)."
                            },
                            "entra_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "Microsoft profile only: the endpoints at the Entra ID URL shape."
                            },
                            "entra": {
                              "required": [
                                "instance",
                                "tenant_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "Instance: the HeyIdentity origin."
                                },
                                "tenant_id": {
                                  "type": "string",
                                  "description": "TenantId: the configuration id.",
                                  "format": "uuid"
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The authority, for libraries configured with one."
                                }
                              },
                              "description": "Microsoft profile only: the Microsoft.Identity.Web / MSAL settings."
                            },
                            "b2c_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "AzureAdB2C profile only: policy-aware runtime endpoints.",
                              "default": null
                            },
                            "b2c": {
                              "required": [
                                "instance",
                                "domain",
                                "sign_up_sign_in_policy_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "AzureAdB2C Instance: the app origin followed by a slash."
                                },
                                "domain": {
                                  "type": "string",
                                  "description": "AzureAdB2C Domain: the local configuration GUID.",
                                  "format": "uuid"
                                },
                                "sign_up_sign_in_policy_id": {
                                  "type": "string",
                                  "description": "The sole synthetic sign-in policy: B2C_1_signin."
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The policy-aware authority base passed to MSAL WithB2CAuthority, without /v2.0."
                                }
                              },
                              "description": "AzureAdB2C profile only: local authority and synthetic policy.",
                              "default": null
                            },
                            "b2c_policy_claim": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "description": "B2C policy claim: tfp or acr; inactive stored settings are preserved.",
                              "default": null
                            }
                          },
                          "description": "A configuration as items: settings, clients, users, custom and standard claims, and its endpoints."
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: A field is missing or invalid; field names it. Next: Fix that field and send the request again.\ninvalid_item: The item was rejected: a field is invalid, POST names an item that exists (\"A user with key \"x\" already exists.\"), PUT or DELETE names one that doesn't (\"User \"x\" no longer exists.\"), or the last user would be removed (\"At least one user is required.\"). Next: Read GET /agent/v1/configurations/{configuration_id}, PUT the items it lists and POST the ones it doesn't (fields left out of a PUT keep their value). Add your own users before removing the last one.\nusage_limit_exceeded: A limit of the tenant's tier was reached; limit names it and its maximum. The tier follows the plan (pro, enterprise) and otherwise the assurance level. Next: Remove an unused item, or ask the user to claim the tenant, which raises the limits. A claimed tenant on the free plan gets higher limits with the Pro plan (next_steps links to the plans). At the configuration limit of a claimed tenant, the user can delete a configuration they no longer need after signing in with email.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The agent token is missing, unknown or revoked. Next: Use the saved token. If it was lost or revoked, the tenant owner issues a new one after signing in with email.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "403": {
            "description": "issuer_suspended: The issuing member is suspended because the tenant has more members than its seat maximum allows. Its primary owner can restore access. Next: Stop and tell the user. Ask the primary owner to restore access, then retry with the same token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "404": {
            "description": "not_found: No configuration with this id belongs to your tenant, or there is no Agent API endpoint at that path. Next: GET /agent/v1/tenant lists your configurations; the catalog's endpoints list the API.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "409": {
            "description": "configuration_unloadable: This configuration can't be edited as items. Next: Ask the user to delete it after signing in with email, or to contact support.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "410": {
            "description": "tenant_expired: The tenant expired unclaimed and was deleted with its configuration. Next: Create a new tenant, request a claim code and show it with the claim page to the user, and update the application's configuration.\ntenant_deleted: The user deleted the tenant while signed in; deleted_at says when. It can't be restored. Next: Stop and ask the user whether they want a new tenant before creating one; never create one automatically.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "415": {
            "description": "unsupported_media_type: The request body is not JSON. Next: Send the body as JSON with Content-Type: application/json.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: A per-source, per-token, global or per-configuration signing-key rotation limit was hit, or too many unclaimed tenants exist. Next: Wait for the Retry-After time, then continue. Never retry creation in a loop; reuse your tenant.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "agent_token": [ ]
          }
        ]
      }
    },
    "/agent/v1/configurations/{configuration_id}/settings": {
      "put": {
        "tags": [
          "AgentApi"
        ],
        "summary": "Edit the settings",
        "description": "Edits the settings; fields left out keep their value.",
        "operationId": "edit_settings",
        "parameters": [
          {
            "name": "configuration_id",
            "in": "path",
            "description": "The configuration id (from create_tenant or get_tenant).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": [
                  "null",
                  "object"
                ],
                "properties": {
                  "profile": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "Generic, Microsoft or AzureAdB2C."
                  },
                  "b2c_policy_claim": {
                    "type": [
                      "null",
                      "string"
                    ],
                    "description": "AzureAdB2C policy claim: tfp (default) or acr (legacy). An omitted field preserves the stored setting, including across profile switches."
                  },
                  "validate_client_secrets": {
                    "type": [
                      "null",
                      "boolean"
                    ],
                    "description": "Require client secrets at the token endpoint."
                  },
                  "token_lifetime_minutes": {
                    "pattern": "^-?(?:0|[1-9]\\d*)$",
                    "type": [
                      "null",
                      "integer",
                      "string"
                    ],
                    "description": "Token lifetime in minutes (positive)."
                  },
                  "token_shape": {
                    "type": [
                      "null",
                      "object"
                    ],
                    "properties": {
                      "scope_claim_name": {
                        "type": [
                          "null",
                          "string"
                        ],
                        "description": "scope (default) or scp."
                      },
                      "scope_claim_format": {
                        "type": [
                          "null",
                          "string"
                        ],
                        "description": "string (default, space-separated) or array."
                      },
                      "roles_claim_name": {
                        "type": [
                          "null",
                          "string"
                        ],
                        "description": "Where roles are emitted, e.g. realm_access; roles when not set."
                      },
                      "roles_nested_key": {
                        "type": [
                          "null",
                          "string"
                        ],
                        "description": "Nests roles under this key of roles_claim_name, e.g. roles for realm_access.roles."
                      },
                      "access_token_audience": {
                        "type": [
                          "null",
                          "string"
                        ],
                        "description": "Whether the audience is sent as aud (default) or as client_id with no aud (like Cognito); Generic profile only, see the audience rule."
                      }
                    },
                    "additionalProperties": false,
                    "description": "Claim shape options (Generic profile only); fields left out keep their value."
                  }
                },
                "additionalProperties": false,
                "description": "The configuration's settings. Fields left out keep their value."
              },
              "example": {
                "token_lifetime_minutes": 30,
                "token_shape": {
                  "scope_claim_name": "scp",
                  "scope_claim_format": "array"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Done. The body carries data, the tenant's status, the claim page URL while it is unclaimed, and next_steps.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/AgentResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "required": [
                            "configuration_id",
                            "name",
                            "profile",
                            "validate_client_secrets",
                            "clients",
                            "users",
                            "custom_claims",
                            "standard_claims",
                            "endpoints"
                          ],
                          "type": [
                            "null",
                            "object"
                          ],
                          "properties": {
                            "configuration_id": {
                              "type": "string",
                              "description": "The configuration_id of every configuration operation.",
                              "format": "uuid"
                            },
                            "name": {
                              "type": "string",
                              "description": "The configuration's name."
                            },
                            "profile": {
                              "type": "string",
                              "description": "Generic, Microsoft or AzureAdB2C."
                            },
                            "validate_client_secrets": {
                              "type": "boolean",
                              "description": "Whether client secrets are checked at the token endpoint."
                            },
                            "token_lifetime_minutes": {
                              "pattern": "^-?(?:0|[1-9]\\d*)$",
                              "type": [
                                "null",
                                "integer",
                                "string"
                              ],
                              "description": "Token lifetime in minutes; the default when absent."
                            },
                            "token_shape": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "scope_claim_name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "scope_claim_format": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "roles_claim_name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "roles_nested_key": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "access_token_audience": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                }
                              },
                              "description": "Generic profile: the claim shape options; absent when none are set."
                            },
                            "clients": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "client_id",
                                  "allow_all_return_urls",
                                  "redirect_uris",
                                  "allowed_scopes",
                                  "exposed_scopes"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "client_id": {
                                    "type": "string"
                                  },
                                  "client_secret": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "allow_all_return_urls": {
                                    "type": "boolean"
                                  },
                                  "redirect_uris": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "allowed_scopes": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "exposed_scopes": {
                                    "type": "array",
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    }
                                  },
                                  "access_token_audience": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "claims": {
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array"
                                        },
                                        {
                                          "type": "object"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "description": "Read by the Generic profile only: this client's own claims in its client credentials access tokens. Seeded configurations may hold any JSON value.",
                                    "default": null
                                  },
                                  "app_permissions": {
                                    "type": [
                                      "null",
                                      "array"
                                    ],
                                    "items": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    },
                                    "description": "Read by the Microsoft and AzureAdB2C profiles only: resource-qualified app permissions, carried for {resource}/.default as roles (Microsoft) or scp (AzureAdB2C).",
                                    "default": null
                                  }
                                }
                              }
                            },
                            "users": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "key",
                                  "claims"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "key": {
                                    "type": "string"
                                  },
                                  "display_name": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "sub": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "icon": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "access_token_sub": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "claims": {
                                    "type": "object",
                                    "additionalProperties": {
                                      "anyOf": [
                                        {
                                          "type": "string"
                                        },
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "boolean"
                                        },
                                        {
                                          "type": "array"
                                        },
                                        {
                                          "type": "object"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "description": "The user's claims: name to a string, number, boolean or array of strings. Seeded configurations may hold any JSON value."
                                  },
                                  "claim_targets": {
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "additionalProperties": {
                                      "type": [
                                        "null",
                                        "string"
                                      ]
                                    },
                                    "description": "Claims that go into one token only: name to id_token or access_token; absent when all go into both."
                                  },
                                  "sign_in_outcome": {
                                    "type": "string",
                                    "description": "How sign-in goes for this user: normal, access_denied, temporarily_unavailable, interaction_required or refresh_revoked. Only in effect on a Pro or vetted tenant.",
                                    "default": "normal"
                                  }
                                }
                              }
                            },
                            "custom_claims": {
                              "type": "array",
                              "items": {
                                "required": [
                                  "name",
                                  "value",
                                  "target"
                                ],
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "properties": {
                                  "name": {
                                    "type": "string"
                                  },
                                  "value": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "boolean"
                                      },
                                      {
                                        "type": "array"
                                      },
                                      {
                                        "type": "object"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Seeded configurations may hold any JSON value."
                                  },
                                  "target": {
                                    "type": "string",
                                    "description": "both, id_token or access_token."
                                  }
                                }
                              }
                            },
                            "standard_claims": {
                              "required": [
                                "enabled",
                                "available"
                              ],
                              "type": "object",
                              "properties": {
                                "enabled": {
                                  "type": "array",
                                  "items": {
                                    "type": [
                                      "null",
                                      "string"
                                    ]
                                  },
                                  "description": "The enabled standard claims."
                                },
                                "available": {
                                  "type": "array",
                                  "items": {
                                    "required": [
                                      "name",
                                      "description"
                                    ],
                                    "type": [
                                      "null",
                                      "object"
                                    ],
                                    "properties": {
                                      "name": {
                                        "type": "string"
                                      },
                                      "description": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "description": "The standard claims the profile offers, for set_standard_claims."
                                }
                              }
                            },
                            "endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": "object",
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "The OpenID Connect endpoints (issuer = authority)."
                            },
                            "entra_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "Microsoft profile only: the endpoints at the Entra ID URL shape."
                            },
                            "entra": {
                              "required": [
                                "instance",
                                "tenant_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "Instance: the HeyIdentity origin."
                                },
                                "tenant_id": {
                                  "type": "string",
                                  "description": "TenantId: the configuration id.",
                                  "format": "uuid"
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The authority, for libraries configured with one."
                                }
                              },
                              "description": "Microsoft profile only: the Microsoft.Identity.Web / MSAL settings."
                            },
                            "b2c_endpoints": {
                              "required": [
                                "issuer",
                                "discovery",
                                "authorize",
                                "token",
                                "userinfo",
                                "jwks",
                                "end_session"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "issuer": {
                                  "type": "string"
                                },
                                "discovery": {
                                  "type": "string"
                                },
                                "authorize": {
                                  "type": "string"
                                },
                                "token": {
                                  "type": "string"
                                },
                                "userinfo": {
                                  "type": "string"
                                },
                                "jwks": {
                                  "type": "string"
                                },
                                "end_session": {
                                  "type": "string"
                                }
                              },
                              "description": "AzureAdB2C profile only: policy-aware runtime endpoints.",
                              "default": null
                            },
                            "b2c": {
                              "required": [
                                "instance",
                                "domain",
                                "sign_up_sign_in_policy_id",
                                "authority"
                              ],
                              "type": [
                                "null",
                                "object"
                              ],
                              "properties": {
                                "instance": {
                                  "type": "string",
                                  "description": "AzureAdB2C Instance: the app origin followed by a slash."
                                },
                                "domain": {
                                  "type": "string",
                                  "description": "AzureAdB2C Domain: the local configuration GUID.",
                                  "format": "uuid"
                                },
                                "sign_up_sign_in_policy_id": {
                                  "type": "string",
                                  "description": "The sole synthetic sign-in policy: B2C_1_signin."
                                },
                                "authority": {
                                  "type": "string",
                                  "description": "The policy-aware authority base passed to MSAL WithB2CAuthority, without /v2.0."
                                }
                              },
                              "description": "AzureAdB2C profile only: local authority and synthetic policy.",
                              "default": null
                            },
                            "b2c_policy_claim": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "description": "B2C policy claim: tfp or acr; inactive stored settings are preserved.",
                              "default": null
                            }
                          },
                          "description": "A configuration as items: settings, clients, users, custom and standard claims, and its endpoints."
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: A field is missing or invalid; field names it. Next: Fix that field and send the request again.\ninvalid_item: The item was rejected: a field is invalid, POST names an item that exists (\"A user with key \"x\" already exists.\"), PUT or DELETE names one that doesn't (\"User \"x\" no longer exists.\"), or the last user would be removed (\"At least one user is required.\"). Next: Read GET /agent/v1/configurations/{configuration_id}, PUT the items it lists and POST the ones it doesn't (fields left out of a PUT keep their value). Add your own users before removing the last one.\nusage_limit_exceeded: A limit of the tenant's tier was reached; limit names it and its maximum. The tier follows the plan (pro, enterprise) and otherwise the assurance level. Next: Remove an unused item, or ask the user to claim the tenant, which raises the limits. A claimed tenant on the free plan gets higher limits with the Pro plan (next_steps links to the plans). At the configuration limit of a claimed tenant, the user can delete a configuration they no longer need after signing in with email.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "401": {
            "description": "invalid_token: The agent token is missing, unknown or revoked. Next: Use the saved token. If it was lost or revoked, the tenant owner issues a new one after signing in with email.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "403": {
            "description": "issuer_suspended: The issuing member is suspended because the tenant has more members than its seat maximum allows. Its primary owner can restore access. Next: Stop and tell the user. Ask the primary owner to restore access, then retry with the same token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "404": {
            "description": "not_found: No configuration with this id belongs to your tenant, or there is no Agent API endpoint at that path. Next: GET /agent/v1/tenant lists your configurations; the catalog's endpoints list the API.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "409": {
            "description": "configuration_unloadable: This configuration can't be edited as items. Next: Ask the user to delete it after signing in with email, or to contact support.",
            "headers": {
              "Sunset": {
                "description": "Only while the tenant is unclaimed: when it is deleted (RFC 8594, HTTP date). Show the claim page URL to the user before then.",
                "schema": {
                  "type": "string"
                }
              },
              "HeyIdentity-Tenant-Assurance": {
                "description": "Only while the tenant is unclaimed: unverified.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "410": {
            "description": "tenant_expired: The tenant expired unclaimed and was deleted with its configuration. Next: Create a new tenant, request a claim code and show it with the claim page to the user, and update the application's configuration.\ntenant_deleted: The user deleted the tenant while signed in; deleted_at says when. It can't be restored. Next: Stop and ask the user whether they want a new tenant before creating one; never create one automatically.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "415": {
            "description": "unsupported_media_type: The request body is not JSON. Next: Send the body as JSON with Content-Type: application/json.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: A per-source, per-token, global or per-configuration signing-key rotation limit was hit, or too many unclaimed tenants exist. Next: Wait for the Retry-After time, then continue. Never retry creation in a loop; reuse your tenant.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "agent_token": [ ]
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "AgentResponse": {
        "type": [
          "null",
          "object"
        ],
        "properties": {
          "data": {
            "description": "The operation's result; absent on an error."
          },
          "error": {
            "type": [
              "null",
              "string"
            ],
            "description": "A stable error code (see each operation's error responses); absent on success."
          },
          "message": {
            "type": [
              "null",
              "string"
            ],
            "description": "What went wrong and what to do next, in plain words."
          },
          "field": {
            "type": [
              "null",
              "string"
            ],
            "description": "The request field an error is about, e.g. redirect_uris[0]."
          },
          "limit": {
            "required": [
              "name",
              "max"
            ],
            "type": [
              "null",
              "object"
            ],
            "properties": {
              "name": {
                "type": "string",
                "description": "The limit, e.g. max_clients_per_configuration."
              },
              "max": {
                "pattern": "^-?(?:0|[1-9]\\d*)$",
                "type": [
                  "integer",
                  "string"
                ],
                "description": "Its maximum at the tenant's assurance level."
              }
            },
            "description": "On usage_limit_exceeded: the limit that was reached and its maximum."
          },
          "tenant_status": {
            "required": [
              "assurance",
              "plan"
            ],
            "type": [
              "null",
              "object"
            ],
            "properties": {
              "assurance": {
                "type": "string",
                "description": "unverified, email_verified or vetted."
              },
              "expires_at": {
                "type": [
                  "null",
                  "string"
                ],
                "description": "When an unclaimed tenant is deleted; absent once claimed.",
                "format": "date-time"
              },
              "plan": {
                "type": "string",
                "description": "The tenant's plan: free, pro or enterprise. A pro or enterprise plan past its end is reported as free."
              },
              "plan_expires_at": {
                "type": [
                  "null",
                  "string"
                ],
                "description": "When the tenant's pro or enterprise plan ends; null for free.",
                "format": "date-time",
                "default": null
              }
            },
            "description": "The tenant's assurance, expiry and plan."
          },
          "claim_page_url": {
            "type": [
              "null",
              "string"
            ],
            "description": "While the tenant is unclaimed: the fixed claim page, with no secret. Request a claim code when the user wants to keep the tenant."
          },
          "existing_configuration": {
            "required": [
              "configuration_id",
              "name",
              "profile",
              "endpoints"
            ],
            "type": [
              "null",
              "object"
            ],
            "properties": {
              "configuration_id": {
                "type": "string",
                "description": "The configuration_id of every configuration operation.",
                "format": "uuid"
              },
              "name": {
                "type": "string",
                "description": "The configuration's name."
              },
              "profile": {
                "type": "string",
                "description": "Generic, Microsoft or AzureAdB2C."
              },
              "endpoints": {
                "required": [
                  "issuer",
                  "discovery",
                  "authorize",
                  "token",
                  "userinfo",
                  "jwks",
                  "end_session"
                ],
                "type": "object",
                "properties": {
                  "issuer": {
                    "type": "string"
                  },
                  "discovery": {
                    "type": "string"
                  },
                  "authorize": {
                    "type": "string"
                  },
                  "token": {
                    "type": "string"
                  },
                  "userinfo": {
                    "type": "string"
                  },
                  "jwks": {
                    "type": "string"
                  },
                  "end_session": {
                    "type": "string"
                  }
                },
                "description": "The OpenID Connect endpoints (issuer = authority)."
              },
              "entra_endpoints": {
                "required": [
                  "issuer",
                  "discovery",
                  "authorize",
                  "token",
                  "userinfo",
                  "jwks",
                  "end_session"
                ],
                "type": [
                  "null",
                  "object"
                ],
                "properties": {
                  "issuer": {
                    "type": "string"
                  },
                  "discovery": {
                    "type": "string"
                  },
                  "authorize": {
                    "type": "string"
                  },
                  "token": {
                    "type": "string"
                  },
                  "userinfo": {
                    "type": "string"
                  },
                  "jwks": {
                    "type": "string"
                  },
                  "end_session": {
                    "type": "string"
                  }
                },
                "description": "Microsoft profile only: the endpoints at the Entra ID URL shape."
              },
              "entra": {
                "required": [
                  "instance",
                  "tenant_id",
                  "authority"
                ],
                "type": [
                  "null",
                  "object"
                ],
                "properties": {
                  "instance": {
                    "type": "string",
                    "description": "Instance: the HeyIdentity origin."
                  },
                  "tenant_id": {
                    "type": "string",
                    "description": "TenantId: the configuration id.",
                    "format": "uuid"
                  },
                  "authority": {
                    "type": "string",
                    "description": "The authority, for libraries configured with one."
                  }
                },
                "description": "Microsoft profile only: the Microsoft.Identity.Web / MSAL settings."
              },
              "b2c_endpoints": {
                "required": [
                  "issuer",
                  "discovery",
                  "authorize",
                  "token",
                  "userinfo",
                  "jwks",
                  "end_session"
                ],
                "type": [
                  "null",
                  "object"
                ],
                "properties": {
                  "issuer": {
                    "type": "string"
                  },
                  "discovery": {
                    "type": "string"
                  },
                  "authorize": {
                    "type": "string"
                  },
                  "token": {
                    "type": "string"
                  },
                  "userinfo": {
                    "type": "string"
                  },
                  "jwks": {
                    "type": "string"
                  },
                  "end_session": {
                    "type": "string"
                  }
                },
                "description": "AzureAdB2C profile only: policy-aware runtime endpoints.",
                "default": null
              },
              "b2c": {
                "required": [
                  "instance",
                  "domain",
                  "sign_up_sign_in_policy_id",
                  "authority"
                ],
                "type": [
                  "null",
                  "object"
                ],
                "properties": {
                  "instance": {
                    "type": "string",
                    "description": "AzureAdB2C Instance: the app origin followed by a slash."
                  },
                  "domain": {
                    "type": "string",
                    "description": "AzureAdB2C Domain: the local configuration GUID.",
                    "format": "uuid"
                  },
                  "sign_up_sign_in_policy_id": {
                    "type": "string",
                    "description": "The sole synthetic sign-in policy: B2C_1_signin."
                  },
                  "authority": {
                    "type": "string",
                    "description": "The policy-aware authority base passed to MSAL WithB2CAuthority, without /v2.0."
                  }
                },
                "description": "AzureAdB2C profile only: local authority and synthetic policy.",
                "default": null
              },
              "b2c_policy_claim": {
                "type": [
                  "null",
                  "string"
                ],
                "description": "B2C policy claim: tfp or acr.",
                "default": null
              }
            },
            "description": "On configuration_exists: the configuration that already has the requested name."
          },
          "expired_at": {
            "type": [
              "null",
              "string"
            ],
            "description": "On tenant_expired: when the tenant expired.",
            "format": "date-time"
          },
          "deleted_at": {
            "type": [
              "null",
              "string"
            ],
            "description": "On tenant_deleted: when the user deleted the tenant.",
            "format": "date-time"
          },
          "current_terms_version": {
            "type": [
              "null",
              "string"
            ],
            "description": "On terms_not_accepted: the version to send as accepted_terms_version."
          },
          "terms_url": {
            "type": [
              "null",
              "string"
            ],
            "description": "On terms_not_accepted: where to read the terms."
          },
          "retry_after_seconds": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "description": "On rate_limited: seconds to wait, also sent as the Retry-After header."
          },
          "next_steps": {
            "type": "array",
            "items": {
              "required": [
                "kind",
                "message"
              ],
              "type": [
                "null",
                "object"
              ],
              "properties": {
                "kind": {
                  "type": "string",
                  "description": "show_user, persist, configure, guidance, claim_raises_limits, pro_raises_limits, reuse_configuration or create_new_tenant."
                },
                "message": {
                  "type": "string",
                  "description": "The step; for show_user, a message ready to show the user."
                },
                "urgent": {
                  "type": [
                    "null",
                    "boolean"
                  ],
                  "description": "True only for the last-day claim reminder.",
                  "default": null
                }
              }
            },
            "description": "What to do next, most important first. A show_user step has a message ready to show the user."
          }
        },
        "description": "The body of every Agent API response: data or an error, the tenant's status, the claim page URL while it is unclaimed, and next_steps."
      }
    },
    "securitySchemes": {
      "agent_token": {
        "type": "http",
        "description": "The agent token from create_tenant's data.agent_token (hid_agent_...), or one the tenant owner issued. Send it as 'Authorization: Bearer <agent_token>', never in a URL.",
        "scheme": "bearer",
        "bearerFormat": "hid_agent_..."
      }
    }
  },
  "tags": [
    {
      "name": "AgentApi"
    }
  ]
}