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

# Simulate ACH Receiving

> Simulate a direct deposit of funds to a user account by including the deposit account number of the account to be debited or credited.

POST/simulate/directdeposits

Simulate a direct deposit of funds to a user account by including the deposit account number of the account to be debited or credited. You can find the account number in the `account_number` field of the response when you create a new deposit account. Alternatively, you can retrieve it by sending a `GET` request to the `/depositaccounts/user/{user_token}` endpoint. For more information, see [ACH Receiving](https://www.marqeta.com/docs/core-api/ach-receiving/).

If `type` is `CREDIT`, the response contains a simulated transaction message (i.e., a direct deposit record) and the corresponding transaction that is created is of the type `directdeposit.credit.pending`. If `type` is `DEBIT`, the response contains a simulated transaction message (i.e., a direct deposit record) and the corresponding transaction that is created is of the type `directdeposit.debit.pending`.

This endpoint returns a `directdeposit` object with a direct deposit token, and its state will be `PENDING`. Calling this endpoint does not return the `transactions` object; you cannot take the `token` from the response and look up the direct deposit record using the `/transactions` endpoint. You can, however, look it up by sending a `GET` request to the `/directdeposits/token` endpoint.

> [!NOTE]
>
> **Note**\
> You can use this endpoint to simulate `directdeposit.credit.pending` and `directdeposit.debit.pending` events only. Simulating other types of events is not currently supported.

## Body field details

| Fields | Description |
| - | - |
| amount string  Required | The amount of the direct deposit. **Allowable Values:**  Format: 0.00 |
| type string  Required | Indicates whether the direct deposit is a debit or credit. **Allowable Values:**  `CREDIT`, `DEBIT` |
| account\_number string  Required | The account number of the user to debit or credit. Send a `GET` request to the `/depositaccounts/user/{user_token}` endpoint to retrieve the account number of a user. **Allowable Values:**  An account number belonging to an active user with an active card. |
| settlement\_date string  Required | The date on which the credit or debit will be applied. **Allowable Values:**  Format: yyyy-MM-dd |

## Sample requests

Send the following request to simulate a `directdeposit.credit.pending` type transaction.

```json JSON lines wrap theme={null}
{
  "amount": 10,
  "type": "CREDIT",
  "account_number": "1323975092920",
  "settlement_date": "2024-03-23T19:56:53.440Z"
}
```

Send the following request to simulate a `directdeposit.debit.pending` type transaction.

```json JSON lines wrap theme={null}
{
  "amount": 10,
  "type": "DEBIT",
  "account_number": "1323975092920",
  "settlement_date": "2024-03-23T19:56:53.440Z"
}
```

## Sample responses

The following response shows a `directdeposit.credit.pending` type transaction.

Note that the `state` of the direct deposit is `PENDING`. You now need to use the [Direct Deposit Transitions](https://www.marqeta.com/docs/core-api/ach-receiving/direct-deposit-transitions/create-direct-deposit-transition-ach-receiving.md) endpoint `/directdeposits/transitions` to transition the pending direct deposit to either `APPLIED` (to settle the direct deposit) or `REVERSED` (to fail the direct deposit).

```json JSON lines wrap theme={null}
{
  "token": "a1aee855-0fe7-4a97-9c08-5c14d09f2478",
  "amount": 10,
  "type": "CREDIT",
  "state": "PENDING",
  "settlement_date": "2024-03-23T19:56:53Z",
  "state_reason": "Newly created",
  "direct_deposit_account_token": "4e7953ba-0be5-4a85-996f-e24d7763552f",
  "user_token": "506d8154-c01a-4480-81c9-04a0f4b451c1",
  "created_time": "2024-03-23T20:35:28Z",
  "last_modified_time": "2024-03-23T20:35:28Z"
}
```

The following response shows a `directdeposit.debit.pending` type transaction.

Note that the `state` of the direct deposit is `PENDING`. You now need to use the [Direct Deposit Transitions](https://www.marqeta.com/docs/core-api/ach-receiving/direct-deposit-transitions/create-direct-deposit-transition-ach-receiving.md) endpoint `/directdeposits/transitions` to transition the pending direct deposit to either `APPLIED` (to settle the direct deposit) or `REVERSED` (to fail the direct deposit).

```json JSON lines wrap theme={null}
{
  "token": "246e3441-adbd-4481-899c-e0a2a141c107",
  "amount": 5.0,
  "type": "DEBIT",
  "state": "PENDING",
  "settlement_date": "2024-03-12T19:56:53Z",
  "state_reason": "Newly created",
  "direct_deposit_account_token": "1741ad42-aac9-485a-8799-3c2edc2385f8",
  "user_token": "6252d4d8-d3e4-499b-a8dc-0c9bc2c351ca",
  "created_time": "2024-03-12T19:47:15Z",
  "last_modified_time": "2024-03-12T19:47:15Z"
}
```


## Related topics

- [Simulating Transactions Overview](https://www.marqeta.com/docs/core-api/simulating-transactions.md)
- [ACH Receiving Overview](https://www.marqeta.com/docs/core-api/ach-receiving.md)
- [Platform Overview](https://www.marqeta.com/docs/developer-guides/platform-overview.md)
- [ACH Origination](https://www.marqeta.com/docs/developer-guides/ach-origination.md)
- [Simulate OCT](https://www.marqeta.com/docs/core-api/simulating-transactions/simulate-oct.md)
