Skip to main content
POST
/
api
/
v1
/
boletas
Create Boleta
curl --request POST \
  --url https://api.example.com/api/v1/boletas \
  --header 'Content-Type: application/json' \
  --data '
{
  "company_id": 123,
  "branch_id": 123,
  "serie": "<string>",
  "fecha_emision": "<string>",
  "ubl_version": "<string>",
  "tipo_operacion": "<string>",
  "moneda": "<string>",
  "metodo_envio": "<string>",
  "forma_pago_tipo": "<string>",
  "forma_pago_cuotas": [
    {}
  ],
  "client": {
    "client.tipo_documento": "<string>",
    "client.numero_documento": "<string>",
    "client.razon_social": "<string>",
    "client.nombre_comercial": "<string>",
    "client.direccion": "<string>",
    "client.ubigeo": "<string>",
    "client.distrito": "<string>",
    "client.provincia": "<string>",
    "client.departamento": "<string>",
    "client.telefono": "<string>",
    "client.email": {}
  },
  "detalles": [
    {
      "detalles[].codigo": "<string>",
      "detalles[].descripcion": "<string>",
      "detalles[].unidad": "<string>",
      "detalles[].cantidad": 123,
      "detalles[].mto_valor_unitario": 123,
      "detalles[].mto_valor_gratuito": 123,
      "detalles[].porcentaje_igv": 123,
      "detalles[].porcentaje_ivap": 123,
      "detalles[].tip_afe_igv": "<string>",
      "detalles[].isc": 123,
      "detalles[].icbper": 123,
      "detalles[].factor_icbper": 123
    }
  ],
  "leyendas": [
    {
      "leyendas[].code": "<string>",
      "leyendas[].value": "<string>"
    }
  ],
  "datos_adicionales": [
    {}
  ],
  "usuario_creacion": "<string>"
}
'
{
  "success": true,
  "data": {
    "id": 123,
    "company_id": 123,
    "branch_id": 123,
    "serie": "<string>",
    "numero": 123,
    "numero_completo": "<string>",
    "fecha_emision": "<string>",
    "metodo_envio": "<string>",
    "estado_sunat": "<string>",
    "company": {},
    "branch": {},
    "client": {}
  },
  "message": "<string>"
}
Creates a new electronic sales receipt (Boleta de Venta) for SUNAT. Boletas are issued to individual customers and can be sent individually or via daily summary.
Boletas are issued to individual consumers (DNI) and have simpler requirements than invoices. They can be sent to SUNAT immediately or grouped in a daily summary.

Authentication

This endpoint requires authentication using a Bearer token (Sanctum).
Authorization: Bearer YOUR_API_TOKEN

Request Body

Company and Branch

company_id
integer
required
ID of the company issuing the boleta. Must exist in the companies table.
branch_id
integer
required
ID of the branch issuing the boleta. Must belong to the specified company.
serie
string
required
Boleta series code (max 4 characters). Must start with ‘B’ for boletas (e.g., “B001”).

Dates and Configuration

fecha_emision
date
required
Boleta issue date in YYYY-MM-DD format.
ubl_version
string
UBL version (max 5 characters). Default: “2.1”.
tipo_operacion
string
Type of operation code (max 4 characters). Default: “0101” (internal sale).
moneda
string
Currency code (max 3 characters). Default: “PEN”.

Sending Method

metodo_envio
string
required
How the boleta will be sent to SUNAT:
  • individual: Send immediately to SUNAT (for boletas > 700 PEN or to foreign customers)
  • resumen_diario: Include in daily summary (for boletas ≤ 700 PEN to local customers)
According to SUNAT regulations, boletas over 700 PEN or issued to foreign customers must be sent individually, not in daily summaries.

Payment Terms (Optional)

forma_pago_tipo
string
Payment type (max 20 characters). Example: “Contado”, “Credito”.
forma_pago_cuotas
array
Payment installments if applicable.

Client Information

client
object
required
Customer information.

Boleta Items

detalles
array
required
Boleta line items (minimum 1 item required).

Additional Information (Optional)

leyendas
array
Custom legends to display on the boleta.
datos_adicionales
array
Additional custom data.
usuario_creacion
string
Username of the creator (max 100 characters).

Response

success
boolean
Indicates if the boleta was created successfully.
data
object
The created boleta object with relationships.
message
string
Success message.

Request Example

curl -X POST https://api.example.com/api/v1/boletas \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "company_id": 1,
    "branch_id": 1,
    "serie": "B001",
    "fecha_emision": "2024-03-15",
    "moneda": "PEN",
    "tipo_operacion": "0101",
    "metodo_envio": "individual",
    "forma_pago_tipo": "Contado",
    "client": {
      "tipo_documento": "1",
      "numero_documento": "12345678",
      "razon_social": "JUAN PEREZ LOPEZ",
      "direccion": "AV. LARCO 456",
      "distrito": "MIRAFLORES",
      "provincia": "LIMA",
      "departamento": "LIMA",
      "email": "[email protected]"
    },
    "detalles": [
      {
        "codigo": "PROD001",
        "descripcion": "LAPTOP HP 15",
        "unidad": "NIU",
        "cantidad": 1,
        "mto_valor_unitario": 2540.68,
        "porcentaje_igv": 18,
        "tip_afe_igv": "10"
      },
      {
        "codigo": "SERV001",
        "descripcion": "INSTALACION Y CONFIGURACION",
        "unidad": "ZZ",
        "cantidad": 1,
        "mto_valor_unitario": 84.75,
        "porcentaje_igv": 18,
        "tip_afe_igv": "10"
      }
    ],
    "leyendas": [
      {
        "code": "1000",
        "value": "SON: TRES MIL CIEN Y 00/100 SOLES"
      }
    ],
    "usuario_creacion": "admin"
  }'

Response Example

{
  "success": true,
  "data": {
    "id": 789,
    "company_id": 1,
    "branch_id": 1,
    "serie": "B001",
    "numero": 1523,
    "numero_completo": "B001-1523",
    "fecha_emision": "2024-03-15",
    "moneda": "PEN",
    "tipo_operacion": "0101",
    "metodo_envio": "individual",
    "estado_sunat": "PENDIENTE",
    "mto_oper_gravadas": 2625.43,
    "mto_igv": 472.58,
    "mto_imp_venta": 3100.00,
    "created_at": "2024-03-15T14:20:00.000000Z",
    "updated_at": "2024-03-15T14:20:00.000000Z",
    "company": {
      "id": 1,
      "ruc": "20987654321",
      "razon_social": "MI EMPRESA SAC"
    },
    "branch": {
      "id": 1,
      "nombre": "Sede Principal",
      "codigo": "0000"
    },
    "client": {
      "id": 234,
      "tipo_documento": "1",
      "numero_documento": "12345678",
      "razon_social": "JUAN PEREZ LOPEZ"
    }
  },
  "message": "Boleta creada correctamente"
}
The boleta is created in PENDIENTE (pending) status. Depending on the metodo_envio:
  • individual: Call Send to SUNAT immediately
  • resumen_diario: Include it in the daily summary at the end of the day

Sending Methods Explained

Individual Sending

Use metodo_envio: "individual" when:
  • Boleta amount > 700 PEN
  • Customer is a foreign national
  • Immediate SUNAT validation is required
After creation, call POST /api/v1/boletas/{id}/send-sunat to submit to SUNAT.

Daily Summary

Use metodo_envio: "resumen_diario" when:
  • Boleta amount ≤ 700 PEN
  • Customer is a local individual (DNI)
  • Batch processing is acceptable
Boletas will be grouped and sent in a single daily summary document at the end of the business day.

Build docs developers (and LLMs) love