SET API · SET Close
Upload a bank or provider CSV to a source
POST/v1/close/sources/{source}/imports
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
sourcestringrequired- A source id (
src_…) of kindbank_csvorprovider_csv, fromPOST /v1/close/sources. SET's built-in ledger source answers 409source_not_uploadable.
Query parameters
idStrategy"column" | "row_hash"column(the default): each row's id is the file'sidcolumn.row_hash: for a bank file with no row id; SET derives an id from each row, and identical rows becomeduplicateexceptions.filenamestring- The file's name, kept on the import: 1 to 120 letters, digits, spaces and
. _ ( ) -. Anything else is 400filename_invalid.
Headers
Idempotency-Keystring- 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/closecall answers 403close_offafter the key is checked.GET /v1/capabilitiesshows it asfeatures.close. - Needs a key with the
writescope. 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 (idmay be left out withidStrategy=row_hash). dateis ISO 8601, a date or a date-time.amountis a positive decimal with a dot.directionisinorout, as the bank account sees it.currencyis one ofusd,eur,gbp,mxn,brl,cop,usdc,usdb,pyusd,eurc; any other value rejects that row ascurrency_invalid.chainis 2 to 30 lower-case letters, digits,_or-.tx_hashis 16 to 128 letters and digits, with or without0x.- A row with a
tx_hashthat matches no payment is achain_unconfirmedexception until SET's own chain read confirms it. - A row with a decimal comma (
1,250.00) is rejected asamount_decimal_comma, numbered with the header as row 1. A file delimited with semicolons is refused whole with 400csv_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_reachedand nothing is written. fileHashis the SHA-256 of the file; the file itself is not kept.createdByis the key's id.- Uploading the same file again adds no records (
createdRecords0,unchangedcounts the rows) but answers 201 with a new import id, with or without anIdempotency-Key. - A row dated in a locked month becomes a
prior_periodexception in the first open month. rejections,unchanged,matchedandexceptionsare returned only here;GET /v1/close/importsdoes 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_off400 id_strategy_invalid400 filename_invalid404 not_found409 source_not_uploadable503 close_imports_unavailable413 import_too_large429 close_budget_reached400 csv_invalid