Skip to content

Create an ACH Transaction using JSON

Our ACH Transaction API provides endpoints for uploading ACH formatted files, but it also allows for sending JSON formatted versions of the same data.

All fields of the JSON format can be found in the ACH API Reference

ACH allows for several kinds of transactions using various codes. This guide shows how to credit, or push, funds from an account at GIB to a destination account at an external bank.

Step 1 - Gather required data

You will need to identify the destination (or beneficiary) of the funds. You will need the following variables:

  • DESTINATION_ROUTING_NUMBER - Routing Number of the RDFI where the destination account resides. This example assumes this will be 9 digits, which means the check digit is included.
  • DESTINATION_ACCOUNT_NUMBER - The account number where the funds will be sent to.
  • DESTINATION_NAME - The name of the account holder.

You will need information about the origin (or sender) of the funds. This will be one of your accounts or a Subclient's account. You will need the following variables:

  • ORIGIN_ROUTING_NUMBER - Routing Number of the ODFI - this will be one of GIB's routing numbers - 091208154 or 091218490 if virtual
  • ORIGIN_ACCOUNT_NUMBER - Account number where the funds will be taken from.

You will also need to provide information about your company which will be part of the batchHeader. You will need the following variables:

  • COMPANY_ID - Tax ID of your Company (the Originator), preceded by 1.
  • COMPANY_NAME - Name of your Company (the Originator).

Step 2 - Create ACH Transaction using JSON

ach_data = {
  "fileHeader": {
    "fileCreationDate": datetime.today().strftime("%y%m%d"),
    "immediateOrigin": "091208154",  # GIB Routing Number
    "immediateOriginName": "Global Innovations Bank",
    "immediateDestination": "061000146",  # Federal Reserve Bank
    "immediateDestinationName": "Federal Reserve Bank",
  },
  "batches": [
 {
    "batchHeader": {
      "serviceClassCode": 200,
      "companyName": f"{COMPANY_NAME}",
      "companyIdentification": f"{COMPANY_ID}",
      "standardEntryClassCode": "CCD",
      "companyEntryDescription": f"{COMPANY_NAME}",
      "effectiveEntryDate": date.today().strftime("%y%m%d"),
      "ODFIIdentification": f"{ORIGIN_ROUTING_NUMBER}",
    },
    "entryDetails": [
      {
        "amount": 10000,  # USD Amount transferred, in cents
        "DFIAccountNumber": f"{DESTINATION_ACCOUNT_NUMBER}",
        "RDFIIdentification": f"{DESTINATION_ROUTING_NUMBER[:8]}",
        "checkDigit": f"{DESTINATION_ROUTING_NUMBER[-1]}",
        "transactionCode": 22,  # Credit to destination
        "individualName": f"{DESTINATION_NAME}",
      }
    ],
    "offset": {
      "routingNumber": f"{ORIGIN_ROUTING_NUMBER}",
      "accountNumber": f"{ORIGIN_ACCOUNT_NUMBER}",
      "accountType": "checking",
      "description": "For offset",
    },
   }
 ]
}

url = f"{ACH_API_URL}/file/create"

payload = {
  "data": ach_data,
  "test": False,
}

headers = {
    "Content-type": "application/json",
    "Authorization": f"{API_KEY}"
}

response = requests.request("POST", url, json=payload, headers=headers)

response.raise_for_status()