logo

SmartBill

Overview

The /dte/fex route allows you to create a Factura de Exportación (FEX) for your business by sending the required data. It is intended for sales of goods or services to clients outside El Salvador. The document is processed and sent to Hacienda, and a response is provided indicating success or failure.

Factura de Exportación is exempt from IVA. Products are classified only as 'gravada' or 'no_gravada', and an additional 'exportData' object is required to describe the export operation.

Request Details

URL: https://api.smartbill.lat/v1/dte/fex

HTTP Method: POST

Headers:

  • Content-Type: application/json
  • X-Smartbill-Public-Key: API Public key
  • X-Smartbill-Private-Key: API private key

Structure

In the body of the request, you must include the structure for "dteJson". This key acts as the container for the document details. For a Factura de Exportación, three fields inside dteJson are required: receptor, products and exportData.

Receptor

This section contains information about the foreign recipient of the document. Since this is an export operation, only the countryCode, name and email are strictly required. All other fields are optional and Smartbill will fill them with safe defaults if omitted.

The countryCode must match one of the codes from the Countries list available on the Resources page. If you send a code from El Salvador, the request will be rejected.

countryCode

string

Required

The two-letter code of the recipient's country. The value must match one of the codes from the Countries list, which can be found on the Resources page.

Max 150 characters

name

string

Required

The full name of the recipient. Defaults to "Clientes varios" if not provided.

Max 100 characters

email

string

Required

The email address of the recipient, where the client will receive the sent document. Defaults to "clientes.varios@smartbill.lat" if not provided.

documentType

string

"nit""dui""pasaporte""carnetResidente""otro"

Type of document of the foreign recipient. Defaults to "otro". If "dui" is sent, the identification must be 9 digits long. If "nit" is sent, the identification must be 14 digits long.

Max 25 characters

identification

string

The value representing the document of the recipient. Defaults to "0123456789" if not provided. Maximum 25 characters when documentType is not "dui" or "nit".

Max 150 characters

comercialName

string | null

The commercial name of the recipient (the brand or trade name).

activity

string | null

The economic activity of the recipient. If included, it must be between 6 and 100 characters long.

Max 250 characters

address

string | null

The full address of the recipient as a single string (since the recipient is foreign, no department/town codes are required).

Max 16 characters

phone

string | null

The phone number of the recipient.

Products

This section contains information about the items being exported. The products is an array of values, so you can add multiple items.

For Factura de Exportación, items can only be classified as "gravada" or "no_gravada". When an item is "no_gravada", its quantity must be exactly 1.

Max 1000 characters

description

string

Required

A brief description of the product or service being exported.

unitPrice

number

Required

Sets the unit price of the item.

quantity

number

Sets the amount of the product(s) for the item. Defaults to 1 if not provided. If sellType is "no_gravada", quantity must be 1.

sellType

string

"gravada""no_gravada"

Refers to whether the item is "gravada" or "no_gravada". Defaults to "gravada".

unit

number | null

Sets the unit type of the product. This value must match one of the codes from the list of unit types found in the Resources page.

Export Data

This section is specific to Factura de Exportación and describes the operation. It tells Hacienda whether you are exporting goods or services and includes customs-related details when applicable.

When typeItem is "servicio", the fields regime, recinto and incoterm are not required and will be ignored. When typeItem is "bien", all three of these fields are required.

typeItem

string

Required

"bien""servicio"

Specifies whether the export is for goods ("bien") or services ("servicio").

regime

string

The customs regime code (e.g. "EX-1.1000.000" for "Exportación Definitiva, Régimen Común"). Required when typeItem is "bien". Must match one of the codes from the Regimes list on the Resources page.

recinto

string

The customs precinct code where the goods will be processed (e.g. "02" for "Marítima de Acajutla"). Required when typeItem is "bien". Must match one of the codes from the Recintos list on the Resources page.

incoterm

string

The Incoterm code that defines the responsibilities between buyer and seller (e.g. "09" for "FOB - Libre a bordo"). Required when typeItem is "bien". Must match one of the codes from the Incoterms list on the Resources page.

flete

number | null

The freight cost associated with the export. Must be a number greater than or equal to 0. Defaults to 0 if not provided.

seguro

number | null

The insurance cost associated with the export. Must be a number greater than or equal to 0. Defaults to 0 if not provided.

payment / Not required

In this section, you can specify the type of payment. If the payment type is "credit", you can also provide the time extension for these payments.

type

string

"contado""credito"

Specifies whether the payment is made as "contado" (a single payment) or as "credit" (multiple payments).

timeFormat

string

"day""month""year"

Specifies whether the payment schedule is based on days, months, or years.

duration

number

Specifies the length of the payment schedule in terms of days, months, or years.

Example

This section demonstrates how to create a Factura de Exportación. The example fills in all optional fields including a complete exportData for goods, multiple products and a payment on credit.

Select an option

Response

In this section, you can see two types of responses: a successful response and an error response. Both types share the same structure.

Select an option