Create a file

Creating an Automated Clearing House (ACH) file can be done several ways:

Go client

We have an example of using our Go client and uploading the JSON representation. The basic idea follows this structure:

  1. Create a BatchHeader record with ach.NewBatchHeader().
  2. Create an EntryDetail record with ach.NewEntryDetail().
  3. Create a Batch from our BatchHeader and EntryDetail.
    1. Using a constructor like batch := ach.NewBatchPPD(batchHeader) and adding the batch with batch.AddEntry(entry).
    2. Call and verify batch.Create() returns no error.
  4. Create our ACH File record file := ach.NewFile() and FileHeader with ach.NewFileHeader()
  5. Add the FileHeader (via file.SetHeader(fileHeader)) and Batch records to the file (via file.AddBatch(batch)).
    1. Call and verify file.Create() returns no error.
  6. Encode the File to JSON (via json.NewEncoder(&buf).Encode(&file)) for a net/http request.

Upload a JSON representation

In Ruby we have an example of creating an ACH file from JSON. The JSON structure corresponds to our API endpoint for creating files that the ACH HTTP server expects.

We have example ACH files in JSON.

Note: The header Content-Type: application/json must be set to parse the file as JSON, otherwise Nacha’s format will be assumed.

Validate options

When creating a file the server supports query parameters for setting ValidateOpts values.

Example: POST /files/create?requireABAOrigin=true&bypassDestination=true

Query Param Validation Option
allowInvalidAmounts AllowInvalidAmounts
allowInvalidCheckDigit AllowInvalidCheckDigit
allowMissingFileControl AllowMissingFileControl
allowMissingFileHeader AllowMissingFileHeader
allowUnorderedBatchNumbers AllowUnorderedBatchNumbers
allowZeroBatches AllowZeroBatches
bypassCompanyIdentificationMatch BypassCompanyIdentificationMatch
bypassDestinationValidation BypassDestinationValidation
bypassOriginValidation BypassOriginValidation
customReturnCodes CustomReturnCodes
customTraceNumbers CustomTraceNumbers
preserveSpaces PreserveSpaces
requireABAOrigin RequireABAOrigin
skipAll SkipAll
unequalAddendaCounts UnequalAddendaCounts
unequalServiceClassCode UnequalServiceClassCode

Note: bypassDestination, bypassOrigin, and unorderedBatchNumbers are deprecated query parameters replace by identical named parameters.

Upload a raw ACH file

Our ACH HTTP server also handles uploading raw ACH files which is the NACHA text format. We have example files in their NACHA format and example code for creating and reading the files.

SEC Code Description Example ACH File Read Write
ACK Acknowledgment Entry for CCD Credit ACK Read ACK Write
ADV Automated Accounting Advice Prenote Debit ADV Read ADV Write
ARC Accounts Receivable Entry Debit ARC Read ARC Write
ATX Acknowledgment Entry for CTX Credit ATX Read ATX Write
BOC Back Office Conversion Debit BOC Read BOC Write
CCD Corporate credit or debit Debit CCD Read CCD Write
CIE Customer-Initiated Entry Credit CIE Read CIE Write
COR Automated Notification of Change(NOC) NOC COR Read COR Write
CTX Corporate Trade Exchange Debit CTX Read CTX Write
DNE Death Notification Entry DNE DNE Read DNE Write
ENR Automatic Enrollment Entry ENR ENR Read ENR Write
IAT International ACH Transactions Credit IAT Read IAT Write
MTE Machine Transfer Entry Credit MTE Read MTE Write
POP Point of Purchase Debit POP Read POP Write
POS Point of Sale Debit POS Read POS Write
PPD Prearranged payment and deposits Debit Credit PPD Read PPD Write
RCK Represented Check Entries Debit RCK Read RCK Write
SHR Shared Network Entry Debit SHR Read SHR Write
TEL Telephone-Initiated Entry Debit TEL Read TEL Write
TRC Truncated Check Entry Debit TRC Read TRC Write
TRX Check Truncation Entries Exchange Debit TRX Read TRX Write
WEB Internet-initiated Entries Credit WEB Read WEB Write
XCK Destroyed Check Entry Debit XCK Read XCK Write

Note: The header Content-Type: text/plain should be set.