Investigate APIs, Databases, Events and Files

Moving from diagrams to real evidence: what to check in an API contract, a database table, an event and a settlement file, a real investigation query, and tracing one transaction across systems.

  • Intermediate to advanced
  • About 25 minutes
  • Includes an exercise and a knowledge check

APIs Investigate the API contract

For every API, examine the endpoint and method, request and response schemas, required fields, authentication, validation rules, error responses, rate limits, timeouts, retry behavior, versioning, idempotency support and correlation identifiers. Here is a simplified payment request from provider A:

jsonPayment request from provider A (fictional)

{
  "providerTransactionId": "TX1001",
  "loanReference": "LN500",
  "amount": 500.00,
  "currency": "USD",
  "status": "CAPTURED",
  "eventTimestamp": "2026-11-18T09:30:00Z"
}
  • Is providerTransactionId unique within the provider, or globally?
  • Is loanReference mandatory?
  • Can the amount be a partial payment?
  • Which statuses are accepted?
  • Can the same event be sent more than once?
  • Is the timestamp when the event happened, or when it was sent?
  • How does the API recognize a repeated request, for example one sent again after a timeout?

Databases Investigate the data model

ColumnPurpose
payment_idInternal payment identifier
provider_idWhich payment provider
provider_transaction_idThe provider's transaction reference
loan_idInternal loan reference
amount, currencyPayment amount and currency code
payment_statusCurrent business status
created_at, updated_atWhen the record was created and last changed

Check primary keys and unique constraints, foreign keys, indexes, transaction boundaries, null values, data types, status transitions, history, soft deletes and retention, query performance and concurrent updates. Then ask the data a question. This query looks for provider transactions that appear more than once:

sqlFind repeated provider transaction IDs

SELECT
    provider_id,
    provider_transaction_id,
    COUNT(*) AS record_count
FROM payments
GROUP BY
    provider_id,
    provider_transaction_id
HAVING COUNT(*) > 1;

Result on the sample table

provider_id  provider_transaction_id  record_count
-----------  -----------------------  ------------
PROVIDER_A   TX1001                              2
PROVIDER_B   TX2001                              2

Real output from SQLite on a fictional six-row sample (tools/fde/apex_payments.sql), November 18, 2026.

Two repeated IDs, but are they defects? Look at the statuses. TX1001 has one AUTHORIZED row and one POSTED row: that is one payment moving through its lifecycle, which the business may allow. Ask a sharper question: which transactions were posted more than once?

sqlFind transactions posted more than once

SELECT
    provider_id,
    provider_transaction_id,
    COUNT(*) AS posted_count
FROM payments
WHERE payment_status = 'POSTED'
GROUP BY
    provider_id,
    provider_transaction_id
HAVING COUNT(*) > 1;

Result on the same sample

provider_id  provider_transaction_id  posted_count
-----------  -----------------------  ------------
PROVIDER_B   TX2001                              2

Same fictional sample and SQLite run.

Events Investigate the event contract

jsonPaymentCaptured event (fictional)

{
  "eventId": "EVT9001",
  "eventType": "PaymentCaptured",
  "eventVersion": 1,
  "providerId": "PROVIDER_A",
  "transactionId": "TX1001",
  "occurredAt": "2026-11-18T09:30:00Z",
  "publishedAt": "2026-11-18T09:30:02Z"
}
  • Is eventId unique, and can the same event be delivered several times?
  • Can events arrive out of order?
  • What happens when the consumer is unavailable?
  • How long are events kept, and can they be replayed?
  • How are schema changes managed?
TimestampWhat it tells you
OccurredWhen the business event happened
PublishedWhen the producer sent it
ReceivedWhen the consumer got it
ProcessedWhen the consumer finished its work
CommittedWhen the database made it permanent

The gaps between these five timestamps show exactly where delays happen.

Files Investigate the settlement file

csvBank settlement file sample (fictional)

settlement_reference,provider_transaction_id,amount,currency,settlement_status,settlement_date
ST1001,TX1001,500.00,USD,SETTLED,2026-11-18
ST1002,TX1002,700.00,USD,SETTLED,2026-11-18

Check encoding, delimiters, headers, required columns, record counts, empty fields, duplicates, date and time formats, currency precision, completeness, control totals (a record count or total amount the sender provides to prove the file is complete) and arrival and processing times.

The technique Follow one transaction across every system

One payment of $500 for loan LN500 tracked like a parcel across five systems. Payment provider A: TX1001, captured at 09:30:00. Integration service: TX1001, accepted at 09:30:03. Loan servicing: PM9001, posted at 09:30:04. Bank settlement: ST1001, settled November 18. Reconciliation: TX1001, unmatched, in red. The ID changes from TX1001 to PM9001 to ST1001 while the amount stays the same. Possible reasons: matching expects the wrong ID, a provider-to-internal mapping is missing, records arrived in an unexpected order, a status rule excludes the record, or a date or currency transform is wrong.
The transaction exists everywhere, yet reconciliation calls it unmatched. Now the investigation is focused.

Practice Question the contract

Practical exercise

Five questions for provider B

Provider B sends payments as files three times a day, with IDs like B/2026/1117/044. Write five questions for provider B's integration contact.

  1. Cover identity, duplicates, timing, completeness and changes.
  2. For each, say what could go wrong if you never asked.
Show sample questions
  • Is the ID unique forever, or reset each day? If reset, two payments could share an ID.
  • Can the same file be sent twice, and does it carry a file sequence number? If not, a resend could post payments twice.
  • What time zone are the timestamps in? A wrong assumption shifts payments into the wrong business day.
  • Does the file include a record count or control total? Without one, a truncated file looks complete.
  • How will you tell us before changing the format? A silent change broke the import at the Module 01 lender.

3 questions

Check your understanding

1. The query finds TX1001 twice in the payments table. What have you proved?
2. occurredAt is 09:30:00 and publishedAt is 09:30:02. What do the two times tell you?
3. What is a control total in a file?
Answer every question to submit.

What you can do now

  • Question an API contract beyond its example payload.
  • Investigate a data model and query it, without over-reading the result.
  • Use event timestamps to locate delays.
  • Validate a file properly and trace one transaction across systems.