Accounts receivable REST API invoice posting fails with duplicate error

We’re experiencing consistent failures when posting invoices through the CloudSuite AR REST API endpoint. The integration worked fine for the first two weeks after go-live, but now we’re getting duplicate invoice errors even though we’re sending unique invoice numbers in each payload.

The error message returns: “Invoice number INV-2025-0345 already exists in system” but when we check the AR module, that invoice number doesn’t exist anywhere. We’ve verified our payload includes unique invoice numbers with proper formatting, and we’re using the standard /invoices/post endpoint.

This is causing significant billing delays as invoices are piling up in our middleware queue. Has anyone encountered similar duplicate detection issues with the AR REST API in ICS 2021?

Glad the cleanup resolved your immediate issue. Let me address all three aspects of your original problem comprehensively:

REST API Endpoint Configuration: The /invoices/post endpoint in ICS 2021 has a known issue with transaction state management. When implementing your integration, add these headers to your API calls:


X-Transaction-Timeout: 300
X-Force-Unique-Check: false
X-Clear-Pending-On-Retry: true

The timeout ensures long-running posts don’t leave orphaned pending records, while the unique check parameter limits scope as James mentioned.

Unique Invoice Numbers in Payload: Your payload structure should include both the invoice number and a transaction ID for idempotency. Structure it like:

{
  "invoiceNumber": "INV-2025-0345",
  "transactionId": "uuid-generated-value",
  "companyCode": "1000",
  "fiscalYear": "2025"
}

The transactionId allows safe retries without creating duplicates even if the initial call partially succeeded.

Error Message Handling: The duplicate invoice error you encountered occurs because CloudSuite checks three tables: posted invoices (AR_INVOICE), pending transactions (AR_PENDING), and the audit trail (AR_HISTORY). Your invoices were stuck in AR_PENDING with PROCESSING status, which is why they didn’t appear in normal AR screens but triggered duplicate errors.

Prevention Strategy: Implement a scheduled job (daily at 2 AM) that runs the transaction cleanup utility automatically. Set it to clear any transactions stuck in PROCESSING status for more than 6 hours. Also, configure your middleware to include retry logic with exponential backoff - if an invoice post fails, wait 30 seconds before retry, then 60, then 120. This prevents rapid-fire retries that can create multiple pending entries.

Additionally, enable API logging in CloudSuite (System Configuration > API Management > Enable Transaction Logs) to track the full lifecycle of each invoice post. This helps diagnose whether failures occur during validation, posting, or commit phases.

For monitoring, set up alerts when the AR_PENDING table exceeds 50 records, as this indicates a systemic issue with transaction completion rather than isolated failures.

I’ve seen this before. The duplicate check in AR REST API sometimes looks at pending transactions in addition to posted invoices. Check if you have any failed transactions still in pending status - they might be blocking your invoice numbers even though they’re not visible in the main AR screens.

For the REST API endpoint specifically, make sure you’re including the ‘force_unique_check’ parameter set to false in your header. ICS 2021 has an overly aggressive duplicate detection by default that checks across all company codes and fiscal years. Setting this parameter limits the uniqueness check to current fiscal year and company context only.

Checked the pending transactions table and found several stuck entries from last week. They’re showing status ‘PROCESSING’ with no completion timestamp. These match some of our failed invoice numbers. How do I clear these out safely?

Don’t manually delete those pending records - it can corrupt your AR ledger. Instead, you need to use the transaction cleanup utility in CloudSuite. Navigate to Accounts Receivable > System Tools > Transaction Management, then run the ‘Clear Stale Transactions’ process. Set the threshold to 48 hours to catch anything stuck longer than two days. This will properly roll back the pending entries and release those invoice numbers for reuse.