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

# Crear una nueva empresa

> Registro de una nueva empresa en el sistema.



## OpenAPI

````yaml /api-reference/openapi/openapi.yaml post /api/clientcompanies
openapi: 3.0.0
info:
  title: Kubifactu API
  description: API para el procesamiento y gestión de facturas de Veri*Factu
  version: 1.0.0
  contact:
    email: soporte@kubifactu.com
    name: Soporte KubiFACTU
    url: https://apidocs.kubifactu.com
servers:
  - url: https://api.kubifactu.com
    description: Servidor de producción
  - url: https://devapi.kubifactu.com
    description: Servidor de pruebas
security: []
paths:
  /api/clientcompanies:
    post:
      summary: Crear una nueva empresa
      description: Registro de una nueva empresa en el sistema.
      operationId: createClientCompany
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateClientCompanyRequest'
      responses:
        '200':
          description: Empresa creada con éxito.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateClientCompanyResponse'
        '403':
          description: No autorizado. La API-KEY proporcionada no es válida.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedApiKeyErrorResponse'
        '422':
          description: Errores de validación.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
        '500':
          description: Error interno del servidor.
      security:
        - owner_api_key: []
components:
  schemas:
    CreateClientCompanyRequest:
      type: object
      properties:
        company_name:
          type: string
          description: Nombre de la empresa.
          example: Empresa de ejemplo
        tax_id_number:
          type: string
          description: NIF/CIF de la empresa.
          example: S6271969E
        email:
          type: string
          format: email
          description: Correo electrónico de la empresa.
          example: empresa@prueba.net
      required:
        - company_name
        - tax_id_number
        - email
    CreateClientCompanyResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            id:
              type: string
              format: uuid
              description: Identificador único de la empresa creada.
              example: 9dcccd85-496d-4ed8-8f78-edfacac68964
            company_name:
              type: string
              description: Nombre de la empresa.
              example: Empresa de ejemplo
            tax_id_number:
              type: string
              description: NIF/CIF de la empresa.
              example: S6271969E
            email:
              type: string
              format: email
              description: Correo electrónico de la empresa.
              example: empresa@pruebas.net
            api_key:
              type: string
              description: API Key generada para la empresa.
              example: >-
                Xxv3en85OJOtI7Q6XFNGuA3FPwDNsnhk1kbtlQ5RgRSAdoo47eSGGYbgfLs8Qf2obGJluvY28a0tIqeM1UjzdbHDSDp1Q0fNX9sz
    UnauthorizedApiKeyErrorResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            error:
              type: object
              properties:
                code:
                  type: string
                  description: Código de error que indica el tipo de problema.
                  example: E-UNAUTH-APIKEY
                message:
                  type: string
                  description: Mensaje detallado del error.
                  example: >-
                    No client with API-KEY
                    '5tVySMGJOpq8HfMgIX28Qz6kF0dFOoq37x55PLZcWsGeGeYkNgJyAcRTlFJ5NbVoDRm8qtCywEoiN3A9JkBanMBXYmxiqR3BItxgxx'
                    was found.
                http_code:
                  type: integer
                  description: Código HTTP asociado al error.
                  example: 403
                errors:
                  type: object
                  nullable: true
                  description: >
                    Detalles adicionales del error. Puede ser `null` si no hay
                    información específica.
                  example: null
                details:
                  type: object
                  properties:
                    request_id:
                      type: string
                      description: Identificador único de la solicitud para rastreo.
                      example: 2cc8ef846029ec69613711ad1d85f6dfebf16ffb
    ValidationErrorResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            error:
              type: object
              properties:
                message:
                  type: string
                  description: Mensaje general del error.
                  example: The given data was invalid.
                errors:
                  type: object
                  additionalProperties:
                    type: array
                    items:
                      type: string
                  description: >
                    Lista de errores de validación organizados por campo.

                    Cada clave es el nombre del campo asociado al error y
                    contiene un array de mensajes.
                  example:
                    invoice_exists:
                      - >-
                        An invoice already exists with the indicated invoice
                        number and fiscal for the provided SIF. Existing invoice
                        ID: [9db6bb78-6799-4abb-b9a0-22d127c543ed].
                    incorrect_total_quota:
                      - >-
                        The total quota of the invoice does not match the total
                        tax quota and equalization_tax_quota of the lines.
                        Calculated total quota: [26.25].
                    incorrect_total_amount:
                      - >-
                        The total amount of the invoice does not match the total
                        tax base of the lines. Calculated total amount:
                        [151.25].
                details:
                  type: object
                  properties:
                    request_id:
                      type: string
                      format: uuid
                      description: Identificador único de la solicitud para rastreo.
                      example: 9ded9e2c-d59e-4432-a926-652cbcfac365
  securitySchemes:
    owner_api_key:
      type: apiKey
      name: X-Qbikode-UserApiKey
      in: header
      description: >
        API-KEY del intermediario que hace la petición. Este dato se puede
        consultar en el panel web, en la página de _Perfil de usuario_.

````