Docker

We publish a public Docker image moov/fincen from Docker Hub or use this repository.

Pull & start the Docker image:

docker pull moov/fincen:latest
docker run -p 8206:8206 -p 8207:8207 moov/fincen:latest

Check http server alive:

curl localhost:8206/ping
PONG

The /validator and /reformat endpoints accept multipart/form-data with a file field named input.

Validate a file on the HTTP server:

curl -F "input=@./data/samples/sar_batch.xml" http://localhost:8206/validator
{"status":"valid file"}

The same command works with the ctr_batch.xml, doep_batch.xml, fbar_batch.xml, and 8300_batch.xml samples.

Reformat the file with generated attributes. Attributes are regenerated only when you send generate_attrs=true. You can also send format=json for JSON output. /validator accepts disable_attrs=true to skip attribute checks.

Send xsd=true to /validator to also validate the file against the official FinCEN batch schema for its form type. The schema files are bundled with the server, so this check does not use the network. Schema validation is off by default. It applies to XML batch files only, not to JSON files or acknowledgement files.

curl -F "input=@./data/samples/ctr_batch.xml" -F "xsd=true" http://localhost:8206/validator
{"status":"valid file"}

When the file does not pass schema validation, the response has an xsd_errors list:

{"error":"official schema validation failed: line 2: /fc2:EFilingBatchXML: required attribute PartyCount is missing","xsd_errors":[{"line":2,"path":"/fc2:EFilingBatchXML","message":"required attribute PartyCount is missing"}]}

A valid file response, with or without xsd=true, does not mean that FinCEN will accept the file. The BSA E-Filing System also applies business rules that this server does not check.

curl -F "input=@./data/samples/ctr_batch.xml" -F "generate_attrs=true" http://localhost:8206/reformat
<fc2:EFilingBatchXML TotalAmount="47000" PartyCount="6" ActivityCount="1" xsi:schemaLocation="www.fincen.gov/base https://www.fincen.gov/system/files/schema/base/EFL_CTRXBatchSchema.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:fc2="www.fincen.gov/base">
  <fc2:FormTypeCode>CTRX</fc2:FormTypeCode>
  <fc2:Activity SeqNum="1">
    ...

The /validator and /reformat endpoints return these HTTP status codes:

Status Meaning
200 The file is valid (/validator), or the reformatted report is in the response body (/reformat).
400 The request is not multipart/form-data, the input field is missing, or the file is not an XML or JSON batch report. With xsd=true, the file is a JSON file or an acknowledgement file.
422 The file was read, but it does not pass validation. The error field shows the problem, for example {"error":"The TotalAmount has invalid value"}. With xsd=true, the xsd_errors field shows each schema error.

Version v0.4.0 and earlier returned 501 for files that could not be read and for files that did not pass validation.