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

# Create a new IRRF command



## OpenAPI

````yaml https://portal.unicontrol.me/v1/openapi post /v1/irrf-commands
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/irrf-commands:
    post:
      tags:
        - IRRF Commands
      summary: Create a new IRRF command
      operationId: postV1Irrf-commands
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - entity_id
                - command_name
                - code
                - remote_entity_id
              properties:
                entity_id:
                  type: string
                  description: entity_id da entidade controlada
                command_name:
                  type: string
                  description: 'Nome do comando (ex: power, volume_up)'
                code:
                  type: string
                  description: Código IR aprendido
                remote_entity_id:
                  type: string
                  description: entity_id do blaster IR
            example:
              entity_id: sensor.tv_sala
              command_name: power
              code: 0000 006C...
              remote_entity_id: remote.ir_blaster
      responses:
        '201':
          description: Command created
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                  entity_registry_id:
                    type: integer
                  config_entry_id:
                    type: integer
                  command_name:
                    type: string
                  code:
                    type: string
                  remote_entity_id:
                    type: string
                  user_id:
                    type: string
              example:
                id: 1
                entity_registry_id: 5
                config_entry_id: 2
                command_name: power
                code: 0000 006C 0022 0002...
                remote_entity_id: remote.ir_blaster
                user_id: user_abc123
        '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
        '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

````