Two-document integration

v1.40.39 release candidate. This guide does not establish that the candidate is deployed; check the running service's /openapi.json.

An account enabled for paired delivery receives a merchant-facing Teaser and a four-page INTERNAL analysis from one eligible job. Request teaser for a merchant-primary job or statement_analysis_internal for an internal-primary job. Enablement is an account setting, not a form parameter. Other report types and accounts keep their existing behavior.

INTERNAL is not for customer use. It contains processor economics, findings and quote preparation, not a customer proposal. Keep the two download actions separate in your application.

1. Submit once

Use POST /v1/reports with Authorization: Bearer …, multipart form data, merchant_name, and report_type. A Teaser accepts one statement or one to three distinct monthly files as repeated statements, never both. The internal-primary request retains its single statement input. Optional reference and webhook_url retain their existing meanings.

PDF, XLSX, XLS and CSV are supported. Include the complete statement. Spreadsheet sales, fees and each included month need original-cell evidence; transaction rows can establish authorization counts, payout rows cannot. Payout-only exports or missing fee totals can require review. Default limits are 100 MiB per file and 300 MiB combined; size/type violations return 413/415.

Save the returned job_id. A 503 refusal includes Retry-After: 30; wait at least that long, add jitter and use bounded backoff only when no job was accepted. After a job ID, poll it—never upload again to obtain the companion or retry processing. If acceptance is uncertain after a lost response, reconcile it before submitting again.

2. Poll the same job

Use GET /v1/reports/{job_id} with the same key, no more often than every 15 seconds. queued and processing are not completion. Honor a returned retry_at when processing is temporarily delayed.

Both documents must pass the existing final review before delivery. Sound figures do not waive missing evidence or review requirements. Cosmetic wrapping does not by itself create a hold.

3. Use the correct document

A completed poll response and its report.complete webhook include files and file_count. For a pair, the count is 2: one merchant entry and one internal entry. Each entry gives name, role and a full download_url. Download both files using the same owning account's Bearer key. Keep INTERNAL restricted to your team. Existing primary and companion URL fields remain available.

{"file_count":2,"files":[
  {"name":"Example Store Statement Analysis.pdf","role":"merchant","download_url":"https://api.example.com/v1/reports/example/teaser"},
  {"name":"Example Store Statement Analysis - INTERNAL.pdf","role":"internal","download_url":"https://api.example.com/v1/reports/example/internal"}
]}

The teaser request and route names stay unchanged for compatibility. The PDFs are named [Merchant Business Name] Statement Analysis.pdf and [Merchant Business Name] Statement Analysis - INTERNAL.pdf. An account's brand assignment enables the pair; there is no extra upload parameter.

Field or routeMeaning
pdf_url
GET …/pdf
Existing primary PDF. Merchant Teaser for teaser; INTERNAL for statement_analysis_internal. Not a combined document.
teaser_pdf_url
GET …/teaser
Optional merchant-facing companion.
internal_pdf_url
GET …/internal
Optional INTERNAL companion. Never expose it as a customer-facing report.
GET …/filesCompanion manifest with files and file_count. Every entry has name, role and full download_url. The original relative url field is retained. Route by role, not filename.

All these routes require the owning account's Bearer key. The URLs are not signed public links. A missing, inaccessible or incomplete pair returns 404; blocked review returns 409. A completed report of another type can still have pdf_url without any pair.

Existing request/response fields and normal job billing are unchanged. The new links are additive and optional; old jobs are not backfilled. Using only pdf_url misses the companion—and misses INTERNAL for a Teaser request.

Worked example

This shell example uses curl and jq. Configure your service base URL and key securely before running it. The example names and job IDs are fictional. Change the input extension to use PDF, XLSX, XLS or CSV; the form field stays statement.

set -eu
: "${API_BASE_URL:?Set the supplied service base URL}"
: "${API_KEY:?Configure your API key securely}"
BASE=${API_BASE_URL%/}

curl --fail-with-body --silent --show-error \
  -H "Authorization: Bearer $API_KEY" \
  -F report_type=teaser \
  -F merchant_name="Fictional Example Store" \
  -F reference="paired-example" \
  -F statement=@statement.xlsx \
  "$BASE/v1/reports" > accepted.json
JOB_ID=$(jq -er '.job_id' accepted.json)

# Bounded polling. On timeout, retain the ID and resume polling later.
for attempt in $(seq 1 120); do
  sleep 15
  curl --fail --silent --show-error \
    -H "Authorization: Bearer $API_KEY" \
    "$BASE/v1/reports/$JOB_ID" > status.json
  status=$(jq -r '.status' status.json)
  case "$status" in
    complete) break ;;
    needs_review)
      jq '{job_id, status, notice_url, partner_reason, message}' status.json
      echo "Keep this job ID; do not resubmit. Check it again later."
      exit 0 ;;
    failed) jq '{job_id, status, error}' status.json; exit 1 ;;
  esac
done
[ "$(jq -r '.status' status.json)" = complete ] || {
  echo "Still processing; retain $JOB_ID and resume polling later."
  exit 1
}

download() {
  url=$(jq -er --arg field "$1" '.[$field] // empty' status.json)
  # Resolve only the supplied API origin and this job's download paths.
  case "$url" in
    "$BASE"/v1/reports/"$JOB_ID"/*) ;;
    /v1/reports/"$JOB_ID"/*) url="$BASE$url" ;;
    *) echo "Unexpected download URL; no credentials sent."; exit 1 ;;
  esac
  curl --fail --silent --show-error \
    -H "Authorization: Bearer $API_KEY" "$url" -o "$2"
}

if jq -e '.teaser_pdf_url and .internal_pdf_url' status.json >/dev/null; then
  download teaser_pdf_url merchant-teaser.pdf
  download internal_pdf_url internal-analysis.pdf
else
  # Existing single-document accounts/jobs remain supported.
  download pdf_url primary-report.pdf
fi

A successful paired status response contains these links (excerpt only; timestamps, summary and other metadata omitted):

{
  "job_id": "example-paired-report",
  "report_type": "teaser",
  "status": "complete",
  "pdf_url": "/v1/reports/example-paired-report/pdf",
  "teaser_pdf_url": "/v1/reports/example-paired-report/teaser",
  "internal_pdf_url": "/v1/reports/example-paired-report/internal"
}

Optional webhooks

report.complete and report.failed retain the existing envelope, signing headers, retries and event IDs. Complete events include available companion URL fields. Verify the signature over the raw request bytes, deduplicate by event ID, and acknowledge promptly. Then fetch the current job status and download with your API key. See the webhook contract.

No needs_review webhook is sent. Keep polling to see holds. A later release can produce a completion event; do not assume the absence of an event means failure.