> ## Documentation Index
> Fetch the complete documentation index at: https://docs.monk.com/llms.txt
> Use this file to discover all available pages before exploring further.

# File integration (SFTP)

> Monk integration with any ERP through scheduled file exchange over SFTP

# File integration (SFTP)

Monk connects to ERPs that have no direct Monk integration by exchanging files
over SFTP. Your ERP exports receivables data on a schedule, Monk runs
Collections and Cash App (Monk's cash application) can use the imported data,
and Monk can send back a cash application file of matched payments for your ERP
to import.

You continue to issue invoices and record payments in your ERP. Nothing is
installed in your environment, and Monk never connects to your ERP directly.

This page covers how the integration works, setup, and security. The
column-by-column file specification is in
[SFTP Import format](https://docs.monk.com/integrations/sftp-import-format.md), for the files you send,
and [SFTP Export format](https://docs.monk.com/integrations/sftp-export-format.md), for the cash
application file Monk sends back.

## What you send

| To use | You send | Monk sends back |
| - | - | - |
| Collections | Customers, contacts, and open invoices with their current balances | Nothing required |
| Cash App | Customers and open invoices, plus every payment and credit memo applied to each open invoice. Contacts only if Collections is on too | Optionally, a cash application file of matched payments for your ERP to import |

The standard import includes the payment and credit memo data used by Cash App.

## How it works

```mermaid theme={null}
flowchart LR
    E["Your ERP"] -->|"Scheduled export"| I["SFTP inbound folder"]
    I --> M["Monk: Collections and Cash App"]
    M --> O["SFTP outbound folder:<br/>cash application file"]
    O -->|"Your ERP's import"| E
```

1. **Connect.** Use Monk's SFTP server, or give Monk access to yours, with an
   SSH key or a username and password. See [Connecting](#connecting).
2. **Export.** A scheduled job on your side exports the files your products
   need, such as customers, contacts, and invoices, at least once a day, and
   uploads them with a manifest.
3. **Validate and import.** Monk checks every file against the format and the
   manifest. A batch with errors is rejected as a whole with a row-numbered
   error report. The only rows Monk skips on their own are applications to
   invoices it does not have, which are listed as warnings.
4. **Collect and match.** Monk runs Collections on your open invoices and
   matches incoming bank payments and remittances to them.
5. **Send back.** Monk writes matched payments to a cash application file. Your
   ERP's import loads it, by hand at first and on a schedule once your team has
   automated it.
6. **Confirm.** Your next export shows each payment your ERP loaded, and Monk
   marks it confirmed. Anything not confirmed within three exports is
   flagged for review.

Once Monk matches a payment, the invoice is paid in Monk and is not chased or
matched again, even while your ERP still shows it open. Payments your team
applies directly in your ERP, such as card payments, keep flowing to Monk
through your export and close invoices the same way.

## Requirements and scope

* **A scheduled export.** Your ERP exports the files your products need, such as
  customers, contacts, and invoices, at least daily, in Monk's format or in your
  ERP's own delimited format. Your IT team or ERP partner schedules the job;
  Monk provides the [specification](https://docs.monk.com/integrations/sftp-import-format.md), example
  files, and test validation.
* **Bank and remittance data, for Cash App.** Monk matches bank deposits to
  invoices, using remittance details to decide which invoices a payment covers.
  Deposits come from a bank connection set up with Monk, or from bank files you
  send over SFTP in the [SFTP Bank format](https://docs.monk.com/integrations/sftp-bank-format.md).
  Remittance details come from the remittance emails and attachments your
  customers send, which Monk reads, and from remittances your team uploads in
  Monk.
* **A payment import in your ERP, for syncing Cash App to your ERP.** Monk's
  [cash application file](https://docs.monk.com/integrations/sftp-export-format.md) is a CSV that lists
  each customer payment and the invoices to apply it to. Your ERP needs an
  import that can create a customer payment and apply it to invoices from a
  file, such as a customer payment batch import or a journal import. Bank
  lockbox imports usually expect your bank's file format rather than a CSV, so
  check with your Monk contact before planning to use one.
* **Somewhere to keep Monk's payment ID, for syncing Cash App to your ERP.**
  Every payment in the cash application file has a `monk_payment_id`, an ID Monk
  generates. When your import creates the payment, it stores that ID in a field
  on the payment record, such as the check number or an external reference
  field, and your export sends it back to Monk in `payments.csv`. This is how
  Monk recognizes payments it sent, as opposed to payments your team applied in
  your ERP.
* **Multiple entities.** One connection can cover several legal entities or
  business units. Each `entity_code` imports into your organization or one of
  its child organizations, one entity per child organization.
* **Multiple currencies.** Every amount carries its own currency, which must be a
  Monk-supported currency with two decimal places. Zero- and three-decimal
  currencies such as JPY, KWD, and BHD are not supported yet.

## Using your ERP's existing export

If your ERP can't produce files in Monk's format, talk to your Monk contact.
Monk's format remains the reference for what data is needed: any other export must carry the same information.

## Bank files

For Cash App, you can also send your bank transactions over SFTP instead of
connecting your bank to Monk, such as the prior-day file your bank produces
each morning. Bank files go to their own `bank` folder, separate from your
ERP's batches, and need no manifest: each file is imported on its own. Monk
matches the payments in them to your open invoices as it does for any other
bank connection.

The columns, file names, and validation are in
[SFTP Bank format](https://docs.monk.com/integrations/sftp-bank-format.md).

## Connecting

| | Monk-hosted SFTP | Your SFTP server |
| - | - | - |
| Who connects | Your job connects to the host shown in Monk | Monk connects to your server |
| Authentication | An SSH key you add in Monk, or a username and password | An SSH key pair Monk generates, or a username and password you give Monk |
| Your files go to | `/inbound`, where you can upload, rename, and delete | A folder you choose; Monk checks it for new files and never moves or deletes them |
| Monk's files go to | `/outbound`, where you can download and delete | A folder you choose |

On Monk-hosted SFTP, files leave `/inbound` once processed, and Monk's files
stay in `/outbound` until you delete them, or for 30 days.

Both options support SSH keys and username and password. See
[Access and authentication](#access-and-authentication) for how each is set up.

## Access and authentication

Both connection options support two ways to authenticate:

* **SSH key.** The recommended option. Use it if your export job or SFTP
  server supports key authentication.
* **Username and password.** The fallback for systems that cannot use SSH
  keys.

Each Monk-hosted user signs in with one of the two.

You manage the connection's credentials on the SFTP integration page in Monk.

| | Monk-hosted SFTP | Your SFTP server |
| - | - | - |
| SSH key | You add your job's public key in Monk. A user can have several keys, so you can rotate a key by adding the new one before removing the old one | Monk generates a key pair for your organization and shows you the public key to install on your server |
| Username and password | Monk generates a username and password for your job to connect with | You give Monk a username and password for your server |

* Each Monk-hosted user can reach only your organization's folders. Your job can
  write to `/inbound`, and read and delete files in `/outbound`; it cannot read
  other customers' folders or upload to `/outbound`.
* When Monk connects to your server, it verifies your server's host key, which
  you give Monk during setup, on every connection.
* Monk stores the credentials it uses for your server in an encrypted secrets
  store. You can revoke Monk's access at any time by removing its public key or
  changing the password.

## Sync and reliability

* **Schedule:** send a batch at least daily, landing before your first
  collection emails of the day go out. Several batches a day are supported.
* **Stale data:** Monk pauses collection emails for an entity whose last good
  batch is older than the configured limit, so customers who have already
  paid are never chased from stale data.
* **Time zones:** for entities in several time zones, schedule the export for
  the earliest of them.
* **Sync history:** every batch appears in Monk with the rows accepted and
  rejected and a downloadable error report. During setup, upload test batches to
  validate your export without importing anything.

## Security

For how Monk and your systems authenticate, see
[Access and authentication](#access-and-authentication).

### Network

* Monk-hosted SFTP accepts connections only over SSH, with current key exchange
  algorithms and ciphers; older algorithms are disabled.

### Encryption and isolation

* Files are encrypted in transit by SSH and at rest by the storage service.
* Each organization's files are stored under their own prefix, and Monk derives
  the organization from where a file arrived, never from its contents.
* A batch can only affect the entities mapped to your organization; a batch
  listing any other `entity_code` is rejected.

### Retention and deletion

* Monk deletes its copies of your files 30 days after processing, and cash
  application files 30 days after it writes them.
* The data Monk imports from your files is kept as part of your Monk account,
  under the same retention and deletion terms as data from any other
  integration.

### Monitoring and audit

* Every batch, its row counts, and its error report are recorded in Monk's sync
  history.
* Monk alerts the recipients you choose when a batch is rejected or
  incomplete, and when no batch has arrived within the expected window.
* Text Monk writes into cash application files that would start with `=`, `+`,
  `-`, or `@` is prefixed with an apostrophe, so spreadsheets never run it as a
  formula.

### On your side

* Monk never connects to your ERP and installs nothing in your environment. Your
  export job and your import are yours to run and secure.

## Frequently asked questions

**Which ERPs does this work with?**
Any system that can export delimited files on a schedule. To sync Cash App to
the ERP, the ERP also needs an import that can create payments from a file. Your
IT team or ERP partner builds the export and the import; Monk provides the
[specification](https://docs.monk.com/integrations/sftp-import-format.md), example files, and test
validation.

**Do we have to produce exactly Monk's format?**
No. Monk can map your ERP's existing delimited exports during setup. For XML or
fixed-width exports, talk to your Monk contact.

**Do we need to send payments for Collections?**
No. Customers, contacts, and invoices with their open balances are enough. Cash
App needs every payment and credit memo applied to each invoice, including those
made before Monk was connected.

**What if our ERP cannot store Monk's payment ID?**
Collections and Cash App matching work without it, but syncing Cash App to your
ERP does not. Without the ID, Monk cannot tell its own payments apart from
payments you apply in your ERP.

**We still apply some payments in our ERP. Is that a problem?**
No. Payments you apply in your ERP reach Monk through your export and close
invoices as usual.

**Can we load the cash application file by hand at first?**
Yes. You can load it through your ERP's import screen by hand and automate the
job later; the file is the same either way.

**What happens if we send the same batch twice?**
Monk ignores a batch whose `batch_id` it has already processed, and skips a
batch older than one it has already applied.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.