Skip to main content
GET
/
api
/
v1
/
companies
/
{id}
/
config
Company Configuration
curl --request GET \
  --url https://api.example.com/api/v1/companies/{id}/config
{
  "success": true,
  "data": {},
  "message": "<string>"
}
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

id
integer
required
The unique identifier of the company

Query Parameters

use_cache
boolean
Whether to use cached configuration. Defaults to true.

Response

success
boolean
required
Indicates if the request was successful
data
object
required
Complete configuration object for the company
message
string
required
Success message

Example Request

cURL
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

200 OK
{
  "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

id
integer
required
The unique identifier of the company
section
string
required
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
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

200 OK
{
  "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"
}
400 Invalid Section
{
  "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

id
integer
required
The unique identifier of the company
section
string
required
Configuration section to update

Request Body (tax_settings)

igv_porcentaje
number
IGV (VAT) percentage (min: 0, max: 50)
isc_porcentaje
number
ISC (selective consumption) percentage (min: 0, max: 50)
icbper_monto
number
ICBPER amount per unit (min: 0)
ivap_porcentaje
number
IVAP percentage (min: 0, max: 50)
redondeo_automatico
boolean
Enable automatic rounding
decimales_precio_unitario
integer
Decimal places for unit price (min: 2, max: 10)
decimales_cantidad
integer
Decimal places for quantity (min: 2, max: 10)
incluir_leyenda_monto
boolean
Include amount legend in documents
validar_ruc_cliente
boolean
Validate customer RUC
permitir_precio_cero
boolean
Allow zero prices

Request Body (invoice_settings)

ubl_version
string
UBL version: 2.0 or 2.1
formato_numero
string
Number format pattern (max 50 characters)
moneda_default
string
Default currency: PEN, USD, or EUR
tipo_operacion_default
string
Default operation type code (max 10 characters)
incluir_leyendas_automaticas
boolean
Include automatic legends
envio_automatico
boolean
Enable automatic submission

Request Body (gre_settings)

peso_default_kg
number
Default weight in kg (min: 0.001)
bultos_default
integer
Default number of packages (min: 1)
modalidad_transporte_default
string
Default transport mode: 01 (public) or 02 (private)
motivo_traslado_default
string
Default transfer reason code: 01, 02, 03, 04, 05, 06, 07, 08, 09, 13, 14, 18, 19
verificacion_automatica
boolean
Enable automatic verification

Request Body (document_settings)

generar_xml_automatico
boolean
Auto-generate XML
generar_pdf_automatico
boolean
Auto-generate PDF
enviar_sunat_automatico
boolean
Auto-send to SUNAT
formato_pdf_default
string
Default PDF format: a4, letter, or legal
orientacion_pdf_default
string
Default PDF orientation: portrait or landscape
incluir_qr_pdf
boolean
Include QR code in PDF
incluir_hash_pdf
boolean
Include hash in PDF
logo_en_pdf
boolean
Include logo in PDF

Example Request

cURL
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
  }'
JavaScript
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

200 OK
{
  "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"
}
422 Validation Error
{
  "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.

Build docs developers (and LLMs) love