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

# Deposit

> Step-by-step guide to crediting an account with a PIX dynamic QR code.

## Overview

Deposits credit an account when funds arrive. The customer references a quote that locks the rate (or a 1:1 spot for same-asset) and picks a funding rail; the response returns the concrete funding instruction — a PIX dynamic QR code — the payer uses to send money in. The deposit transitions to `COMPLETED` once the inbound payment is reconciled.

## Prerequisites

* An [active account](/journeys/open-account) configured for the asset to be credited.
* Valid [authentication credentials](/guides/authentication).

## Steps

<Steps>
  <Step title="Create a quote">
    Quotes lock the FX rate (or a 1:1 spot for same-asset) for a short window and are bound to one account. Use `sourceAsset` for the asset paid in and `targetAsset` for the asset credited to the account.

    ```bash theme={"theme":"tokyo-night"}
    curl --request POST \
      --url https://api.sandbox.tracefinance.com/v1/quotes \
      --header 'Authorization: Bearer <token>' \
      --header 'X-Idempotency-Key: <unique-key>' \
      --header 'Content-Type: application/json' \
      --data '{
        "accountId": "<account-id>",
        "sourceAsset": "BRL",
        "targetAsset": "BRL",
        "sourceAmount": "500.00"
      }'
    ```

    The response returns the quote `id`, the locked `effectiveRate`, and `expiresAt`. The quote can be consumed by exactly one operation before it expires.
  </Step>

  <Step title="Create the deposit">
    Reference the account, the quote, and the funding rail the payer will use to send the money in.

    ```bash theme={"theme":"tokyo-night"}
    curl --request POST \
      --url https://api.sandbox.tracefinance.com/v1/operations/deposit \
      --header 'Authorization: Bearer <token>' \
      --header 'X-Idempotency-Key: <unique-key>' \
      --header 'Content-Type: application/json' \
      --data '{
        "accountId": "<account-id>",
        "quoteId": "<quote-id>",
        "fundingInstruction": {
          "rail": "PIX_DYNAMIC_QR_CODE",
          "expiresIn": 86400
        }
      }'
    ```

    `expiresIn` is optional: how long the funding instruction stays valid, in seconds, up to `172800` (48 hours). It applies only to `PIX_DYNAMIC_QR_CODE` deposits where the quote's source and target asset match. Otherwise the operation inherits the quote's `expiresAt`.

    Returns `201` with the operation in `REQUESTED` status. The response carries `intent.fundingInstruction` with the concrete details for the rail — for `PIX_DYNAMIC_QR_CODE` that's the `qrCode` payload (EMV-encoded BR Code) and its `expiresAt` — and `intent.expiresAt`, when the deposit itself expires.
  </Step>

  <Step title="Send the funds">
    Present the `qrCode` from `intent.fundingInstruction` to the payer to pay via PIX before `expiresAt`. The amount must match the quote's `sourceAmount`.
  </Step>

  <Step title="Track the deposit">
    Subscribe to `OPERATION_COMPLETED` to receive the deposit confirmation once the inbound payment is reconciled, or `OPERATION_FAILED` if reconciliation fails. Both deliver the same payload as `OPERATION_REQUESTED`, with `currentState.status` set to the new status (and `currentState.reason` populated on failure). The intermediate `PROCESSING` status is not published as a webhook; poll `GET /v1/operations/{operationId}` if you need to surface it in your UI.

    ```bash theme={"theme":"tokyo-night"}
    curl --request GET \
      --url https://api.sandbox.tracefinance.com/v1/operations/<operation-id> \
      --header 'Authorization: Bearer <token>'
    ```
  </Step>
</Steps>

## What happens next

* [Execute a swap](/journeys/swap) — convert the deposited asset within the account.
* [Make a withdrawal](/journeys/withdrawal) — send funds out.
