➕ Create new documents

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.

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

Invoice with bill of lading complement

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

Invoice with exports complement

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

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 "quantity": "1.000000",
35 "line_description": "Prueba Koywe",
36 "long_description": "Esta es una linea de prueba",
37 "unit_measure": "70",
38 "unit_price": "3660.000000",
39 "vat_status": "0"
40 }],
41 "references": null,
42 "global_modifiers": null,
43 "totals": {
44 "net_amount": 3660,
45 "taxes_amount": 695.4,
46 "total_amount": "4355.40"
47 },
48 "electronic_document": {
49 "document_xml": "PD94bWwgdmVyc2lvbj0iMS4wIiB...",
50 "document_pdf": "JVBERi0xLjMKMyAwIG9iago8PC9..."
51 },
52 "payment_link": null,
53 "result": {
54 "status": 0,
55 "error_message": ""
56 },
57 "_links": {"self": {"href": "https://api-billing.koywe.com/V1/documents"}}
58}