Manage company-specific configuration settings including tax rates, document formats, and service endpoints.
Authentication
This endpoint requires authentication. Include your API token in the request header:
Authorization: Bearer YOUR_API_TOKEN
Get Company Configuration
Path Parameters
The unique identifier of the company
Query Parameters
Whether to use cached configuration. Defaults to true.
Response
Indicates if the request was successful
Complete configuration object for the company
Example Request
curl -X GET https://api.yourdomain.com/api/v1/companies/1/config?use_cache=true \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json"
Example Response
{
"success": true,
"data": {
"company_id": 1,
"tax_settings": {
"igv_porcentaje": 18.00,
"isc_porcentaje": 0.00,
"icbper_monto": 0.50,
"ivap_porcentaje": 4.00,
"redondeo_automatico": true,
"decimales_precio_unitario": 10,
"decimales_cantidad": 10
},
"document_settings": {
"generar_xml_automatico": true,
"generar_pdf_automatico": true,
"enviar_sunat_automatico": false,
"formato_pdf_default": "a4",
"orientacion_pdf_default": "portrait",
"incluir_qr_pdf": true,
"incluir_hash_pdf": true,
"logo_en_pdf": true
},
"invoice_settings": {
"ubl_version": "2.1",
"formato_numero": "F001-{correlativo}",
"moneda_default": "PEN",
"tipo_operacion_default": "0101"
},
"gre_settings": {
"peso_default_kg": 1.0,
"bultos_default": 1,
"modalidad_transporte_default": "01",
"motivo_traslado_default": "01"
}
},
"message": "Configuración obtenida correctamente"
}
Get Configuration Section
Endpoint
GET /api/v1/companies/{id}/config/{section}
Path Parameters
The unique identifier of the company
Configuration section to retrieve. Valid values:
tax_settings - Tax rates and calculation settings
invoice_settings - Invoice format and defaults
gre_settings - Dispatch guide settings
document_settings - Document generation preferences
Example Request
curl -X GET https://api.yourdomain.com/api/v1/companies/1/config/tax_settings \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json"
Example Response
{
"success": true,
"data": {
"section": "tax_settings",
"config": {
"igv_porcentaje": 18.00,
"isc_porcentaje": 0.00,
"icbper_monto": 0.50,
"ivap_porcentaje": 4.00,
"redondeo_automatico": true,
"decimales_precio_unitario": 10,
"decimales_cantidad": 10,
"incluir_leyenda_monto": true,
"validar_ruc_cliente": true,
"permitir_precio_cero": false
}
},
"message": "Configuración de tax_settings obtenida correctamente"
}
{
"success": false,
"message": "Sección no válida",
"available_sections": [
"tax_settings",
"invoice_settings",
"gre_settings",
"document_settings"
]
}
Update Configuration Section
Endpoint
PUT /api/v1/companies/{id}/config/{section}
Path Parameters
The unique identifier of the company
Configuration section to update
Request Body (tax_settings)
IGV (VAT) percentage (min: 0, max: 50)
ISC (selective consumption) percentage (min: 0, max: 50)
ICBPER amount per unit (min: 0)
IVAP percentage (min: 0, max: 50)
Enable automatic rounding
decimales_precio_unitario
Decimal places for unit price (min: 2, max: 10)
Decimal places for quantity (min: 2, max: 10)
Include amount legend in documents
Request Body (invoice_settings)
Number format pattern (max 50 characters)
Default currency: PEN, USD, or EUR
Default operation type code (max 10 characters)
incluir_leyendas_automaticas
Include automatic legends
Enable automatic submission
Request Body (gre_settings)
Default weight in kg (min: 0.001)
Default number of packages (min: 1)
modalidad_transporte_default
Default transport mode: 01 (public) or 02 (private)
Default transfer reason code: 01, 02, 03, 04, 05, 06, 07, 08, 09, 13, 14, 18, 19
Enable automatic verification
Request Body (document_settings)
Default PDF format: a4, letter, or legal
Default PDF orientation: portrait or landscape
Example Request
curl -X PUT https://api.yourdomain.com/api/v1/companies/1/config/tax_settings \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"igv_porcentaje": 18.00,
"redondeo_automatico": true,
"decimales_precio_unitario": 10
}'
const response = await fetch(
'https://api.yourdomain.com/api/v1/companies/1/config/tax_settings',
{
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
igv_porcentaje: 18.00,
redondeo_automatico: true,
decimales_precio_unitario: 10
})
}
);
const data = await response.json();
Example Response
{
"success": true,
"data": {
"section": "tax_settings",
"config": {
"igv_porcentaje": 18.00,
"isc_porcentaje": 0.00,
"icbper_monto": 0.50,
"ivap_porcentaje": 4.00,
"redondeo_automatico": true,
"decimales_precio_unitario": 10,
"decimales_cantidad": 10
}
},
"message": "Configuración de tax_settings actualizada correctamente"
}
{
"success": false,
"message": "Error al actualizar configuración: The igv porcentaje must be between 0 and 50.",
"errors": {
"igv_porcentaje": [
"The igv porcentaje must be between 0 and 50."
]
}
}
Additional Configuration Endpoints
Validate SUNAT Services
GET /api/v1/companies/{id}/config/validate-services
Validates the company’s SUNAT service configuration and credentials.
Clear Configuration Cache
POST /api/v1/companies/{id}/config/clear-cache
Clears the cached configuration for the company.
Get Default Configurations
GET /api/v1/companies/config/defaults
Retrieve system default configurations.
Configuration changes are applied immediately and cached for performance. Use the clear-cache endpoint if you experience stale data.
Changing tax settings affects all new documents. Existing documents retain their original tax calculations.