Send to FACe with imported file
Utilizing the B2Brouter API empowers you to seamlessly send invoices to FACe. The process involves:
- Create an invoice: Import your invoice document or JSON payload into B2Brouter.
- Verify recipient information: Ensure the recipient details are accurate and complete.
- Send the invoice: Proceed to send the invoice.
- Track the document: Monitor the traceability of your sent document.
Creating an Invoice
Section titled “Creating an Invoice”To create an invoice using our API, consider these options:
-
Option 1: JSON Payload — Utilize a JSON payload to create your issued invoice.
-
Option 2: Importing a Supported File Format
curl --request POST \ --url https://api-staging.b2brouter.net/accounts/{ACCOUNT_ID}/invoices/import \ --header 'X-B2B-API-Key: {YOUR_API_KEY}' \ --header 'X-B2B-API-Version: {YOUR_API_VERSION}' \ --header 'Content-Type: application/octet-stream' \ --data '@invoice.xml'Upon importing your invoice document, B2Brouter will generate an invoice object if the document meets standard validation criteria.
Verify recipient information
Section titled “Verify recipient information”If it’s the first time sending a document to the recipient, a contact will be automatically generated using the data provided in the invoice. You can also check if the recipient exists in our public directory:
curl --request GET \ --url https://api-staging.b2brouter.net/directory/es/9920/ESP2800500G \ --header 'X-B2B-API-Key: {YOUR_API_KEY}' \ --header 'X-B2B-API-Version: {YOUR_API_VERSION}' \ --header 'Content-Type: application/json'Sample response:
{ "name": "Ayuntamiento de Alcalá de Henares", "tin_scheme": "9920", "tin_value": "ESP2800500G", "invoice": { "transport_type_code": "es.face", "document_type_code": "xml.facturae.3.2" }, "routing_codes": { "cin1_scheme": "8014", "cin2_scheme": "8014", "cin3_scheme": "8014", "cin1_value": "L01280053", "cin2_value": "L01280053", "cin3_value": "L01280053" }}You can also edit your contact information to add DIR3 codes:
curl --request PUT \ --url https://api-staging.b2brouter.net/contacts/{CONTACT_ID} \ --header 'X-B2B-API-Key: {YOUR_API_KEY}' \ --header 'X-B2B-API-Version: {YOUR_API_VERSION}' \ --header 'Content-Type: application/json' \ --data '{ "contact": { "transport_type_code": "es.face", "document_type_code": "xml.facturae.3.2.2", "cin1_scheme": "8014", "cin1_value": "{DIR3_ACCOUNTING}", "cin2_scheme": "8014", "cin2_value": "{DIR3_MANAGING}", "cin3_scheme": "8014", "cin3_value": "{DIR3_PROCESSING}" } }'For more detailed information, check our code lists:
Send your invoice
Section titled “Send your invoice”curl --request POST \ --url https://api-staging.b2brouter.net/invoices/send_invoice/{INVOICE_ID} \ --header 'X-B2B-API-Key: {YOUR_API_KEY}' \ --header 'X-B2B-API-Version: {YOUR_API_VERSION}' \ --header 'Content-Type: application/json'If the imported document matches the recipient’s transport requirements (such as being a facturaE) and remains unaltered, we’ll directly send the original file. Otherwise, we’ll generate a document that aligns with the required document type. Prior to transmission to FACe, we’ll also verify if the XML is signed; if not, we’ll sign it.
Track your invoice
Section titled “Track your invoice”B2Brouter offers two options for monitoring the status of your document:
- Option 1: Retrieve events related to a specific invoice.
- Option 2: Check the status of an invoice.