PaymentIntent, RawRecord, and FlowLeg records produced by the API and webhook paths, so they flow through the same matching engine.
File imports are one of the three ways evidence enters ReconLayer. For provider-pushed evidence, see Inbound Webhooks and Bridge Integration.
Import lifecycle
Upload & batch creation
POST /v1/import-batches is called with an importProfileId, originalFileName, and the file content. ReconLayer computes fileHash = sha256:<hex> over the content. If a batch with the same fileHash already exists for the organization, the existing ImportBatch is returned with duplicate: true and no rows are reprocessed (response is 200 instead of 201).Storage
The raw file is uploaded to object storage at
imports/${organizationId}/${YYYY}/${MM}/${DD}/${fileHash}/${originalFileName}. This fileStorageKey is recorded on the ImportBatch.Profile resolution
The referenced
ImportProfile supplies sourceType, fieldMappings (CSV column β canonical field path), optional valueMappings, and optional parsingRules (e.g. delimiter, dateFormat).Parsing & normalization
The file is parsed as CSV (row 1 = header, data rows numbered from 2). Each data row is mapped through
fieldMappings/valueMappings into canonical field values, validated, and recorded.Downstream branching
- If
importProfile.sourceType === 'client_internal_ledger', each valid row is mapped to aPaymentIntentinput and upserted (creating aReconciliationCaseif new, or detecting a conflict if an existing intent with the sameexternalReferencediffers). - For
bank_statement,psp_report, andonchain_report, each valid row is mapped to aRawRecord+FlowLegand passed through the sameingestEvidencepipeline used by webhooks and polling β including matching against open cases.
Import Profiles
AnImportProfile is a reusable, named mapping configuration scoped to your organization. It tells ReconLayer:
| Field | Purpose |
|---|---|
sourceType | One of client_internal_ledger, bank_statement, psp_report, onchain_report (api_expectation and client_transfer_report are valid canonical field source types but cannot be used for import profiles). |
fieldMappings | A Record<string, string> mapping your CSV column headers to canonical field paths, e.g. {"Settlement Amount": "FlowLeg.amount"}. |
valueMappings | Optional per-field value-substitution maps β e.g. mapping a providerβs status strings ("Settled") onto ReconLayer enums ("confirmed"). |
parsingRules | Optional parsing configuration. Currently supports delimiter (single character, defaults to ,) and dateFormat for date/time fields. |
provider / integrationKey | Optional β tag imported records with a provider name or integration key for downstream filtering. |
isActive | Whether the profile can currently be used to create batches. |
fieldMappings target is validated against the canonical field registry for the profileβs sourceType β mapping a column to an unsupported target for that source type returns 400 invalid_request.
Create an import profile
ImportProfileDetail, which includes supportedTargets β the full list of canonical fields available for this sourceType, useful for building a mapping UI.
See Create an Import Profile, List Import Profiles, Get Import Profile Detail, and Update an Import Profile.
PATCH /v1/import-profiles/{importProfileId} re-validates any updated fieldMappings against the profileβs existing sourceType β you cannot change sourceType and fieldMappings to an incompatible combination in the same request.Canonical field registry
GET /v1/canonical-fields returns the full registry of fields ReconLayer understands, each with the models and source types it applies to. Use it to populate a column-mapping UI or to validate a profile before creating it.
Filter to fields available for one
CanonicalFieldSourceType (client_transfer_report, client_internal_ledger, bank_statement, onchain_report, psp_report, manual, api_expectation).Filter to fields on one
CanonicalFieldModel (PaymentIntent, RawRecord, FlowLeg, FlowLegReference, ReconciliationCase).When
true, restrict to fields usable as fieldMappings targets in an ImportProfile.client_internal_ledger rows map onto PaymentIntent.* fields (externalReference, sourceAmount, sourceCurrency, destinationAmount, destinationCurrency, paymentType, paymentSubtype, direction, effectiveDate, beneficiaryAccount, beneficiaryName, stablecoin, chain, references, metadata). Evidence source types (bank_statement, psp_report, onchain_report, plus client_transfer_report and manual) map onto RawRecord.* and FlowLeg.* fields β FlowLeg.type, .phase, .status, .amount, .providerTransferId, .txHash, .chainId, .fromAddress, .toAddress, .tokenAddress, and FlowLegReference.* for arbitrary key/value references.
See List Canonical Fields.
Creating an import batch
POST /v1/import-batches accepts the file content inline (the schema requires fileContent; fileContentBase64 is accepted as an alternative encoding for binary-safe transport).
The profile that defines field mappings and parsing rules for this file.
Used for storage path and display.
Raw file content as a string.
Alternative base64-encoded content.
Override the computed
sha256:<hex> dedup hash.Attribution for the dashboard activity log.
Currently only
csv is supported.201 for a new batch, 200 if the same fileHash was already imported):
Inspecting a batch and its rows
GET /v1/import-batches supports limit, offset, sourceType, and status (uploaded, mapping_required, parsing, validating, processing, completed, failed) for filtering.
Each item in GET /v1/import-batches/{batchId}/raw-records is an ImportBatchRawRecordSnapshot:
normalizedType is payment_intent for client_internal_ledger rows and flow_leg for evidence rows. sourceRef for file-derived records follows the pattern file:{batchId}:{rowSourceRef-or-row-{rowNumber}}, which feeds the same (organizationId, source, sourceRef) dedup constraint used by webhooks and polling.
See Get Import Batch Detail, List Import Batches, and List Import Batch Raw Records.
Default leg type and phase by source type
When abank_statement, psp_report, or onchain_report row doesnβt explicitly map FlowLeg.type / FlowLeg.phase, ReconLayer applies these defaults:
sourceType | Default FlowLeg.type | Default FlowLeg.phase |
|---|---|---|
bank_statement | bank_transfer | destination |
onchain_report | onchain_transfer | transfer |
psp_report (and others) | provider_transfer | intermediary_in |
Handling validation failures
A row fails validation if a required canonical field is missing, a value mapping has no match, or a date/amount fails to parse againstparsingRules. Validation failures do not fail the whole batch:
- Valid rows are processed normally and feed into the matching engine (or create
PaymentIntents). - Failed rows are still recorded as
ImportBatchRawRecordSnapshots withvalidationStatus: 'failed'and avalidationErrorsobject describing what went wrong. - The batchβs
totalRows,validRows,warningRows, andfailedRowscounters reflect the outcome so you can decide whether to re-upload a corrected file.
Date and delimiter parsing
parsingRules.delimitermust be a single character; if omitted or invalid, ReconLayer defaults to,.parsingRules.dateFormatcontrols how date/time strings are normalized. ReconLayer accepts standard ISO 8601 timestamps regardless ofdateFormat, and additionally supportsDD/MM/YYYY HH:mm:sswhen configured.- The CSV parser handles quoted values (including embedded delimiters and quotes) per standard CSV quoting rules. Row 1 is always treated as the header row; data rows are numbered starting from 2 for
rowNumberin raw record snapshots.
Next steps
- Ingestion Flows β how imported rows feed the matching engine alongside webhooks and API evidence.
- Inbound Webhooks and Bridge Integration β for evidence that arrives in real time instead of in batch files.
- Outbound Webhooks β subscribe to
payment_intent.createdto be notified whenclient_internal_ledgerimports register new expectations.
