Skip to content
SETSimple Easy Transactions
SET DocsSET Crypto API Suite and SET API referenceCurrent as of 2026-11-21 · wallet release 7d8a79fb
Browse: SET API

SET API · SET Close

Upload a bank or provider CSV to a source

POST/v1/close/sources/{source}/imports

Key scope: write · Success: 201

Uploads a bank or provider CSV file to a source. Each accepted row becomes a record and is matched to a payment, or becomes its own exception. A row that fails a check is listed in rejections and the other rows are still taken.

Path parameters

source stringrequired
A source id (src_…) of kind bank_csv or provider_csv, from POST /v1/close/sources. SET's built-in ledger source answers 409 source_not_uploadable.

Query parameters

idStrategy "column" | "row_hash"
column (the default): each row's id is the file's id column. row_hash: for a bank file with no row id; SET derives an id from each row, and identical rows become duplicate exceptions.
filename string
The file's name, kept on the import: 1 to 120 letters, digits, spaces and . _ ( ) -. Anything else is 400 filename_invalid.

Headers

Idempotency-Key string
Any unique string. What a repeat of this call answers is in the notes. See Idempotency.

Notes

  • SET Close is switched on per deployment; when it is off, every /v1/close call answers 403 close_off after the key is checked. GET /v1/capabilities shows it as features.close.
  • Needs a key with the write scope. Platform and business keys can both call it.
  • The body is the CSV text itself, sent as text/csv: not JSON and not multipart.
  • Header row: id,date,amount,currency,direction,reference,counterparty,tx_hash,chain; the first five are required (id may be left out with idStrategy=row_hash).
  • date is ISO 8601, a date or a date-time. amount is a positive decimal with a dot. direction is in or out, as the bank account sees it.
  • currency is one of usd, eur, gbp, mxn, brl, cop, usdc, usdb, pyusd, eurc; any other value rejects that row as currency_invalid.
  • chain is 2 to 30 lower-case letters, digits, _ or -. tx_hash is 16 to 128 letters and digits, with or without 0x.
  • A row with a tx_hash that matches no payment is a chain_unconfirmed exception until SET's own chain read confirms it.
  • A row with a decimal comma (1,250.00) is rejected as amount_decimal_comma, numbered with the header as row 1. A file delimited with semicolons is refused whole with 400 csv_invalid.
  • At most 1,000 rows and 1 MB: a larger file answers 413 import_too_large.
  • Each business has a daily write budget; past it the answer is 429 close_budget_reached and nothing is written.
  • fileHash is the SHA-256 of the file; the file itself is not kept. createdBy is the key's id.
  • Uploading the same file again adds no records (createdRecords 0, unchanged counts the rows) but answers 201 with a new import id, with or without an Idempotency-Key.
  • A row dated in a locked month becomes a prior_period exception in the first open month.
  • rejections, unchanged, matched and exceptions are returned only here; GET /v1/close/imports does not repeat them.
  • The example was made with a sandbox key (sandbox: true).
  • This example is a recorded run of SET's own code (wallet release e9b03447) with a sandbox key; ids and times are that run's.

Errors

  • 403 close_off
  • 400 id_strategy_invalid
  • 400 filename_invalid
  • 404 not_found
  • 409 source_not_uploadable
  • 503 close_imports_unavailable
  • 413 import_too_large
  • 429 close_budget_reached
  • 400 csv_invalid

All codes: Errors.