Generate & regenerate evidence
Call the Generate Evidence API with a dispute ID or inline dispute data, handle its error codes, and regenerate versioned evidence PDFs as new data arrives.
Generating evidence is the core EaaS action: you hand Chargeflow a dispute - by dispute_id or inline - and it returns an AI-composed, versioned evidence package. This page covers the call, its error codes, and how to regenerate as new data arrives.
Generate evidence
Use the Generate Evidence API to kick off AI-powered evidence creation for a dispute.
POST /public/2025-04-01/evidenceThe endpoint accepts either an existing Chargeflow dispute_id or a full inline dispute object. You do not need to create the dispute separately first.
Integration patterns
Option A, reference an existing dispute:
curl -X POST https://api.chargeflow.io/public/2025-04-01/evidence \
-H "x-api-key: YOUR_PLATFORM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"account_id": "66e6ea9ecd94925a9f8060d9",
"dispute": {
"dispute_id": "66e6ea9ecd94925a9f8060d9"
}
}'Option B, submit dispute data inline:
curl -X POST https://api.chargeflow.io/public/2025-04-01/evidence \
-H "x-api-key: YOUR_PLATFORM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"account_id": "66e6ea9ecd94925a9f8060d9",
"dispute": {
"dispute_data": {
"source_id": "du_123456789",
"created_at": "2024-02-10T12:00:00Z",
"reason": "fraud",
"due_by": "2024-02-20T12:00:00Z",
"amount": 150.00,
"currency": "USD",
"status": "needs_response",
"transaction": {
"source_id": "tx_1234567890",
"created_at": "2024-02-08T10:00:00Z",
"type": "paid",
"amount": 150.00,
"currency": "USD"
}
}
}
}'Response
The API responds immediately with an in_progress status. Evidence generation is asynchronous; the PDF is not included in the response. Listen for the evidence.ready or evidence.error webhooks to know when it completes.
{
"id": "ev_abc123456789",
"account_id": "acct_9876543210",
"ext_account_id": "ext_acct_54321",
"dispute": "dp_1122334455",
"created_at": "2025-07-29T14:35:00Z",
"status": "in_progress",
"file_url": null,
"file_version": 1
}Generation typically completes in ~30 seconds, with a maximum of ~3 minutes.
Error codes
| Error Code | HTTP Status | Description |
|---|---|---|
422_dispute_invalid_state | 422 | Dispute must have status needs_response to generate evidence. |
409_generation_in_progress | 409 | Evidence generation is already in progress for this dispute. Do not retry - wait for the completion webhook (see warning below). |
404_*_not_found | 404 | The dispute was not found. Verify the dispute_id is correct and belongs to the given account_id. |
403_eaas_not_enabled | 403 | Your API key is not entitled to EaaS. Contact your account manager to enable it. |
504_generation_timeout | 504 | The generation operation timed out. Retry the request. |
Warning
Do not retry on 409_generation_in_progress. Wait for the evidence.ready or evidence.error webhook before taking further action.
Regenerate evidence
Evidence can be regenerated at any time while the dispute remains in needs_response status. Each regeneration attempt increments file_version, giving you a full history of evidence revisions.
curl -X POST https://api.chargeflow.io/public/2025-04-01/evidence \
-H "x-api-key: YOUR_PLATFORM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"account_id": "66e6ea9ecd94925a9f8060d9",
"dispute": {
"dispute_id": "66e6ea9ecd94925a9f8060d9"
}
}'The response will show file_version: 2 (or higher) once the new PDF is ready.
When to regenerate:
- New order data has become available (tracking, fulfillment, etc.)
- The merchant has added communication logs or policy context
- You received an
evidence.errorand have resolved the underlying issue
Tip
More data equals stronger narratives. Missing pieces won't block generation; the AI agent prioritizes the most impactful evidence available. But richer context consistently produces more persuasive evidence packages.
Report dispute outcomes
When disputes are resolved (won or lost), share the outcome with Chargeflow. This data helps the AI continuously refine dispute strategies and improve win rates across all merchants on your platform.
Contact your account manager for the preferred method of submitting outcome data for your integration.