Skip to main content

Overview

Streamline your accounting processes by automatically extracting and processing tax documents from SAT. Eliminate manual data entry, reduce errors, and ensure your financial records are always up-to-date.

Common Workflow

1

Schedule Extractions

Set up automated extractions to run daily or weekly to capture new invoices and tax documents.
2

Process Documents

Use webhooks to receive real-time notifications when documents are ready for processing.
3

Sync to Accounting System

Automatically import extracted document data into your accounting software (QuickBooks, SAP, Oracle, etc.).
4

Reconcile Transactions

Match incoming documents with existing transactions and flag any discrepancies.

Benefits

Reduce Manual Work

Eliminate hours of manual document entry and data processing.

Improve Accuracy

Reduce human errors with automated data extraction and validation.

Real-time Updates

Keep your accounting records current with automatic document processing.

Audit Trail

Maintain complete audit trails with timestamped document processing.

Implementation Example

const axios = require('axios');

class AccountingAutomation {
  constructor(apiKey, accountingSystemAPI) {
    this.apiKey = apiKey;
    this.accountingAPI = accountingSystemAPI;
  }

  async scheduleInvoiceExtraction(rfc, period) {
    // Extract invoices from SAT
    const extraction = await axios.post('https://api.taxo.co/v1/extractions', {
      subject: { identifier: rfc },
      credentials: {
        SAT: {
          type: 'USERNAME_PASSWORD',
          username: rfc,
          password: process.env.CIEC_PASSWORD
        }
      },
      options: {
        informationType: 'INVOICE',
        direction: 'INBOUND',
        period: period
      }
    }, {
      headers: { 'Authorization': `Bearer ${this.apiKey}` }
    });

    return extraction.data.publicId;
  }

  async processCompletedExtraction(jobId) {
    // Get extraction status
    const status = await axios.get(`https://api.taxo.co/v1/extractions/${jobId}`, {
      headers: { 'Authorization': `Bearer ${this.apiKey}` }
    });

    if (status.data.status === 'COMPLETED') {
      // Process each document
      for (const document of status.data.documents) {
        await this.syncToAccounting(document);
      }
    }
  }

  async syncToAccounting(document) {
    // Download document
    const docData = await axios.get(
      `https://api.taxo.co/v1/extractions/${document.extractionId}/documents/${document.id}/download?type=XML`,
      { headers: { 'Authorization': `Bearer ${this.apiKey}` } }
    );

    // Parse and sync to accounting system
    const invoiceData = this.parseInvoiceXML(docData.data);
    await this.accountingAPI.createInvoice(invoiceData);
  }

  parseInvoiceXML(xmlData) {
    // Extract relevant accounting data from XML
    return {
      invoiceNumber: xmlData.invoiceNumber,
      date: xmlData.date,
      supplier: xmlData.supplier,
      amount: xmlData.total,
      taxAmount: xmlData.tax,
      // ... other fields
    };
  }
}

Webhook Integration

Set up webhooks to automatically process documents as they become available:
{
  "event": {
    "type": "invoice.ready",
    "timestamp": "2025-01-04T12:45:23.456Z"
  },
  "extractionRequest": {
    "jobId": "JOB20250104123456789A",
    "informationType": "INVOICE"
  },
  "deliveredItem": {
    "reference": "550e8400-e29b-41d4-a716-446655440000",
    "type": "INVOICE",
    "files": [
      {
        "type": "XML",
        "reference": "file_123456"
      },
      {
        "type": "PDF", 
        "reference": "file_789012"
      }
    ]
  }
}

Best Practices

  • Set up daily extractions during off-peak hours
  • Use date ranges that align with your accounting periods
  • Implement retry logic for failed extractions
  • Validate extracted data before importing to accounting system
  • Implement business rules to flag unusual transactions
  • Maintain audit logs of all processed documents
  • Set up alerts for failed extractions or import errors
  • Implement dead letter queues for failed webhook processing
  • Provide manual override capabilities for edge cases

Next Steps