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

# Actualizar parcialmente una cuenta

> Actualización parcial — útil, por ejemplo, para alternar `estaEnAmbienteDePruebas` o rotar el certificado de firma.



## OpenAPI

````yaml /api-reference/openapi.json patch /cuenta/{id}
openapi: 3.1.0
info:
  title: Fegora API
  version: '1.0'
  description: >-
    API de Fegora para la emisión y consulta de Documentos Tributarios
    Electrónicos (DTE) en Guatemala, El Salvador y República Dominicana.


    El API es uno solo para los tres países: el país de operación lo determina
    la configuración de la cuenta emisora (no la URL ni ningún parámetro de la
    solicitud). Los campos que varían por país — tipos de documento, catálogos
    de impuestos, identificadores fiscales del receptor, datos adicionales — se
    documentan en la descripción de cada campo.


    Autenticación: OAuth2 (`POST /token`, grant types `password` y
    `refresh_token`) → JWT Bearer con vigencia de 24 horas.
servers:
  - url: https://api.fegora.com
security:
  - bearerAuth: []
tags:
  - name: Autenticación
    description: Obtención y renovación de tokens de acceso.
  - name: DTE
    description: Emisión, consulta, anulación y distribución de documentos emitidos.
  - name: DTE Recibidos
    description: Documentos donde la cuenta es el receptor (facturas de proveedores).
  - name: Lotes
    description: Carga masiva de DTEs mediante archivos Excel.
  - name: Cuentas
    description: Administración de cuentas emisoras/receptoras.
  - name: Catálogos
    description: >-
      Catálogos de referencia: productos, plantillas de PDF, localidades y
      contribuyentes.
  - name: Otros
    description: Endpoints de soporte, como el perfil del usuario autenticado.
paths:
  /cuenta/{id}:
    patch:
      tags:
        - Cuentas
      summary: Actualizar parcialmente una cuenta
      description: >-
        Actualización parcial — útil, por ejemplo, para alternar
        `estaEnAmbienteDePruebas` o rotar el certificado de firma.
      operationId: patchCuentaByid
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CuentaRequest'
            examples:
              modoPruebas:
                summary: Cambiar a ambiente de pruebas
                value:
                  estaEnAmbienteDePruebas: true
      responses:
        '200':
          description: Cuenta actualizada.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Cuenta'
              examples:
                ok:
                  value:
                    id: '12345678'
                    idCanal: 1
                    canal:
                      id: 1
                      nombre: API
                      nombreCorto: api
                    idCertificador: '12345678'
                    certificador:
                      id: '12345678'
                    tieneCertificado: true
                    direccionCorreoElectronico: ventas@ejemplo.com.gt
                    direccionWeb: ejemplo.com.gt
                    telefonos: 2222-1155, 5555-6654
                    logoUri: https://cdn.fegora.com/imagenes/12345678_logo.png
                    slogan: De todo para todos
                    emiteFacturas: true
                    recibeFacturas: false
                    estaEnAmbienteDePruebas: true
                    monedaPorDefecto: GTQ
                    tipoDocumentoPorDefecto: factura
                    tipoProductoPorDefecto: bien
                    unidadMedidaPorDefecto: uni
                    informacionFiscal:
                      id: '12345678'
                      nombre: DISTRIBUIDORA DETODO, SOCIEDAD ANONIMA
                      nombreComercial: DETODO
                      afiliacionIva: GENERAL
                      afiliacionIsr: >-
                        ISR_OPCIONAL_SIMPLIFICADO_SOBRE_INGRESOS_ACTIVIDADES_LUCRATIVAS
                      codigoEstablecimiento: '1'
                      esExentoIva: false
                      esRetenedorIva: true
                      direccion:
                        direccion: Ruta 8 3-65 Zona 4 Guatemala
                        municipio: Guatemala
                        departamento: Guatemala
                        codigoPostal: '01004'
                        pais: GT
                    establecimientos: []
                    datosAdicionales: []
                    plantillasPdf: []
                    plantillasMensajeCorreoElectronico: []
                    usuarios: []
        '400':
          description: Solicitud inválida.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                noExiste:
                  summary: La cuenta no existe
                  value:
                    codigo: FEG_BUSINESS_RULE_VIOLATION
                    mensaje: No existe una cuenta con el identificador 12345678
                    masInformacion: https://developer.fegora.com
                    severidad: 2
        '401':
          description: No autenticado. El token es inválido, expiró o no fue enviado.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                noAutenticado:
                  summary: Token ausente, inválido o expirado
                  value:
                    codigo: FEG_UNAUTHORIZED
                    mensaje: No está autorizado para acceder a este recurso
                    masInformacion: https://developer.fegora.com
                    severidad: 2
components:
  schemas:
    CuentaRequest:
      type: object
      description: >-
        Cuerpo para crear/actualizar una cuenta (formato anidado legacy:
        identidad fiscal bajo `informacionFiscal`, configuración operativa a
        nivel raíz). `id` e `idCertificador` son obligatorios al crear.
      properties:
        id:
          type: string
          description: NIT de la cuenta. Requerido al crear.
        idCertificador:
          type: string
          description: Identificador del certificador autorizado. Requerido al crear.
        certificadoPfx:
          type: string
          description: >-
            Certificado de firma en base64, o data-URI
            (`application/x-pkcs12;base64,<datos>`).
        claveCertificadoPfx:
          type: string
        informacionFiscal:
          $ref: '#/components/schemas/CuentaInformacionFiscalRequest'
        direccionCorreoElectronico:
          type: string
        direccionWeb:
          type: string
        telefonos:
          type: string
        logoUri:
          type: string
        logoPng:
          type: string
          description: Logo en base64 o data-URI.
        slogan:
          type: string
        emiteFacturas:
          type: boolean
          default: true
        recibeFacturas:
          type: boolean
          default: false
        estaEnAmbienteDePruebas:
          type: boolean
          default: true
        monedaPorDefecto:
          type: string
          default: GTQ
        tipoDocumentoPorDefecto:
          type: string
        tipoProductoPorDefecto:
          type: string
        unidadMedidaPorDefecto:
          type: string
        idCanal:
          type: integer
        datosAdicionales:
          type: array
          items:
            $ref: '#/components/schemas/CuentaDatoAdicionalRequest'
        establecimientos:
          type: array
          items:
            $ref: '#/components/schemas/CuentaEstablecimientoRequest'
    Cuenta:
      type: object
      description: >-
        Cuenta emisora/receptora. El país de operación de la cuenta (Guatemala,
        El Salvador o República Dominicana) se define en
        `informacionFiscal.direccion.pais` y en la configuración del
        certificador — no hay un campo único de "país de la cuenta".
      properties:
        id:
          type: string
          description: NIT (o RNC en República Dominicana) de la cuenta.
        idCanal:
          type: integer
        canal:
          $ref: '#/components/schemas/CuentaCanal'
        idCertificador:
          type: string
        certificador:
          $ref: '#/components/schemas/CuentaCertificador'
        tieneCertificado:
          type: boolean
          description: >-
            Si la cuenta tiene un certificado de firma (.pfx) configurado. El
            certificado y su clave nunca se devuelven.
        direccionCorreoElectronico:
          type: string
        direccionWeb:
          type: string
        telefonos:
          type: string
        logoUri:
          type: string
        slogan:
          type: string
        emiteFacturas:
          type: boolean
        recibeFacturas:
          type: boolean
        estaEnAmbienteDePruebas:
          type: boolean
        monedaPorDefecto:
          type: string
        tipoDocumentoPorDefecto:
          type: string
        tipoProductoPorDefecto:
          type: string
        unidadMedidaPorDefecto:
          type: string
        informacionFiscal:
          $ref: '#/components/schemas/CuentaInformacionFiscal'
        establecimientos:
          type: array
          items:
            $ref: '#/components/schemas/CuentaEstablecimiento'
        datosAdicionales:
          type: array
          items:
            $ref: '#/components/schemas/CuentaDatoAdicional'
        plantillasPdf:
          type: array
          items:
            $ref: '#/components/schemas/CuentaPlantillaPdf'
        plantillasMensajeCorreoElectronico:
          type: array
          items:
            $ref: '#/components/schemas/CuentaPlantillaMensajeCorreoElectronico'
        usuarios:
          type: array
          items:
            $ref: '#/components/schemas/CuentaUsuario'
      required:
        - id
    Error:
      type: object
      description: Formato estándar de error de Fegora. Se usa en toda respuesta 4xx.
      properties:
        codigo:
          type: string
          description: >-
            Código de error interno de Fegora (p. ej. `FEG_VALIDATION_ERROR`,
            `FEG_DTE_CREA_001`). Ver la tabla de códigos de error en la guía de
            introducción.
          examples:
            - FEG_VALIDATION_ERROR
        mensaje:
          type: string
          description: Mensaje descriptivo del error, en español.
        masInformacion:
          type: string
          format: uri
          description: Enlace a documentación adicional sobre el error.
          examples:
            - https://developer.fegora.com
        severidad:
          type: integer
          enum:
            - 0
            - 1
            - 2
            - 3
          description: 0 = Sugerencia, 1 = Advertencia, 2 = Error, 3 = Fatal.
      required:
        - codigo
        - mensaje
    CuentaInformacionFiscalRequest:
      type: object
      properties:
        id:
          type: string
        nombre:
          type: string
        nombreComercial:
          type: string
        afiliacionIva:
          type: string
        afiliacionIsr:
          type: string
        afiliacionIsrResolucionSat:
          type: string
        codigoEstablecimiento:
          type: string
          default: '1'
        esExentoIva:
          type: boolean
        esRetenedorIva:
          type: boolean
        motivoExencionIva:
          type: string
        direccionCorreoElectronico:
          type: string
        direccion:
          $ref: '#/components/schemas/CuentaDireccionRequest'
    CuentaDatoAdicionalRequest:
      type: object
      properties:
        nombre:
          type: string
        valor:
          type: string
    CuentaEstablecimientoRequest:
      type: object
      properties:
        id:
          type: string
        nombre:
          type: string
        direccion:
          type: string
        municipio:
          type: string
        departamento:
          type: string
        codigoPostal:
          type: string
        pais:
          type: string
        logoUri:
          type: string
      required:
        - nombre
    CuentaCanal:
      type: object
      properties:
        id:
          type: integer
        nombre:
          type: string
        nombreCorto:
          type: string
        logoUri:
          type: string
    CuentaCertificador:
      type: object
      properties:
        id:
          type: string
    CuentaInformacionFiscal:
      type: object
      properties:
        id:
          type: string
        nombre:
          type: string
        nombreComercial:
          type: string
        afiliacionIva:
          type: string
        afiliacionIsr:
          type: string
        afiliacionIsrResolucionSat:
          type: string
        codigoEstablecimiento:
          type: string
        esExentoIva:
          type: boolean
        esRetenedorIva:
          type: boolean
        motivoExencionIva:
          type: string
        direccionCorreoElectronico:
          type: string
        direccion:
          $ref: '#/components/schemas/CuentaDireccion'
    CuentaEstablecimiento:
      type: object
      properties:
        id:
          type: string
        nombre:
          type: string
        direccion:
          type: string
        codigoPostal:
          type: string
        municipio:
          type: string
        departamento:
          type: string
        pais:
          type: string
        logoUri:
          type: string
        tipo:
          type: string
    CuentaDatoAdicional:
      type: object
      properties:
        nombre:
          type: string
        valor:
          type: string
      required:
        - nombre
    CuentaPlantillaPdf:
      type: object
      properties:
        id:
          type: string
          format: uuid
        nombre:
          type: string
        archivoUri:
          type: string
        tiposDte:
          type: string
        condicionAdicional:
          type: string
        prioridad:
          type: integer
    CuentaPlantillaMensajeCorreoElectronico:
      type: object
      properties:
        id:
          type: string
          format: uuid
        idPlantillaProveedor:
          type: string
        textoAsunto:
          type: string
        textoEncabezado:
          type: string
        textoPie:
          type: string
        prioridad:
          type: integer
    CuentaUsuario:
      type: object
      properties:
        nombres:
          type: string
        apellidos:
          type: string
        username:
          type: string
        roles:
          type: array
          items:
            $ref: '#/components/schemas/CuentaRol'
    CuentaDireccionRequest:
      type: object
      properties:
        direccion:
          type: string
        municipio:
          type: string
        departamento:
          type: string
        codigoPostal:
          type: string
        pais:
          type: string
          default: GT
    CuentaDireccion:
      type: object
      properties:
        direccion:
          type: string
        codigoPostal:
          type: string
        municipio:
          type: string
        departamento:
          type: string
        idMunicipio:
          type: string
        idDepartamento:
          type: string
        pais:
          type: string
    CuentaRol:
      type: object
      properties:
        id:
          type: string
        nombre:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````