> ## Documentation Index
> Fetch the complete documentation index at: https://docs.knowledgestack.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Tenant

> Update tenant configuration.

Requires OWNER or ADMIN role in the tenant.



## OpenAPI

````yaml /openapi.yaml patch /v1/tenants/{tenant_id}
openapi: 3.1.0
info:
  title: Knowledge Stack API
  description: Knowledge Stack backend API for authentication and knowledge management
  version: 0.1.0
servers:
  - url: http://localhost:8000
    description: Knowledge Stack API local dev server
security: []
tags:
  - name: auth
    description: Authentication and identity management
  - name: users
    description: User accounts
  - name: tenants
    description: Tenant management
  - name: invites
    description: Tenant invitations
  - name: folders
    description: Folder management
  - name: documents
    description: Document management
  - name: document-versions
    description: Document version management
  - name: sections
    description: Document sections
  - name: chunks
    description: Chunk CRUD and semantic search
  - name: chunk-lineages
    description: Chunk lineage tracking
  - name: tags
    description: Tag management
  - name: path-parts
    description: Path part traversal and tagging
  - name: Threads
    description: Thread conversations
  - name: Thread Messages
    description: Thread message management
  - name: user-permissions
    description: User path permissions
  - name: workflows
    description: Ingestion workflows
paths:
  /v1/tenants/{tenant_id}:
    patch:
      tags:
        - tenants
      summary: Update Tenant
      description: |-
        Update tenant configuration.

        Requires OWNER or ADMIN role in the tenant.
      operationId: update_tenant
      parameters:
        - name: tenant_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Tenant Id
        - name: authorization
          in: header
          required: false
          schema:
            type: string
            nullable: true
            title: Authorization
        - name: ks_uat
          in: cookie
          required: false
          schema:
            type: string
            nullable: true
            title: Ks Uat
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateTenantRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TenantResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    UpdateTenantRequest:
      properties:
        name:
          type: string
          nullable: true
          title: Name
          description: Optional tenant name to update
        idp_config:
          $ref: '#/components/schemas/IdpConfig'
          nullable: true
          description: Optional external IdP configuration to update
        settings:
          $ref: '#/components/schemas/TenantSettingsUpdate'
          nullable: true
          description: Optional tenant settings to update
      additionalProperties: false
      type: object
      title: UpdateTenantRequest
      description: Update tenant request model.
    TenantResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
          description: Tenant ID
        name:
          type: string
          title: Name
          description: Tenant name
        idp_config:
          additionalProperties: true
          type: object
          nullable: true
          title: Idp Config
          description: External IdP configuration
        settings:
          $ref: '#/components/schemas/TenantSettingsResponse'
          description: User-configurable tenant settings
        branding:
          $ref: '#/components/schemas/TenantBrandingResponse'
          description: Resolved branding (colors, logo URLs, theme overrides)
      additionalProperties: false
      type: object
      required:
        - id
        - name
        - settings
      title: TenantResponse
      description: Tenant response model.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    IdpConfig:
      properties:
        provider:
          $ref: '#/components/schemas/SupportedIdP'
          description: Supported IdP provider
        configuration:
          additionalProperties: true
          type: object
          title: Configuration
          description: Provider-specific configuration
      type: object
      required:
        - provider
        - configuration
      title: IdpConfig
      description: |-
        Polymorphic IdP configuration for a tenant.

        Stored as JSONB in tenant.idp_config. The ``provider`` field
        determines which typed config class to use when parsing
        ``configuration``.
    TenantSettingsUpdate:
      properties:
        language:
          $ref: '#/components/schemas/SupportedLanguage'
          nullable: true
        description:
          type: string
          nullable: true
          title: Description
          description: Tenant description
        timezone:
          type: string
          nullable: true
          title: Timezone
          description: IANA timezone (e.g. 'America/New_York')
        brand_name:
          type: string
          nullable: true
          title: Brand Name
          description: Custom brand name for logo
        brand_color:
          type: string
          nullable: true
          title: Brand Color
          description: Primary brand hex color (e.g. '#2563eb')
        theme_overrides:
          additionalProperties:
            type: string
          type: object
          nullable: true
          title: Theme Overrides
          description: Custom CSS variable overrides
      additionalProperties: false
      type: object
      title: TenantSettingsUpdate
      description: Partial tenant settings update.
    TenantSettingsResponse:
      properties:
        language:
          $ref: '#/components/schemas/SupportedLanguage'
          description: Preferred language for the tenant
        description:
          type: string
          title: Description
          description: Tenant description
        timezone:
          type: string
          title: Timezone
          description: IANA timezone (e.g. 'America/New_York')
      additionalProperties: false
      type: object
      required:
        - language
        - description
        - timezone
      title: TenantSettingsResponse
      description: Tenant settings as exposed via API (no internal S3 URIs).
    TenantBrandingResponse:
      properties:
        brand_name:
          type: string
          nullable: true
          title: Brand Name
          description: Custom brand name for logo
        brand_color:
          type: string
          nullable: true
          title: Brand Color
          description: Primary brand hex color
        logo_url:
          type: string
          nullable: true
          title: Logo Url
          description: Presigned URL for primary logo
        logo_dark_url:
          type: string
          nullable: true
          title: Logo Dark Url
          description: Presigned URL for dark-mode logo
        favicon_url:
          type: string
          nullable: true
          title: Favicon Url
          description: Presigned URL for favicon
        theme_overrides:
          additionalProperties:
            type: string
          type: object
          nullable: true
          title: Theme Overrides
          description: Custom CSS variable overrides
      additionalProperties: false
      type: object
      title: TenantBrandingResponse
      description: Resolved branding with presigned URLs instead of internal S3 URIs.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    SupportedIdP:
      type: string
      enum:
        - OAUTH2
        - FANWEI_E9
      title: SupportedIdP
      description: Supported external identity providers for tenant-level IdP config.
    SupportedLanguage:
      type: string
      enum:
        - en
        - zh
      title: SupportedLanguage

````