➕ Create new documents

Postman collection

To help you with your integration, download our Postman Collection here: https://github.com/koyweforest/api-billing-postman

When generating an invoice, you have the choice of using the generic RFC

  • XAXX010101000 for nationals who only have CURP but no RFC
  • XEXX010101000 for foreign companies or individuals

if you use a different RFC, then you will need to make sure you have an EXACT match of the legal_name, postal code and activity (régimen fiscal). If any those don’t make an exact match, you will receive a message on the response with the SAT validation and the document won’t be issued. (note that SAT messages are in spanish)

To help with testing, you can use the following information when issuing documents

RFClegal_nameactivitypostalcode
EKU9003173C9ESCUELA KEMPER URGATE60142501

Legal names MUST NOT include the organization type (example: SAIC).

You can validate the data here: https://agsc.siat.sat.gob.mx/PTSC/ValidaRFC/index.jsf (works ONLY from Mexico, blocked by the SAT from other countries).

product_service_identifier and measure_unit_code

Mexico requires detail lines to be properly identified for tax purposes. If omitted, default values will be used.

List of product/service identifiers: http://pys.sat.gob.mx/PyS/catPyS.aspx List of measure unit codes: http://pys.sat.gob.mx/PyS/catUnidades.aspx

Invoice

In order to create a new mexican invoice, you need to use the /documents endpoint with the proper parameters.

Mexican invoices can be type I, E or T. To define which type to use, please check the document_type_id field proper values.

Invoice I (Factura I - Factura Ingreso)

1{
2 "header": {
3 "account_id": 11857,
4 "document_type_id": "76",
5 "issue_date": "2025-01-07",
6 "issuer_tax_id_code": "EKU9003173C9",
7 "issuer_tax_id_type": "MX-RFC",
8 "issuer_legal_name": "ESCUELA KEMPER URGATE",
9 "issuer_address": "Calle roja 234",
10 "issuer_city": "Ciudad de méxico",
11 "issuer_country_id": "80",
12 "issuer_phone": "2223334444",
13 "issuer_activity": "601",
14 "issuer_postalcode": "42501",
15 "receiver_tax_id_code": "EKU9003173C9",
16 "receiver_tax_id_type": "MX-RFC",
17 "receiver_legal_name": "ESCUELA KEMPER URGATE",
18 "receiver_address": "Calle naranja 123",
19 "receiver_city": "Cancún",
20 "receiver_country_id": "80",
21 "receiver_phone": "2223334444",
22 "receiver_activity": "601",
23 "receiver_postalcode": "42501",
24 "payment_conditions": "0",
25 "currency_id": 31
26 },
27 "details": [
28 {
29 "quantity": 1,
30 "sku": "aa111",
31 "line_description": "Prueba Koywe",
32 "unit_measure": "UN",
33 "unit_price": 1500,
34 "long_description": "Esta es una linea de prueba",
35 "modifier_amount": -100,
36 "total_taxes": 224,
37 "modifier_percentage": 0,
38 "total_amount_line": 1624,
39 "taxes": [
40 {
41 "tax_type_id": "362",
42 "tax_percentage": 16,
43 "tax_amount": 224
44 }
45 ],
46 "additional": {
47 "mx_detail": {
48 "product_service_identifier": "01010101",
49 "measure_unit_code": "E48"
50 }
51 }
52 }
53 ],
54 "totals": {
55 "net_amount": 1400,
56 "taxes_amount": 224,
57 "total_amount": 1624
58 }
59}

Invoice E (Factura E - Factura Egreso)

1{
2 "header": {
3 "account_id": 11857,
4 "document_type_id": "77",
5 "issue_date": "2025-01-07",
6 "issuer_tax_id_code": "EKU9003173C9",
7 "issuer_tax_id_type": "MX-RFC",
8 "issuer_legal_name": "ESCUELA KEMPER URGATE",
9 "issuer_address": "Calle roja 234",
10 "issuer_city": "Ciudad de méxico",
11 "issuer_country_id": "80",
12 "issuer_phone": "2223334444",
13 "issuer_activity": "601",
14 "issuer_postalcode": "42501",
15 "receiver_tax_id_code": "EKU9003173C9",
16 "receiver_tax_id_type": "MX-RFC",
17 "receiver_legal_name": "ESCUELA KEMPER URGATE",
18 "receiver_address": "Calle naranja 123",
19 "receiver_city": "Cancún",
20 "receiver_country_id": "80",
21 "receiver_phone": "2223334444",
22 "receiver_activity": "601",
23 "receiver_postalcode": "42501",
24 "payment_conditions": "0",
25 "currency_id": 31
26 },
27 "details": [
28 {
29 "quantity": 1,
30 "sku": "aa111",
31 "line_description": "Prueba Koywe",
32 "unit_measure": "UN",
33 "unit_price": 1500,
34 "long_description": "Esta es una linea de prueba",
35 "modifier_amount": -100,
36 "total_taxes": 224,
37 "modifier_percentage": 0,
38 "total_amount_line": 1624,
39 "taxes": [
40 {
41 "tax_type_id": "362",
42 "tax_percentage": 16,
43 "tax_amount": 224
44 }
45 ],
46 "additional": {
47 "mx_detail": {
48 "product_service_identifier": "01010101",
49 "measure_unit_code": "E48"
50 }
51 }
52 }
53 ],
54 "totals": {
55 "net_amount": 1400,
56 "taxes_amount": 224,
57 "total_amount": 1624
58 }
59}

Invoice T (Factura T - Factura Traslado)

1{
2 "header": {
3 "account_id": 11857,
4 "document_type_id": "78",
5 "issue_date": "2025-01-07",
6 "issuer_tax_id_code": "EKU9003173C9",
7 "issuer_tax_id_type": "MX-RFC",
8 "issuer_legal_name": "ESCUELA KEMPER URGATE",
9 "issuer_address": "Calle roja 234",
10 "issuer_city": "Ciudad de méxico",
11 "issuer_country_id": "80",
12 "issuer_phone": "2223334444",
13 "issuer_activity": "601",
14 "issuer_postalcode": "42501",
15 "receiver_tax_id_code": "EKU9003173C9",
16 "receiver_tax_id_type": "MX-RFC",
17 "receiver_legal_name": "ESCUELA KEMPER URGATE",
18 "receiver_address": "Calle naranja 123",
19 "receiver_city": "Cancún",
20 "receiver_country_id": "80",
21 "receiver_phone": "2223334444",
22 "receiver_activity": "601",
23 "receiver_postalcode": "42501",
24 "payment_conditions": "0",
25 "currency_id": 31
26 },
27 "details": [
28 {
29 "quantity": 1,
30 "sku": "aa111",
31 "line_description": "Prueba Koywe",
32 "unit_measure": "UN",
33 "unit_price": 1500,
34 "long_description": "Esta es una linea de prueba",
35 "modifier_amount": -100,
36 "total_taxes": 224,
37 "modifier_percentage": 0,
38 "total_amount_line": 1624,
39 "taxes": [
40 {
41 "tax_type_id": "362",
42 "tax_percentage": 16,
43 "tax_amount": 224
44 }
45 ],
46 "additional": {
47 "mx_detail": {
48 "product_service_identifier": "01010101",
49 "measure_unit_code": "E48"
50 }
51 }
52 }
53 ],
54 "totals": {
55 "net_amount": 1400,
56 "taxes_amount": 224,
57 "total_amount": 1624
58 }
59}

Invoice T with bill of lading complement (Factura T con Complemento de Carta Porte)

In order to create a new mexican invoice with bill of lading complement, you need to use the /documents endpoint with the proper parameters.

1{
2 "header": {
3 "account_id": 11857,
4 "document_type_id": "78",
5 "issue_date": "2025-01-07",
6 "issuer_tax_id_code": "EKU9003173C9",
7 "issuer_tax_id_type": "MX-RFC",
8 "issuer_legal_name": "ESCUELA KEMPER URGATE",
9 "issuer_address": "Calle roja 234",
10 "issuer_city": "Ciudad de méxico",
11 "issuer_country_id": "80",
12 "issuer_phone": "2223334444",
13 "issuer_activity": "601",
14 "issuer_postalcode": "42501",
15 "receiver_tax_id_code": "EKU9003173C9",
16 "receiver_tax_id_type": "MX-RFC",
17 "receiver_legal_name": "ESCUELA KEMPER URGATE",
18 "receiver_address": "Calle naranja 123",
19 "receiver_city": "Cancún",
20 "receiver_country_id": "80",
21 "receiver_phone": "2223334444",
22 "receiver_activity": "601",
23 "receiver_postalcode": "42501",
24 "payment_conditions": "0",
25 "currency_id": 31,
26 "additional": {
27 "mx_shipping": {
28 "distance": "100",
29 "transport_code": "01",
30 "transport_method_name": "Autotransporte",
31 "transport_tax_id_type": "MX-RFC",
32 "transport_tax_id_code": "EKU9003173C9",
33 "transport_license": "a234567890",
34 "origin": {
35 "tax_id_type" : "MX-RFC",
36 "tax_id_code": "EKU9003173C9",
37 "date_time": "2025-01-07T00:00:00",
38 "address_state_id": "31",
39 "address_country_id": "80",
40 "address_postalcode": "13250"
41 },
42 "destination": {
43 "tax_id_type" : "MX-RFC",
44 "tax_id_code": "EKU9003173C9",
45 "date_time": "2025-01-07T00:00:00",
46 "address_state_id": "31",
47 "address_country_id": "80",
48 "address_postalcode": "13250"
49 },
50 "merchandise": {
51 "total_weight": "10",
52 "sct_permission_code": "TPAF01",
53 "sct_permission_number": "222333444",
54 "vehicle_configuration": "VL",
55 "vehicle_weight": "1",
56 "vehicle_license_plate": "AA22333",
57 "vehicle_year":"2020",
58 "insurance_company": "PRUEBA SEGUROS",
59 "insurance_identifier": "123456",
60 "details": [
61 {
62 "product_code": "11121900",
63 "description" : "Accesorios telefono",
64 "quantity" : "1",
65 "weight": "10"
66 }
67 ]
68 }
69 }
70
71 }
72
73 },
74
75 "details": [
76 {
77 "quantity": 1,
78 "line_description": "Prueba Koywe",
79 "unit_measure": "UN",
80 "unit_price": 1500,
81 "long_description": "Esta es una linea de prueba",
82 "modifier_amount": -100,
83 "total_taxes": 224,
84 "modifier_percentage": 0,
85 "total_amount_line": 1624,
86 "taxes": [
87 {
88 "tax_type_id": "362",
89 "tax_percentage": 16,
90 "tax_amount": 224
91 }
92 ],
93 "additional": {
94 "mx_detail": {
95 "product_service_identifier": "01010101",
96 "measure_unit_code": "E48"
97 }
98 }
99 }
100 ],
101 "totals": {
102 "net_amount": 1400,
103 "taxes_amount": 224,
104 "total_amount": 1624
105 }
106}

Invoice I with exports complement (Factura I con Complemento de Exportación)

In order to create a new mexican invoice with international commerce complement, you need to use the /documents endpoint with the proper parameters.

1{
2 "header": {
3 "account_id": 11857,
4 "document_type_id": "76",
5 "issue_date": "2025-01-07",
6 "issuer_tax_id_code": "EKU9003173C9",
7 "issuer_tax_id_type": "MX-RFC",
8 "issuer_legal_name": "ESCUELA KEMPER URGATE",
9 "issuer_address": "Calle roja 234",
10 "issuer_city": "Ciudad de méxico",
11 "issuer_country_id": "80",
12 "issuer_phone": "2223334444",
13 "issuer_activity": "601",
14 "issuer_postalcode": "42501",
15 "receiver_tax_id_code": "EKU9003173C9",
16 "receiver_tax_id_type": "MX-RFC",
17 "receiver_legal_name": "ESCUELA KEMPER URGATE",
18 "receiver_address": "Calle naranja 123",
19 "receiver_city": "Cancún",
20 "receiver_country_id": "80",
21 "receiver_phone": "2223334444",
22 "receiver_activity": "601",
23 "receiver_postalcode": "42501",
24 "payment_conditions": "0",
25 "currency_id": 31,
26 "additional": {
27 "mx_exports": {
28 "terms": "FOB",
29 "exchange_rate": 20.6708,
30 "total": 1624,
31 "origin": {
32 "address_street": "CALLE DEL PAPEL",
33 "address_city_id": "01",
34 "address_county_id": "1961",
35 "address_state_id": "45",
36 "address_country_id": "80",
37 "address_postalcode": "76199"
38 },
39 "destination": {
40 "tax_id_type" : "US-EIN",
41 "tax_id_code": "222333444",
42 "address_street": "2470 SW 19th",
43 "address_state_id": "61",
44 "address_country_id": "89",
45 "address_postalcode": "00000"
46 },
47 "merchandise": {
48 "details": [
49 {
50 "customs_code": "2402200100",
51 "customs_quantity" : "117.64",
52 "sku" : "aa111",
53 "customs_measure_unit": "01",
54 "customs_unit_value": "13.81",
55 "customs_total_value": "1624.00"
56 }
57 ]
58 }
59 }
60
61 }
62 },
63
64 "details": [
65 {
66 "quantity": 1,
67 "sku": "aa111",
68 "line_description": "Prueba Koywe",
69 "unit_measure": "UN",
70 "unit_price": 1500,
71 "long_description": "Esta es una linea de prueba",
72 "modifier_amount": -100,
73 "total_taxes": 224,
74 "modifier_percentage": 0,
75 "total_amount_line": 1624,
76 "taxes": [
77 {
78 "tax_type_id": "362",
79 "tax_percentage": 16,
80 "tax_amount": 224
81 }
82 ],
83 "additional": {
84 "mx_detail": {
85 "product_service_identifier": "01010101",
86 "measure_unit_code": "E48"
87 }
88 }
89 }
90 ],
91 "totals": {
92 "net_amount": 1400,
93 "taxes_amount": 224,
94 "total_amount": 1624
95 }
96}

Invoice I Foreigner without RFC (Factura I - Factura Ingreso Extranjero sin RFC)

1{
2 "header": {
3 "account_id": 11857,
4 "document_type_id": "76",
5 "issue_date": "2025-05-27",
6 "issuer_tax_id_code": "EKU9003173C9",
7 "issuer_tax_id_type": "MX-RFC",
8 "issuer_legal_name": "ESCUELA KEMPER URGATE",
9 "issuer_address": "Calle roja 234",
10 "issuer_city": "Ciudad de méxico",
11 "issuer_country_id": "80",
12 "issuer_phone": "2223334444",
13 "issuer_activity": "601",
14 "issuer_postalcode": "42501",
15 "receiver_tax_id_code": "XEXX010101000",
16 "receiver_tax_id_type": "US-EIN",
17 "receiver_legal_name": "ESCUELA KEMPER URGATE",
18 "receiver_address": "<string>",
19 "receiver_district": "<string>",
20 "receiver_city": "<string>",
21 "receiver_country_id": "89",
22 "receiver_phone": "<string>",
23 "receiver_activity": "<string>",
24 "payment_conditions": "0",
25 "currency_id": 31
26 },
27 "details": [
28 {
29 "quantity": 1,
30 "sku": "aa111",
31 "line_description": "Prueba Koywe",
32 "unit_measure": "UN",
33 "unit_price": 1500,
34 "long_description": "Esta es una linea de prueba",
35 "modifier_amount": -100,
36 "total_taxes": 224,
37 "modifier_percentage": 0,
38 "total_amount_line": 1624,
39 "taxes": [
40 {
41 "tax_type_id": "362",
42 "tax_percentage": 16,
43 "tax_amount": 224
44 }
45 ],
46 "additional": {
47 "mx_detail": {
48 "product_service_identifier": "01010101",
49 "measure_unit_code": "E48"
50 }
51 }
52 }
53 ],
54 "totals": {
55 "net_amount": 1400,
56 "taxes_amount": 224,
57 "total_amount": 1624
58 }
59}

Invoice I National without RFC (Factura I - Factura Ingreso Nacional sin RFC)

1{
2 "header": {
3 "account_id": 11857,
4 "document_type_id": "76",
5 "issue_date": "2025-01-07",
6 "issuer_tax_id_code": "EKU9003173C9",
7 "issuer_tax_id_type": "MX-RFC",
8 "issuer_legal_name": "ESCUELA KEMPER URGATE",
9 "issuer_address": "Calle roja 234",
10 "issuer_city": "Ciudad de méxico",
11 "issuer_country_id": "80",
12 "issuer_phone": "2223334444",
13 "issuer_activity": "601",
14 "issuer_postalcode": "42501",
15 "receiver_tax_id_code": "XAXX010101000",
16 "receiver_tax_id_type": "MX-RFC",
17 "receiver_legal_name": "ESCUELA KEMPER URGATE",
18 "receiver_address": "<string>",
19 "receiver_district": "<string>",
20 "receiver_city": "<string>",
21 "receiver_country_id": "80",
22 "receiver_phone": "<string>",
23 "receiver_activity": "<string>",
24 "payment_conditions": "0",
25 "currency_id": 31
26 },
27 "details": [
28 {
29 "quantity": 1,
30 "sku": "aa111",
31 "line_description": "Prueba Koywe",
32 "unit_measure": "UN",
33 "unit_price": 1500,
34 "long_description": "Esta es una linea de prueba",
35 "modifier_amount": -100,
36 "total_taxes": 224,
37 "modifier_percentage": 0,
38 "total_amount_line": 1624,
39 "taxes": [
40 {
41 "tax_type_id": "362",
42 "tax_percentage": 16,
43 "tax_amount": 224
44 }
45 ],
46 "additional": {
47 "mx_detail": {
48 "product_service_identifier": "01010101",
49 "measure_unit_code": "E48"
50 }
51 }
52 }
53 ],
54 "totals": {
55 "net_amount": 1400,
56 "taxes_amount": 224,
57 "total_amount": 1624
58 }
59}

Invoice I with VAT and IEPS taxes (Factura I - Factura Ingreso con IVA y IEPS)

1{
2 "header": {
3 "account_id": 11857,
4 "document_type_id": "76",
5 "issue_date": "2025-01-07",
6 "issuer_tax_id_code": "EKU9003173C9",
7 "issuer_tax_id_type": "MX-RFC",
8 "issuer_legal_name": "ESCUELA KEMPER URGATE",
9 "issuer_address": "Calle roja 234",
10 "issuer_city": "Ciudad de méxico",
11 "issuer_country_id": "80",
12 "issuer_phone": "2223334444",
13 "issuer_activity": "601",
14 "issuer_postalcode": "42501",
15 "receiver_tax_id_code": "EKU9003173C9",
16 "receiver_tax_id_type": "MX-RFC",
17 "receiver_legal_name": "ESCUELA KEMPER URGATE",
18 "receiver_address": "<string>",
19 "receiver_district": "<string>",
20 "receiver_city": "<string>",
21 "receiver_country_id": "80",
22 "receiver_phone": "<string>",
23 "receiver_activity": "<string>",
24 "payment_conditions": "0",
25 "currency_id": 31
26 },
27 "details": [
28 {
29 "quantity": 1,
30 "sku": "aa111",
31 "line_description": "Prueba Koywe",
32 "unit_measure": "UN",
33 "unit_price": 1500,
34 "long_description": "Esta es una linea de prueba",
35 "modifier_amount": -100,
36 "total_taxes": 266,
37 "modifier_percentage": 0,
38 "total_amount_line": 1666,
39 "taxes": [
40 {
41 "tax_type_id": "362",
42 "tax_percentage": 16,
43 "tax_amount": 224
44 },
45 {
46 "tax_type_id": "368",
47 "tax_percentage": 3,
48 "tax_amount": 42
49 }
50 ],
51 "additional": {
52 "mx_detail": {
53 "product_service_identifier": "01010101",
54 "measure_unit_code": "E48"
55 }
56 }
57 }
58 ],
59 "totals": {
60 "net_amount": 1400,
61 "taxes_amount": 266,
62 "total_amount": 1666
63 }
64}

Response status in result the API Rest

statusdescription
0The draft was created successfully, signed, and sent to the SII successfully.
1There are errors in the input, so the draft was not generated nor sent to the SII. The error details will be in error_message.
2The draft was created successfully; however, there are other issues (e.g., lack of folios) that prevented it from being sent to the SII. The error details will be in error_message.
1{
2 "document_id": 377,
3 "header": {
4 "account_id": 14540,
5 "document_type_id": 82,
6 "document_type_taxbureau": "01",
7 "document_number": 1040447,
8 "received_issued_flag": 1,
9 "taxbureau_validation_status": null,
10 "issue_date": "2025-04-15",
11 "issuer_tax_id_code": "860517022-2",
12 "issuer_tax_id_type": "MX-RFC",
13 "issuer_legal_name": "Demo Mexico",
14 "issuer_address": "",
15 "issuer_district": "",
16 "issuer_city": "",
17 "issuer_country_id": 253,
18 "issuer_phone": "442020550",
19 "issuer_activity": "",
20 "receiver_tax_id_code": "1097491385-1",
21 "receiver_tax_id_type": "MX-RFC",
22 "receiver_legal_name": "ESCUELAa KEMPER URGATE",
23 "receiver_address": "",
24 "receiver_district": "",
25 "receiver_city": "",
26 "receiver_country_id": 66,
27 "receiver_phone": "<string>",
28 "receiver_activity": "<string>",
29 "document_status": 1,
30 "payment_conditions": "0",
31 "currency_id": 28
32 },
33 "details": [
34 {
35 "quantity": "1.000000",
36 "line_description": "Prueba Koywe",
37 "long_description": "Esta es una linea de prueba",
38 "unit_measure": "70",
39 "unit_price": "3660.000000",
40 "vat_status": "0",
41 "additional": {
42 "mx_detail": {
43 "product_service_identifier": "01010101",
44 "measure_unit_code": "E48"
45 }
46 }
47 }
48 ],
49 "references": null,
50 "global_modifiers": null,
51 "totals": {
52 "net_amount": 3660,
53 "taxes_amount": 695.4,
54 "total_amount": "4355.40"
55 },
56 "electronic_document": {
57 "document_xml": "PD94bWwgdmVyc2lvbj0iMS4wIiB...",
58 "document_pdf": "JVBERi0xLjMKMyAwIG9iago8PC9..."
59 },
60 "payment_link": null,
61 "result": {
62 "status": 0,
63 "error_message": ""
64 },
65 "_links": {"self": {"href": "https://api-billing.koywe.com/V1/documents"}}
66}