> ## 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.

# Criar workspace

> Cria um novo workspace para o **mesmo usuário** que é dono do workspace da API Key. O usuário é identificado pelo membro OWNER do workspace atual. Requer escopo **workspace:create**. Respeita o limite de workspaces por usuário (ex.: 3); retorna 403 com `WORKSPACE_SLOTS_LIMIT_REACHED` se excedido.



## OpenAPI

````yaml /es/guides/workspaces/api-reference/openapi-workspaces.json post /v1/workspaces
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:
    post:
      tags:
        - Workspaces
      summary: Criar workspace
      description: >-
        Cria um novo workspace para o **mesmo usuário** que é dono do workspace
        da API Key. O usuário é identificado pelo membro OWNER do workspace
        atual. Requer escopo **workspace:create**. Respeita o limite de
        workspaces por usuário (ex.: 3); retorna 403 com
        `WORKSPACE_SLOTS_LIMIT_REACHED` se excedido.
      operationId: postV1Workspaces
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkspaceCreateRequest'
            example:
              name: Meu Novo Workspace
              color: '#3B82F6'
      responses:
        '200':
          description: Workspace criado com sucesso.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkspaceSingleResponse'
              example:
                success: true
                data:
                  id: clxx...
                  name: Meu Novo Workspace
                  slug: meu-novo-workspace-42
                  color: '#3B82F6'
                  createdAt: '2025-02-23T10:00:00.000Z'
        '400':
          description: Nome inválido (vazio ou maior que 64 caracteres).
          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:create ausente ou limite de workspaces atingido
            (WORKSPACE_SLOTS_LIMIT_REACHED).
          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:
    WorkspaceCreateRequest:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 64
          description: Nome do workspace.
        color:
          type: string
          minLength: 7
          maxLength: 7
          pattern: ^#[0-9A-Fa-f]{6}$
          description: 'Cor em hexadecimal com # (ex.: #3B82F6). Opcional.'
      example:
        name: Exemplo
        color: string
    WorkspaceSingleResponse:
      type: object
      required:
        - success
        - data
      properties:
        success:
          type: boolean
          example: true
        data:
          $ref: '#/components/schemas/Workspace'
      example:
        success: true
        data:
          id: clxx...
          name: Exemplo
          slug: string
          color: string
          defaultInstanceId: clxx...
          defaultEmailDomainId: clxx...
          createdAt: '2025-02-10T14:00:00.000Z'
          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
    Workspace:
      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
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
      example:
        id: clxx...
        name: Exemplo
        slug: string
        color: string
        defaultInstanceId: clxx...
        defaultEmailDomainId: clxx...
        createdAt: '2025-02-10T14:00:00.000Z'
        updatedAt: '2025-02-10T14:00:00.000Z'
  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'

````