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

# Deposits

> Partner deposit discovery, range validation, estimation, and create flow.

<Note>Sandbox supports partner deposits only for `rusd` on `base` (Base Sepolia).</Note>

## Overview

* `GET /partner/v1/deposits/assets`: discover supported `currency` + `network` ids (no min/max).
* `POST /partner/v1/deposits/range`: fetch min/max and payout route for one pair.
* `POST /partner/v1/deposits/estimate`: quote estimated receive amount for one pair + amount.
* `POST /partner/v1/deposits`: create the deposit address/intent.
* `GET /partner/v1/deposits` and `GET /partner/v1/deposits/{depositId}`: track lifecycle.

<Note>Min/max are intentionally omitted from assets. Always call `/deposits/range` (or `/deposits/estimate`) for limits.</Note>

## Flow

```mermaid theme={null}
sequenceDiagram
  participant Backend as "Your Backend"
  participant MachinesAPI as "Machines API"
  participant Wallet as "Wallet / Exchange"

  Backend->>MachinesAPI: GET /partner/v1/deposits/assets
  MachinesAPI-->>Backend: assets[]
  Backend->>MachinesAPI: POST /partner/v1/deposits/range
  MachinesAPI-->>Backend: range {minAmount, maxAmount, route}
  Backend->>MachinesAPI: POST /partner/v1/deposits/estimate
  MachinesAPI-->>Backend: estimate {estimatedToAmount, rateId}
  Backend->>MachinesAPI: POST /partner/v1/deposits
  MachinesAPI-->>Backend: deposit {depositAddress, payinExtraId}
  Wallet->>MachinesAPI: Send funds to depositAddress (+ memo/tag when payinExtraId exists)
  Backend->>MachinesAPI: GET /partner/v1/deposits/{depositId}
  MachinesAPI-->>Backend: status updates
```

## API flows (step-by-step)

<Steps>
  <Step title="1) Discover deposit assets">
    <b>Endpoint</b>: <a href="/api/deposits/assets" target="_blank" rel="noreferrer"><code>GET /partner/v1/deposits/assets</code></a>

    ```bash theme={null}
    curl -s \
      -H "Authorization: Bearer $PARTNER_SESSION_TOKEN" \
      "https://api.machines.cash/partner/v1/deposits/assets?q=hbar&limit=20"
    ```

    Response returns `assets[].ticker` and `assets[].networks[].id`.
  </Step>

  <Step title="2) Get range for selected pair">
    <b>Endpoint</b>: <a href="/api/deposits/range" target="_blank" rel="noreferrer"><code>POST /partner/v1/deposits/range</code></a>

    ```bash theme={null}
    curl -s \
      -H "Authorization: Bearer $PARTNER_SESSION_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{"currency":"hbar","network":"hbar"}' \
      https://api.machines.cash/partner/v1/deposits/range
    ```

    Use `range.minAmount` / `range.maxAmount` for validation.
  </Step>

  <Step title="3) Estimate receive amount">
    <b>Endpoint</b>: <a href="/api/deposits/estimate" target="_blank" rel="noreferrer"><code>POST /partner/v1/deposits/estimate</code></a>

    ```bash theme={null}
    curl -s \
      -H "Authorization: Bearer $PARTNER_SESSION_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{"currency":"hbar","network":"hbar","amount":25,"amountCurrency":"crypto"}' \
      https://api.machines.cash/partner/v1/deposits/estimate
    ```

    `amountCurrency` supports:

    <ul>
      <li><code>crypto</code> (default)</li>
      <li><code>usd</code></li>
    </ul>
  </Step>

  <Step title="4) Create deposit intent">
    <b>Endpoint</b>: <a href="/api/deposits/create" target="_blank" rel="noreferrer"><code>POST /partner/v1/deposits</code></a>

    ```bash theme={null}
    curl -s \
      -H "Authorization: Bearer $PARTNER_SESSION_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{"currency":"hbar","network":"hbar","amount":25}' \
      https://api.machines.cash/partner/v1/deposits
    ```

    Use the returned `deposit.depositAddress`. If `deposit.payinExtraId` is non-null, pass it as memo/tag in the user’s funding transaction.
  </Step>

  <Step title="5) Track status">
    <b>Endpoints</b>:

    <ul>
      <li><a href="/api/deposits/get" target="_blank" rel="noreferrer"><code>GET /partner/v1/deposits/{depositId}</code></a></li>
      <li><a href="/api/deposits/list" target="_blank" rel="noreferrer"><code>GET /partner/v1/deposits?scope=active</code></a></li>
    </ul>
  </Step>
</Steps>

## Key response fields

<ResponseField name="deposit.payinExtraId" type="string">
  Optional memo/tag required by some source networks.
</ResponseField>

<ResponseField name="estimate.quotedAmountCurrency" type="string" required>
  Quote input mode (`crypto` or `usd`).
</ResponseField>

<ResponseField name="estimate.estimatedToAmount" type="number">
  Estimated settled amount for the user contract route.
</ResponseField>

<ResponseField name="estimate.rateId" type="string">
  Provider rate id when available.
</ResponseField>
