Skip to content

Impuestos

Impuestos

Prefijo: /api/impuestos
Requiere Auth:
Permiso requerido: impuestos, *

Módulo de impuestos para configurar los diferentes tipos de impuestos del sistema. Integración con códigos DIAN para facturación electrónica.

GET /api/impuestos/

Descripción: Lista todos los impuestos configurados
Requiere Auth:
Permiso requerido: impuestos, leer

Respuesta exitosa: 200 OK

Response:

[
{
"id": 1,
"nombre": "IVA",
"codigo_dian": "01",
"tipo": "IVA",
"porcentaje": 19.0,
"es_descontable": 1,
"activo": 1,
"tenant_id": "uuid-tenant",
"created_at": "2025-01-01T00:00:00",
"updated_at": "2025-01-01T00:00:00"
}
]

cURL:

Terminal window
curl http://localhost/api/impuestos/ -H "Authorization: Bearer <token>"

Python:

import httpx
resp = httpx.get("http://localhost/api/impuestos/", headers={"Authorization": f"Bearer {token}"})
impuestos = resp.json()

JavaScript:

const resp = await fetch('http://localhost/api/impuestos/', {
headers: {'Authorization': `Bearer ${token}`}
});
const impuestos = await resp.json();

GET /api/impuestos/{impuesto_id}

Descripción: Obtiene un impuesto por ID
Requiere Auth:
Permiso requerido: impuestos, leer

Respuesta exitosa: 200 OK
Errores: 404 (no encontrado)

cURL:

Terminal window
curl http://localhost/api/impuestos/1 -H "Authorization: Bearer <token>"

POST /api/impuestos/

Descripción: Crea un nuevo impuesto
Requiere Auth:
Permiso requerido: impuestos, crear

Request:

{
"nombre": "INC",
"codigo_dian": "04",
"tipo": "INC",
"porcentaje": 8.0,
"es_descontable": 1,
"activo": 1
}

Respuesta exitosa: 201 Created

cURL:

Terminal window
curl -X POST http://localhost/api/impuestos/ \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <token>" \
-d '{"nombre":"INC","codigo_dian":"04","tipo":"INC","porcentaje":8.0,"es_descontable":1,"activo":1}'

Python:

import httpx
resp = httpx.post("http://localhost/api/impuestos/",
json={"nombre": "INC", "codigo_dian": "04", "tipo": "INC", "porcentaje": 8.0, "es_descontable": 1, "activo": 1},
headers={"Authorization": f"Bearer {token}"})
impuesto = resp.json()

JavaScript:

const resp = await fetch('http://localhost/api/impuestos/', {
method: 'POST',
headers: {'Content-Type': 'application/json', 'Authorization': `Bearer ${token}`},
body: JSON.stringify({nombre: 'INC', codigo_dian: '04', tipo: 'INC', porcentaje: 8.0, es_descontable: 1, activo: 1})
});

PUT /api/impuestos/{impuesto_id}

Descripción: Actualiza un impuesto
Requiere Auth:
Permiso requerido: impuestos, actualizar

Respuesta exitosa: 200 OK
Errores: 404 (no encontrado)

cURL:

Terminal window
curl -X PUT http://localhost/api/impuestos/1 \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <token>" \
-d '{"porcentaje":16.0,"activo":0}'

DELETE /api/impuestos/{impuesto_id}

Descripción: Elimina un impuesto
Requiere Auth:
Permiso requerido: impuestos, eliminar

Respuesta exitosa: 204 No Content
Errores: 404 (no encontrado)

cURL:

Terminal window
curl -X DELETE http://localhost/api/impuestos/1 -H "Authorization: Bearer <token>"