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

# Cria ou retorna uma conversa 1:1 com outro membro da organização



## OpenAPI

````yaml https://portal.unicontrol.me/v1/openapi post /v1/conversations
openapi: 3.1.0
info:
  title: Unicontrol API
  description: Welcome
  version: 1.0.0
servers:
  - url: http://0.0.0.0:3000
    description: Local Server
  - url: https://portal.test.flexhome.casa
    description: Development
  - url: https://portal.unicontrol.me
    description: Production
security:
  - bearerAuth: []
paths:
  /v1/conversations:
    post:
      tags:
        - Conversations
      summary: Cria ou retorna uma conversa 1:1 com outro membro da organização
      operationId: postV1Conversations
      parameters:
        - in: header
          name: X-Organization-Id
          required: false
          schema:
            type: string
          description: >-
            ID da organização para contexto (opcional). Quando presente, filtra
            recursos da org.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - user_id
              properties:
                user_id:
                  type: string
                  description: ID do outro membro da organização
            example:
              user_id: user_bob
      responses:
        '200':
          description: Conversa criada ou existente
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                  org_id:
                    type: string
                  kind:
                    type: string
                    enum:
                      - direct
                      - group
                  name:
                    type: string
                    nullable: true
                    description: Nome do grupo (null em 1:1)
                  is_public:
                    type: boolean
                    description: true para o grupo canônico 'Público' da org
                  created_at:
                    type: string
                    format: date-time
                  last_message_at:
                    type: string
                    format: date-time
                    nullable: true
                  participants:
                    type: array
                    items:
                      type: object
                      properties:
                        user_id:
                          type: string
                  last_message:
                    type: object
                    nullable: true
                    properties:
                      id:
                        type: integer
                      sender_user_id:
                        type: string
                      content:
                        type: string
                      sent_at:
                        type: string
                        format: date-time
                  unread_count:
                    type: integer
              example:
                id: 1
                org_id: org_abc
                kind: direct
                name: null
                is_public: false
                created_at: '2026-09-01T10:00:00Z'
                last_message_at: '2026-09-01T10:05:00Z'
                participants:
                  - user_id: user_alice
                  - user_id: user_bob
                last_message:
                  id: 42
                  sender_user_id: user_bob
                  content: Oi, tudo bem?
                  sent_at: '2026-09-01T10:05:00Z'
                unread_count: 1
        '400':
          description: Dados inválidos
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
              example:
                message: validation error
        '401':
          description: Não autenticado
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
              example:
                error: unauthorized
        '403':
          description: Acesso negado
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
              example:
                error: forbidden
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````