# Create a cash flow

Records a movement of money expected on a deal — an instalment coming in, a disbursement going out, a fee or a refund. Body: `dueDate` (required; a cash flow needs its due date) and `expectedAmountMinor` (more than zero), plus `flowType` (`payment`, `disbursement`, `commission`, `fee`, `refund`, `adjustment`), `direction` (`inbound` or `outbound`), `method` (`unspecified`, `ach`, `wire`, `check`, `card`, `revenue_split`), `currency`, `scheduleId`, `facilityId`, `dealRowId` (the deal record on our own board), `counterpartyId`, `sequenceNumber`, `totalPayments` and `notes`. It lands at `expected`: money that then arrives is `post_cash-flows_id_record-payment`.

Access class: `workspace`.

## Endpoint

`POST /v1/cash-flows`

## Request body

Content type: `application/json`.

```json
{
  "body": {
    "counterpartyId": 1,
    "currency": "string",
    "dealRowId": "",
    "direction": "string",
    "dueDate": "string",
    "expectedAmountMinor": 1,
    "facilityId": 1,
    "flowType": "string",
    "method": "string",
    "notes": "string",
    "scheduleId": 1,
    "sequenceNumber": 1,
    "totalPayments": 1
  },
  "params": {},
  "query": {}
}
```

## Responses

### 201

the action's answer

Content type: `application/json`.

```json
{
  "data": {
    "actualAmountMinor": 1,
    "batchId": "",
    "counterpartyId": 1,
    "createdAt": "string",
    "currency": "string",
    "dealRowId": "",
    "detail": {},
    "direction": "string",
    "dueDate": "string",
    "expectedAmountMinor": 1,
    "externalTransactionId": "",
    "facilityId": 1,
    "failureCode": "string",
    "failureReason": "string",
    "flowType": "string",
    "id": 1,
    "maxRetries": 1,
    "method": "string",
    "notes": "string",
    "processedDate": "string",
    "retryCount": 1,
    "scheduleId": 1,
    "sequenceNumber": 1,
    "settledDate": "string",
    "status": "string",
    "totalPayments": 1,
    "updatedAt": "string"
  }
}
```

### default

a refusal: `{"error": "<what a person needs to read>"}`. 401 no credential, 402 the plan does not include this, 403 the seat does not, 404 the thing does not exist or is not yours to see.

Content type: `application/json`.

```json
{
  "error": "string"
}
```
