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

# Registrar push VoIP para um ramal (UPSERT idempotente)



## OpenAPI

````yaml https://portal.unicontrol.me/v1/openapi post /v1/voip/push-registrations
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/voip/push-registrations:
    post:
      tags:
        - VoIP
      summary: Registrar push VoIP para um ramal (UPSERT idempotente)
      operationId: postV1VoipPush-registrations
      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:
                - device_id
                - voip_account_id
                - push_token
                - platform
                - bundle_id
              properties:
                device_id:
                  type: string
                  description: UUID estável do device (mesmo de /v1/mobile_app/register)
                voip_account_id:
                  type: integer
                  description: ID do ramal em voip_accounts
                push_token:
                  type: string
                  description: Token PushKit (iOS) / FCM (Android, Fase 2)
                platform:
                  type: string
                  enum:
                    - ios
                    - android
                bundle_id:
                  type: string
                  example: com.unicontrol.portal
                environment:
                  type: string
                  enum:
                    - sandbox
                    - production
                  nullable: true
                  description: >-
                    Só iOS. App envia explicitamente porque bundle_id não
                    distingue.
            example:
              device_id: b1c2d3e4-...
              voip_account_id: 42
              push_token: a3f9c2...
              platform: ios
              bundle_id: com.unicontrol.portal
              environment: production
      responses:
        '200':
          description: Registration criada ou atualizada
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                  voip_account_id:
                    type: integer
                  config_entry_id:
                    type: integer
                  org_id:
                    type: string
                    nullable: true
                  platform:
                    type: string
                    enum:
                      - ios
                      - android
                  push_token:
                    type: string
                  bundle_id:
                    type: string
                  environment:
                    type: string
                    enum:
                      - sandbox
                      - production
                    nullable: true
                  created_at:
                    type: string
                    format: date-time
                  updated_at:
                    type: string
                    format: date-time
              example:
                id: 1
                voip_account_id: 42
                config_entry_id: 128
                org_id: org_xyz
                platform: ios
                push_token: a3f9c2...
                bundle_id: com.unicontrol.portal
                environment: production
                created_at: '2026-09-25T10:00:00Z'
                updated_at: '2026-09-25T10:00:00Z'
        '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
        '404':
          description: Recurso não encontrado
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
              example:
                message: not found
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.