Aller au contenu
Log in

Send to FACe with imported file

Ce contenu n’est pas encore disponible dans votre langue.

Utilizing the B2Brouter API empowers you to seamlessly send invoices to FACe. The process involves:

  1. Create an invoice: Import your invoice document or JSON payload into B2Brouter.
  2. Verify recipient information: Ensure the recipient details are accurate and complete.
  3. Send the invoice: Proceed to send the invoice.
  4. Track the document: Monitor the traceability of your sent document.

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

Terminal window
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.

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:

Terminal window
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:

Terminal window
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:

Terminal window
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.

B2Brouter offers two options for monitoring the status of your document: