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

# Editar workspace

> Atualiza o workspace. **Apenas o workspace da API Key** pode ser editado (`id` deve ser o workspaceId da chave). Campos opcionais: name, color, defaultInstanceId, defaultEmailDomainId, inboundSettingsPatch (merge parcial da política de inbound por canal). Requer escopo **workspace:update**. Instance e domain devem pertencer ao workspace. Para persistir inbound de WhatsApp em grupos, use `allowGroupChats` (instância não oficial).



## OpenAPI

````yaml /es/guides/workspaces/api-reference/openapi-workspaces.json put /v1/workspaces/{id}
openapi: 3.0.3
info:
  title: Notifique API — Workspaces
  description: >-
    API para **criar**, **editar** e **deletar** workspaces. Use para gerenciar
    múltiplos workspaces via API (criar novo workspace para o mesmo usuário,
    atualizar nome/cor/instância padrão ou remover um workspace).


    **Autenticação:** todas as rotas exigem API Key no header `Authorization:
    Bearer sk_live_xxxxx` ou `x-api-key: sk_live_xxxxx`. Editar e deletar só
    permitem operar no workspace ao qual a API Key pertence.
  version: 1.0.0
servers:
  - url: https://api.notifique.dev
    description: Produção
security:
  - BearerAuth: []
  - ApiKeyHeader: []
tags:
  - name: Workspaces
    description: CRUD de workspaces (criar, editar, deletar)
paths:
  /v1/workspaces/{id}:
    put:
      tags:
        - Workspaces
      summary: Editar workspace
      description: >-
        Atualiza o workspace. **Apenas o workspace da API Key** pode ser editado
        (`id` deve ser o workspaceId da chave). Campos opcionais: name, color,
        defaultInstanceId, defaultEmailDomainId, inboundSettingsPatch (merge
        parcial da política de inbound por canal). Requer escopo
        **workspace:update**. Instance e domain devem pertencer ao workspace.
        Para persistir inbound de WhatsApp em grupos, use `allowGroupChats`
        (instância não oficial).
      operationId: putV1WorkspacesById
      parameters:
        - name: id
          in: path
          required: true
          description: ID do workspace (deve ser o workspace da API Key).
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkspaceUpdateRequest'
            example:
              name: Workspace Renomeado
              color: '#10B981'
              defaultInstanceId: clzz...
              defaultEmailDomainId: null
              inboundSettingsPatch:
                channels:
                  sms:
                    enabled: true
                  whatsapp:
                    enabled: true
                    allowPrivateChats: true
                    allowGroupChats: false
      responses:
        '200':
          description: Workspace atualizado.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkspaceUpdateResponse'
              example:
                success: true
                data:
                  id: clxx...
                  name: Workspace Renomeado
                  slug: meu-workspace-123
                  color: '#10B981'
                  defaultInstanceId: clzz...
                  defaultEmailDomainId: null
                  inboundSettings:
                    version: 1
                    channels:
                      sms:
                        enabled: true
                      whatsapp:
                        enabled: true
                        allowPrivateChats: true
                        allowGroupChats: false
                      email:
                        enabled: true
                      telegram:
                        enabled: true
                  updatedAt: '2025-02-23T10:30:00.000Z'
        '400':
          description: Nome inválido ou instance/domain não pertencem ao workspace.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error: Bad Request
                code: VALIDATION_ERROR
                message: Campo inválido ou ausente.
        '401':
          description: API Key ausente ou inválida.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error: Bad Request
                code: VALIDATION_ERROR
                message: Campo inválido ou ausente.
        '403':
          description: Escopo workspace:update ausente ou id não é o workspace da API Key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error: Bad Request
                code: VALIDATION_ERROR
                message: Campo inválido ou ausente.
components:
  schemas:
    WorkspaceUpdateRequest:
      type: object
      properties:
        name:
          type: string
          maxLength: 64
        color:
          type: string
          nullable: true
          minLength: 7
          maxLength: 7
          pattern: ^#[0-9A-Fa-f]{6}$
          description: 'Cor em hexadecimal com # (ex.: #3B82F6); null para limpar.'
        defaultInstanceId:
          type: string
          nullable: true
          description: ID da instância WhatsApp padrão; null para limpar.
        defaultEmailDomainId:
          type: string
          nullable: true
          description: ID do domínio de e-mail padrão; null para limpar.
        inboundSettingsPatch:
          $ref: '#/components/schemas/InboundSettingsPatch'
      example:
        name: Exemplo
        color: string
        defaultInstanceId: clxx...
        defaultEmailDomainId: clxx...
        inboundSettingsPatch: {}
    WorkspaceUpdateResponse:
      type: object
      required:
        - success
        - data
      properties:
        success:
          type: boolean
          example: true
        data:
          type: object
          properties:
            id:
              type: string
            name:
              type: string
            slug:
              type: string
            color:
              type: string
              nullable: true
            defaultInstanceId:
              type: string
              nullable: true
            defaultEmailDomainId:
              type: string
              nullable: true
            inboundSettings:
              $ref: '#/components/schemas/InboundSettings'
            updatedAt:
              type: string
              format: date-time
      example:
        success: true
        data:
          id: clxx...
          name: Exemplo
          slug: string
          color: string
          defaultInstanceId: clxx...
          defaultEmailDomainId: clxx...
          inboundSettings:
            version: 1
            storagePricing: {}
            channels: {}
          updatedAt: '2025-02-10T14:00:00.000Z'
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
        message:
          type: string
        code:
          type: string
        details:
          type: array
          items:
            type: object
            properties:
              field:
                type: string
              message:
                type: string
      example:
        success: false
        error: string
        message: string
        code: string
        details:
          - field: string
            message: string
    InboundSettingsPatch:
      type: object
      description: >-
        Merge parcial da política inbound (v2). Ex.:
        `channels.sms.{enabled,defaultActions,rules}`,
        `channels.whatsapp.{enabled,allowPrivateChats,allowGroupChats,dm,group}`,
        `storagePricing`.
      additionalProperties: true
      properties:
        channels:
          type: object
          additionalProperties: true
          example:
            sms:
              enabled: true
            whatsapp:
              enabled: true
              allowPrivateChats: true
              allowGroupChats: false
          properties:
            sms:
              type: object
              additionalProperties: true
              example:
                enabled: true
            whatsapp:
              type: object
              additionalProperties: true
              example:
                enabled: true
                allowPrivateChats: true
                allowGroupChats: false
      example:
        channels:
          sms:
            enabled: true
          whatsapp:
            enabled: true
            allowPrivateChats: true
            allowGroupChats: false
    InboundSettings:
      type: object
      description: >-
        Política efetiva de inbound (sempre **v2** na resposta da API;
        documentos **v1** no banco são promovidos ao ler). `channels` inclui
        `sms`, `whatsapp` (com `dm` e `group`, cada um com
        `defaultActions.persist|webhook` e `rules`), `email`, `telegram`, `rcs`.
        Opcional `storagePricing` com `credits`/`cents` (null = usar padrão da
        plataforma via env).
      properties:
        version:
          type: integer
          enum:
            - 1
            - 2
          description: Versão do documento persistido (1 legado) ou resolvida (2).
        storagePricing:
          type: object
          additionalProperties: true
        channels:
          type: object
          additionalProperties: true
          properties:
            sms:
              type: object
              additionalProperties: true
              example:
                enabled: true
              properties:
                enabled:
                  type: boolean
                  example: true
            whatsapp:
              type: object
              additionalProperties: true
              example:
                enabled: true
                allowPrivateChats: true
                allowGroupChats: true
              properties:
                enabled:
                  type: boolean
                  example: true
                allowPrivateChats:
                  type: boolean
                  example: true
                allowGroupChats:
                  type: boolean
                  example: false
            email:
              type: object
              additionalProperties: true
              example:
                enabled: true
              properties:
                enabled:
                  type: boolean
                  example: true
            telegram:
              type: object
              additionalProperties: true
              example:
                enabled: true
              properties:
                enabled:
                  type: boolean
                  example: true
      additionalProperties: true
      example:
        version: 1
        storagePricing: {}
        channels: {}
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: 'API Key: Authorization: Bearer sk_live_xxxxx'
    ApiKeyHeader:
      type: apiKey
      in: header
      name: x-api-key
      description: 'API Key: x-api-key: sk_live_xxxxx'

````