curl --request POST \
--url https://api.example.com/invoices \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"series": "A",
"folioNumber": "1",
"date": "2026-07-30T22:50:00",
"use": "G03",
"items": [
{
"quantity": 1,
"amount": 100,
"productId": "<string>",
"description": "Servicio de consultoría",
"unitPrice": 100,
"productKey": "84111506",
"unitKey": "E48",
"unit": "E48",
"taxObject": "02",
"taxes": [
{
"type": "002",
"factorType": "Tasa",
"rate": "0.160000",
"base": 100,
"amount": 16,
"withholding": false
}
]
}
],
"type": "I",
"relatedInvoiceUuid": "d3bfbc57-44af-4390-a064-f0afab85e5df",
"paymentForm": "01",
"paymentMethod": "PUE",
"currency": "MXN",
"exchange": 1,
"export": "01",
"customerId": "<string>",
"idempotencyKey": "order-8421-attempt-1"
}
'import requests
url = "https://api.example.com/invoices"
payload = {
"series": "A",
"folioNumber": "1",
"date": "2026-07-30T22:50:00",
"use": "G03",
"items": [
{
"quantity": 1,
"amount": 100,
"productId": "<string>",
"description": "Servicio de consultoría",
"unitPrice": 100,
"productKey": "84111506",
"unitKey": "E48",
"unit": "E48",
"taxObject": "02",
"taxes": [
{
"type": "002",
"factorType": "Tasa",
"rate": "0.160000",
"base": 100,
"amount": 16,
"withholding": False
}
]
}
],
"type": "I",
"relatedInvoiceUuid": "d3bfbc57-44af-4390-a064-f0afab85e5df",
"paymentForm": "01",
"paymentMethod": "PUE",
"currency": "MXN",
"exchange": 1,
"export": "01",
"customerId": "<string>",
"idempotencyKey": "order-8421-attempt-1"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
series: 'A',
folioNumber: '1',
date: '2026-07-30T22:50:00',
use: 'G03',
items: [
{
quantity: 1,
amount: 100,
productId: '<string>',
description: 'Servicio de consultoría',
unitPrice: 100,
productKey: '84111506',
unitKey: 'E48',
unit: 'E48',
taxObject: '02',
taxes: [
{
type: '002',
factorType: 'Tasa',
rate: '0.160000',
base: 100,
amount: 16,
withholding: false
}
]
}
],
type: 'I',
relatedInvoiceUuid: 'd3bfbc57-44af-4390-a064-f0afab85e5df',
paymentForm: '01',
paymentMethod: 'PUE',
currency: 'MXN',
exchange: 1,
export: '01',
customerId: '<string>',
idempotencyKey: 'order-8421-attempt-1'
})
};
fetch('https://api.example.com/invoices', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/invoices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'series' => 'A',
'folioNumber' => '1',
'date' => '2026-07-30T22:50:00',
'use' => 'G03',
'items' => [
[
'quantity' => 1,
'amount' => 100,
'productId' => '<string>',
'description' => 'Servicio de consultoría',
'unitPrice' => 100,
'productKey' => '84111506',
'unitKey' => 'E48',
'unit' => 'E48',
'taxObject' => '02',
'taxes' => [
[
'type' => '002',
'factorType' => 'Tasa',
'rate' => '0.160000',
'base' => 100,
'amount' => 16,
'withholding' => false
]
]
]
],
'type' => 'I',
'relatedInvoiceUuid' => 'd3bfbc57-44af-4390-a064-f0afab85e5df',
'paymentForm' => '01',
'paymentMethod' => 'PUE',
'currency' => 'MXN',
'exchange' => 1,
'export' => '01',
'customerId' => '<string>',
'idempotencyKey' => 'order-8421-attempt-1'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/invoices"
payload := strings.NewReader("{\n \"series\": \"A\",\n \"folioNumber\": \"1\",\n \"date\": \"2026-07-30T22:50:00\",\n \"use\": \"G03\",\n \"items\": [\n {\n \"quantity\": 1,\n \"amount\": 100,\n \"productId\": \"<string>\",\n \"description\": \"Servicio de consultoría\",\n \"unitPrice\": 100,\n \"productKey\": \"84111506\",\n \"unitKey\": \"E48\",\n \"unit\": \"E48\",\n \"taxObject\": \"02\",\n \"taxes\": [\n {\n \"type\": \"002\",\n \"factorType\": \"Tasa\",\n \"rate\": \"0.160000\",\n \"base\": 100,\n \"amount\": 16,\n \"withholding\": false\n }\n ]\n }\n ],\n \"type\": \"I\",\n \"relatedInvoiceUuid\": \"d3bfbc57-44af-4390-a064-f0afab85e5df\",\n \"paymentForm\": \"01\",\n \"paymentMethod\": \"PUE\",\n \"currency\": \"MXN\",\n \"exchange\": 1,\n \"export\": \"01\",\n \"customerId\": \"<string>\",\n \"idempotencyKey\": \"order-8421-attempt-1\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/invoices")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"series\": \"A\",\n \"folioNumber\": \"1\",\n \"date\": \"2026-07-30T22:50:00\",\n \"use\": \"G03\",\n \"items\": [\n {\n \"quantity\": 1,\n \"amount\": 100,\n \"productId\": \"<string>\",\n \"description\": \"Servicio de consultoría\",\n \"unitPrice\": 100,\n \"productKey\": \"84111506\",\n \"unitKey\": \"E48\",\n \"unit\": \"E48\",\n \"taxObject\": \"02\",\n \"taxes\": [\n {\n \"type\": \"002\",\n \"factorType\": \"Tasa\",\n \"rate\": \"0.160000\",\n \"base\": 100,\n \"amount\": 16,\n \"withholding\": false\n }\n ]\n }\n ],\n \"type\": \"I\",\n \"relatedInvoiceUuid\": \"d3bfbc57-44af-4390-a064-f0afab85e5df\",\n \"paymentForm\": \"01\",\n \"paymentMethod\": \"PUE\",\n \"currency\": \"MXN\",\n \"exchange\": 1,\n \"export\": \"01\",\n \"customerId\": \"<string>\",\n \"idempotencyKey\": \"order-8421-attempt-1\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/invoices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"series\": \"A\",\n \"folioNumber\": \"1\",\n \"date\": \"2026-07-30T22:50:00\",\n \"use\": \"G03\",\n \"items\": [\n {\n \"quantity\": 1,\n \"amount\": 100,\n \"productId\": \"<string>\",\n \"description\": \"Servicio de consultoría\",\n \"unitPrice\": 100,\n \"productKey\": \"84111506\",\n \"unitKey\": \"E48\",\n \"unit\": \"E48\",\n \"taxObject\": \"02\",\n \"taxes\": [\n {\n \"type\": \"002\",\n \"factorType\": \"Tasa\",\n \"rate\": \"0.160000\",\n \"base\": 100,\n \"amount\": 16,\n \"withholding\": false\n }\n ]\n }\n ],\n \"type\": \"I\",\n \"relatedInvoiceUuid\": \"d3bfbc57-44af-4390-a064-f0afab85e5df\",\n \"paymentForm\": \"01\",\n \"paymentMethod\": \"PUE\",\n \"currency\": \"MXN\",\n \"exchange\": 1,\n \"export\": \"01\",\n \"customerId\": \"<string>\",\n \"idempotencyKey\": \"order-8421-attempt-1\"\n}"
response = http.request(request)
puts response.read_body{
"id": "0f2a1c3e-1a2b-4c3d-9e8f-1234567890ab",
"uuid": "d3bfbc57-44af-4390-a064-f0afab85e5df",
"status": "valid",
"type": "I",
"series": "A",
"folioNumber": "1",
"total": 116,
"date": "2026-07-30T22:50:00",
"xml": "<string>",
"createdAt": "2026-07-30T22:50:03.412Z",
"environment": "production"
}Create and stamp a CFDI 4.0 invoice via the configured PAC
Authenticate with either a Supabase session (send the X-Organization-Id header, must be a member of that organization) or an API key (external integrations, requires the write:invoices scope — the organization is resolved from the key). The customer can be sent inline (customer) or referenced by ID (customerId).
curl --request POST \
--url https://api.example.com/invoices \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"series": "A",
"folioNumber": "1",
"date": "2026-07-30T22:50:00",
"use": "G03",
"items": [
{
"quantity": 1,
"amount": 100,
"productId": "<string>",
"description": "Servicio de consultoría",
"unitPrice": 100,
"productKey": "84111506",
"unitKey": "E48",
"unit": "E48",
"taxObject": "02",
"taxes": [
{
"type": "002",
"factorType": "Tasa",
"rate": "0.160000",
"base": 100,
"amount": 16,
"withholding": false
}
]
}
],
"type": "I",
"relatedInvoiceUuid": "d3bfbc57-44af-4390-a064-f0afab85e5df",
"paymentForm": "01",
"paymentMethod": "PUE",
"currency": "MXN",
"exchange": 1,
"export": "01",
"customerId": "<string>",
"idempotencyKey": "order-8421-attempt-1"
}
'import requests
url = "https://api.example.com/invoices"
payload = {
"series": "A",
"folioNumber": "1",
"date": "2026-07-30T22:50:00",
"use": "G03",
"items": [
{
"quantity": 1,
"amount": 100,
"productId": "<string>",
"description": "Servicio de consultoría",
"unitPrice": 100,
"productKey": "84111506",
"unitKey": "E48",
"unit": "E48",
"taxObject": "02",
"taxes": [
{
"type": "002",
"factorType": "Tasa",
"rate": "0.160000",
"base": 100,
"amount": 16,
"withholding": False
}
]
}
],
"type": "I",
"relatedInvoiceUuid": "d3bfbc57-44af-4390-a064-f0afab85e5df",
"paymentForm": "01",
"paymentMethod": "PUE",
"currency": "MXN",
"exchange": 1,
"export": "01",
"customerId": "<string>",
"idempotencyKey": "order-8421-attempt-1"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
series: 'A',
folioNumber: '1',
date: '2026-07-30T22:50:00',
use: 'G03',
items: [
{
quantity: 1,
amount: 100,
productId: '<string>',
description: 'Servicio de consultoría',
unitPrice: 100,
productKey: '84111506',
unitKey: 'E48',
unit: 'E48',
taxObject: '02',
taxes: [
{
type: '002',
factorType: 'Tasa',
rate: '0.160000',
base: 100,
amount: 16,
withholding: false
}
]
}
],
type: 'I',
relatedInvoiceUuid: 'd3bfbc57-44af-4390-a064-f0afab85e5df',
paymentForm: '01',
paymentMethod: 'PUE',
currency: 'MXN',
exchange: 1,
export: '01',
customerId: '<string>',
idempotencyKey: 'order-8421-attempt-1'
})
};
fetch('https://api.example.com/invoices', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/invoices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'series' => 'A',
'folioNumber' => '1',
'date' => '2026-07-30T22:50:00',
'use' => 'G03',
'items' => [
[
'quantity' => 1,
'amount' => 100,
'productId' => '<string>',
'description' => 'Servicio de consultoría',
'unitPrice' => 100,
'productKey' => '84111506',
'unitKey' => 'E48',
'unit' => 'E48',
'taxObject' => '02',
'taxes' => [
[
'type' => '002',
'factorType' => 'Tasa',
'rate' => '0.160000',
'base' => 100,
'amount' => 16,
'withholding' => false
]
]
]
],
'type' => 'I',
'relatedInvoiceUuid' => 'd3bfbc57-44af-4390-a064-f0afab85e5df',
'paymentForm' => '01',
'paymentMethod' => 'PUE',
'currency' => 'MXN',
'exchange' => 1,
'export' => '01',
'customerId' => '<string>',
'idempotencyKey' => 'order-8421-attempt-1'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/invoices"
payload := strings.NewReader("{\n \"series\": \"A\",\n \"folioNumber\": \"1\",\n \"date\": \"2026-07-30T22:50:00\",\n \"use\": \"G03\",\n \"items\": [\n {\n \"quantity\": 1,\n \"amount\": 100,\n \"productId\": \"<string>\",\n \"description\": \"Servicio de consultoría\",\n \"unitPrice\": 100,\n \"productKey\": \"84111506\",\n \"unitKey\": \"E48\",\n \"unit\": \"E48\",\n \"taxObject\": \"02\",\n \"taxes\": [\n {\n \"type\": \"002\",\n \"factorType\": \"Tasa\",\n \"rate\": \"0.160000\",\n \"base\": 100,\n \"amount\": 16,\n \"withholding\": false\n }\n ]\n }\n ],\n \"type\": \"I\",\n \"relatedInvoiceUuid\": \"d3bfbc57-44af-4390-a064-f0afab85e5df\",\n \"paymentForm\": \"01\",\n \"paymentMethod\": \"PUE\",\n \"currency\": \"MXN\",\n \"exchange\": 1,\n \"export\": \"01\",\n \"customerId\": \"<string>\",\n \"idempotencyKey\": \"order-8421-attempt-1\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/invoices")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"series\": \"A\",\n \"folioNumber\": \"1\",\n \"date\": \"2026-07-30T22:50:00\",\n \"use\": \"G03\",\n \"items\": [\n {\n \"quantity\": 1,\n \"amount\": 100,\n \"productId\": \"<string>\",\n \"description\": \"Servicio de consultoría\",\n \"unitPrice\": 100,\n \"productKey\": \"84111506\",\n \"unitKey\": \"E48\",\n \"unit\": \"E48\",\n \"taxObject\": \"02\",\n \"taxes\": [\n {\n \"type\": \"002\",\n \"factorType\": \"Tasa\",\n \"rate\": \"0.160000\",\n \"base\": 100,\n \"amount\": 16,\n \"withholding\": false\n }\n ]\n }\n ],\n \"type\": \"I\",\n \"relatedInvoiceUuid\": \"d3bfbc57-44af-4390-a064-f0afab85e5df\",\n \"paymentForm\": \"01\",\n \"paymentMethod\": \"PUE\",\n \"currency\": \"MXN\",\n \"exchange\": 1,\n \"export\": \"01\",\n \"customerId\": \"<string>\",\n \"idempotencyKey\": \"order-8421-attempt-1\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/invoices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"series\": \"A\",\n \"folioNumber\": \"1\",\n \"date\": \"2026-07-30T22:50:00\",\n \"use\": \"G03\",\n \"items\": [\n {\n \"quantity\": 1,\n \"amount\": 100,\n \"productId\": \"<string>\",\n \"description\": \"Servicio de consultoría\",\n \"unitPrice\": 100,\n \"productKey\": \"84111506\",\n \"unitKey\": \"E48\",\n \"unit\": \"E48\",\n \"taxObject\": \"02\",\n \"taxes\": [\n {\n \"type\": \"002\",\n \"factorType\": \"Tasa\",\n \"rate\": \"0.160000\",\n \"base\": 100,\n \"amount\": 16,\n \"withholding\": false\n }\n ]\n }\n ],\n \"type\": \"I\",\n \"relatedInvoiceUuid\": \"d3bfbc57-44af-4390-a064-f0afab85e5df\",\n \"paymentForm\": \"01\",\n \"paymentMethod\": \"PUE\",\n \"currency\": \"MXN\",\n \"exchange\": 1,\n \"export\": \"01\",\n \"customerId\": \"<string>\",\n \"idempotencyKey\": \"order-8421-attempt-1\"\n}"
response = http.request(request)
puts response.read_body{
"id": "0f2a1c3e-1a2b-4c3d-9e8f-1234567890ab",
"uuid": "d3bfbc57-44af-4390-a064-f0afab85e5df",
"status": "valid",
"type": "I",
"series": "A",
"folioNumber": "1",
"total": 116,
"date": "2026-07-30T22:50:00",
"xml": "<string>",
"createdAt": "2026-07-30T22:50:03.412Z",
"environment": "production"
}Authorizations
API Key for authentication (format: sk_...)
Headers
Required for Supabase session auth. Ignored when authenticating with an API key (the organization resolves from the key).
Body
"A"
"1"
"2026-07-30T22:50:00"
SAT uso CFDI catalog code
"G03"
Show child attributes
Show child attributes
Ingreso, Egreso, or Traslado (default: I)
I, E, T "I"
Required when type is E (Egreso/nota de crédito) — UUID fiscal of the original Ingreso CFDI it credits. Must belong to this organization and be a vigente Ingreso.
"d3bfbc57-44af-4390-a064-f0afab85e5df"
SAT forma de pago catalog code — required unless type is T (Traslado)
"01"
Default: PUE
PUE, PPD "PUE"
Default: MXN
"MXN"
Default: 1
1
SAT clave de exportación catalog code — default: 01
"01"
Show child attributes
Show child attributes
Existing customer ID — mutually exclusive with customer
Client-supplied key to safely retry this request without double-stamping. If an invoice was already created for this organization with the same key, that invoice is returned instead of stamping again.
"order-8421-attempt-1"
Response
Timbrix invoice record ID
"0f2a1c3e-1a2b-4c3d-9e8f-1234567890ab"
Folio fiscal UUID asignado por el SAT vía PAC
"d3bfbc57-44af-4390-a064-f0afab85e5df"
valid "valid"
I = Ingreso, E = Egreso, T = Traslado
I, E, T "I"
"A"
"1"
116
"2026-07-30T22:50:00"
XML del CFDI timbrado (UTF-8)
"2026-07-30T22:50:03.412Z"
Ambiente en el que se timbró el CFDI. Los CFDI de sandbox no tienen validez fiscal ante el SAT.
sandbox, production "production"