goFX API Documentation
Generate a Factur-X PDF
Endpoint: POST https://api.gofx.dev/api/generate
Headers:
X-API-Key: sk_live_YOUR_API_KEY Content-Type: application/json
Code Snippets
const fetch = require('node-fetch');
const payload = {
"invoice": {
"profile": "EN16931",
"invoice": { "number": "INV-2026-001", "type": "380", "issue_date": "2026-01-15T00:00:00Z", "currency": "EUR" },
"seller": {
"name": "Tech Corp",
"registration": "123456789",
"global_id": { "scheme_id": "0002", "value": "123456789" },
"endpoint_id": { "scheme_id": "0002", "value": "123456789" },
"address": { "street": "123 Rue", "postal_code": "75000", "city": "Paris", "country": "FR" },
"vat_id": "FR12345678901"
},
"buyer": {
"name": "Acme Inc",
"global_id": { "scheme_id": "0002", "value": "987654321" },
"endpoint_id": { "scheme_id": "0002", "value": "987654321" },
"address": { "street": "456 Avenue", "postal_code": "69000", "city": "Lyon", "country": "FR" }
},
"lines": [
{ "id": "1", "description": "Software License - Abonnement", "quantity": 1, "unit": "EA", "unit_price": 150.00, "vat_rate": 20.0, "vat_amount": 30.00, "total_excl_vat": 150.00, "total_incl_vat": 180.00 }
],
"totals": {
"tax_basis_total": 150.00,
"total_vat": 30.00,
"total_incl_vat": 180.00,
"subtotal_excl_vat": 150.00,
"amount_due": 180.00,
"vat_breakdown": [ { "rate": 20.0, "taxable_amount": 150.00, "vat_amount": 30.00 } ]
}
},
"options": {
"templateId": "tpl_standard_b2b"
}
};
async function generateInvoice() {
const response = await fetch('https://api.gofx.dev/api/generate', {
method: 'POST',
headers: {
'X-API-Key': 'sk_live_YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify(payload)
});
if (!response.ok) {
const errorText = await response.text();
console.error('Erreur API:', response.status, errorText);
return;
}
const data = await response.json();
console.log('Facture URL:', data.url || data);
}
generateInvoice();Response (Success):
{
"status": "success",
"url": "https://storage.googleapis.com/..."
}Error Codes
400 Bad Request: Invalid Factur-X payload schema (e.g. missing SIREN).401 Unauthorized: Invalid or missing API key402 Payment Required: Monthly quota exceeded429 Too Many Requests: Rate limit exceeded (upgrade plan for higher limits)