Skip to main content

Authentication Errors

Error Message: 401 Unauthorized - Invalid API keyCauses:
  • API key is incorrect or expired
  • API key not included in Authorization header
  • Wrong header format
Solutions:
# Correct format
Authorization: Bearer YOUR_API_KEY

# Test your API key
curl -X GET "https://api.taxo.co/v1/health" \
  -H "Authorization: Bearer YOUR_API_KEY"
Prevention:
  • Store API keys securely in environment variables
  • Implement API key rotation procedures
  • Monitor for expired keys
Error Message: 400 Bad Request - Invalid CIEC credentialsCauses:
  • Incorrect CIEC username or password
  • Expired CIEC password
  • Account locked due to failed attempts
  • SAT system maintenance
Solutions:
  1. Verify credentials by logging into SAT portal manually
  2. Reset CIEC password if expired
  3. Wait 30 minutes if account is locked
  4. Check SAT system status
Example Response:
{
  "error": {
    "code": "INVALID_CREDENTIALS",
    "message": "The provided CIEC password is incorrect",
    "details": {
      "field": "credentials.password"
    }
  }
}
Error Message: 429 Too Many Requests - Rate limit exceededRate Limits:
  • Extraction Creation: 10 requests per hour
  • Status Checks: 100 requests per minute
  • Document Downloads: 1000 requests per hour
Solutions:
// Implement exponential backoff
async function retryWithBackoff(operation, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    try {
      return await operation();
    } catch (error) {
      if (error.status === 429) {
        const delay = Math.pow(2, i) * 1000; // 1s, 2s, 4s
        await new Promise(resolve => setTimeout(resolve, delay));
      } else {
        throw error;
      }
    }
  }
}

Extraction Errors

Common Causes:
  • Invalid date range (too large or in future)
  • RFC not found in SAT system
  • SAT system temporary unavailability
  • Network connectivity issues
Diagnostic Steps:
  1. Check extraction status details:
curl -X GET "https://api.taxo.co/v1/extractions/{jobId}" \
  -H "Authorization: Bearer YOUR_API_KEY"
  1. Verify RFC exists in SAT:
# Test with smaller date range
{
  "period": {
    "from": "2024-01-01",
    "to": "2024-01-07"  # 1 week instead of full month
  }
}
Solutions:
  • Reduce date range to maximum 3 months
  • Verify RFC is active and registered
  • Retry during SAT business hours (6 AM - 10 PM Mexico time)
Possible Causes:
  • No documents exist for the specified period
  • Incorrect direction filter (INBOUND vs OUTBOUND)
  • Wrong information type
  • Overly restrictive filters
Diagnostic Questions:
  • Are you sure documents exist for this period?
  • Is the direction filter correct?
  • Are there any emitter filters applied?
Example - Remove Filters:
{
  "options": {
    "informationType": "INVOICE",
    // Remove direction to get both INBOUND and OUTBOUND
    "period": {
      "from": "2024-01-01",
      "to": "2024-01-31"
    }
  }
  // Remove filters object entirely
}
Error: Extraction remains in PROCESSING status for over 1 hourCauses:
  • Large date range with many documents
  • SAT system overload
  • Network connectivity issues
Solutions:
  1. Split Large Requests:
// Split by month
const months = [
  { from: '2024-01-01', to: '2024-01-31' },
  { from: '2024-02-01', to: '2024-02-29' },
  { from: '2024-03-01', to: '2024-03-31' }
];

for (const period of months) {
  const extraction = await createExtraction({ ...options, period });
  await waitForCompletion(extraction.publicId);
}
  1. Monitor Progress:
async function monitorExtraction(jobId, timeoutMs = 3600000) { // 1 hour
  const startTime = Date.now();
  
  while (Date.now() - startTime < timeoutMs) {
    const status = await getExtractionStatus(jobId);
    
    if (status.status === 'COMPLETED' || status.status === 'FAILED') {
      return status;
    }
    
    console.log(`Progress: ${status.completedCount}/${status.discoveryCount}`);
    await new Promise(resolve => setTimeout(resolve, 30000)); // 30s
  }
  
  throw new Error('Extraction timeout');
}

Document Download Errors

Error Message: 404 Not Found - Document not foundCauses:
  • Document ID is incorrect
  • Document has expired (retention policy)
  • Document was not successfully extracted
Solutions:
  1. Verify document exists in extraction:
curl -X GET "https://api.taxo.co/v1/extractions/{jobId}" \
  -H "Authorization: Bearer YOUR_API_KEY"
  1. Check document list in response:
{
  "documents": [
    {
      "id": "doc_123456",
      "type": "INVOICE",
      "status": "AVAILABLE"
    }
  ]
}
Error: Requested file type (XML/PDF) not availableAvailability by Document Type:
  • INVOICE: XML ✅, PDF ✅
  • TAX_STATUS: XML ❌, PDF ✅
  • TAX_RETENTION: XML ✅, PDF ✅
Solution:
# Check available types first
curl -X GET "https://api.taxo.co/v1/extractions/{jobId}/documents/{docId}" \
  -H "Authorization: Bearer YOUR_API_KEY"

# Response shows available types
{
  "availableFormats": ["XML", "PDF"]
}
Causes:
  • Large PDF files
  • Network connectivity issues
  • Server overload
Solutions:
// Increase timeout for downloads
const response = await axios.get(downloadUrl, {
  timeout: 60000, // 60 seconds
  responseType: 'arraybuffer'
});

// Implement retry for failed downloads
async function downloadWithRetry(url, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    try {
      return await axios.get(url, { timeout: 60000 });
    } catch (error) {
      if (i === maxRetries - 1) throw error;
      await new Promise(resolve => setTimeout(resolve, 5000));
    }
  }
}

Webhook Issues

Diagnostic Checklist:Test Your Webhook:
# Test webhook endpoint manually
curl -X POST "https://your-domain.com/webhook" \
  -H "Content-Type: application/json" \
  -d '{"test": "webhook"}'
Common Issues:
  • Using HTTP instead of HTTPS
  • Webhook behind authentication/firewall
  • Slow response times (>30 seconds)
  • Invalid SSL certificates
Verify Webhook Signatures:
const crypto = require('crypto');

function verifyWebhookSignature(payload, signature, secret) {
  const expectedSignature = crypto
    .createHmac('sha256', secret)
    .update(payload)
    .digest('hex');
  
  return crypto.timingSafeEqual(
    Buffer.from(signature, 'hex'),
    Buffer.from(expectedSignature, 'hex')
  );
}

// Express.js middleware
app.post('/webhook', (req, res) => {
  const signature = req.headers['x-taxo-signature'];
  const payload = JSON.stringify(req.body);
  
  if (!verifyWebhookSignature(payload, signature, WEBHOOK_SECRET)) {
    return res.status(401).send('Invalid signature');
  }
  
  // Process webhook
  res.status(200).send('OK');
});
Implement Idempotency:
const processedEvents = new Set();

app.post('/webhook', (req, res) => {
  const eventId = req.body.event.id;
  
  // Check if already processed
  if (processedEvents.has(eventId)) {
    return res.status(200).send('Already processed');
  }
  
  try {
    // Process event
    processWebhookEvent(req.body);
    processedEvents.add(eventId);
    res.status(200).send('OK');
  } catch (error) {
    // Don't add to processed set on failure
    res.status(500).send('Processing failed');
  }
});

Performance Issues

Diagnostic Steps:
  1. Check API response times:
const startTime = Date.now();
const response = await makeAPICall();
const responseTime = Date.now() - startTime;
console.log(`API response time: ${responseTime}ms`);
  1. Identify bottlenecks:
  • Network latency
  • Large response payloads
  • Server processing time
Optimization Strategies:
  • Use pagination for large result sets
  • Implement response caching
  • Minimize payload size
  • Use connection pooling
Problem: Out of memory when downloading large PDF filesSolution - Stream Downloads:
const fs = require('fs');
const axios = require('axios');

async function downloadLargeFile(url, filename) {
  const response = await axios({
    method: 'GET',
    url: url,
    responseType: 'stream'
  });
  
  const writer = fs.createWriteStream(filename);
  response.data.pipe(writer);
  
  return new Promise((resolve, reject) => {
    writer.on('finish', resolve);
    writer.on('error', reject);
  });
}

Data Issues

Symptoms:
  • Missing XML elements
  • Corrupted PDF files
  • Truncated content
Solutions:
  1. Re-download the document:
curl -X GET "https://api.taxo.co/v1/extractions/{jobId}/documents/{docId}/download?type=XML" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --output document.xml
  1. Validate XML structure:
const { DOMParser } = require('xmldom');

function validateXML(xmlString) {
  try {
    const parser = new DOMParser();
    const doc = parser.parseFromString(xmlString, 'text/xml');
    
    // Check for parsing errors
    const errors = doc.getElementsByTagName('parsererror');
    return errors.length === 0;
  } catch (error) {
    return false;
  }
}
Problem: Special characters not displaying correctlySolutions:
// Ensure UTF-8 encoding
const response = await axios.get(url, {
  responseType: 'arraybuffer'
});

const decoder = new TextDecoder('utf-8');
const xmlContent = decoder.decode(response.data);

// For Node.js
const content = Buffer.from(response.data).toString('utf-8');

Quick Diagnosis Tool

Use this checklist to quickly diagnose common issues:

Getting Help

When contacting support, please include:
  • API endpoint used
  • Request method (GET, POST, etc.)
  • Request headers (excluding sensitive data)
  • Request payload (excluding credentials)
  • Response status code
  • Response body
  • Complete error message
  • Error code (if available)
  • Timestamp when error occurred
  • Steps to reproduce the issue
  • Expected vs actual behavior
  • Programming language and version
  • SDK/library version (if using)
  • Operating system
  • Network configuration
  • Are you behind a proxy/firewall?

Support Channels

Email Support

[email protected]Response time: 24-48 hours Priority support available for enterprise customers

Developer Forum

Community ForumGet help from other developers Share integration examples

Status Page

status.taxo.coCheck API status and uptime Subscribe to incident notifications

Documentation

Latest API docs and guidesAlways up-to-date Interactive examples