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

# Release Locked Escrow Funds — POST /api/escrow/release

> POST /api/escrow/release — releases locked USDC to the beneficiary once both parties confirm. Returns txHash and release status.

Releasing an escrow requires **both** the depositor and the beneficiary to confirm delivery. Call this endpoint once per party — the first confirmation puts the escrow in a partially-confirmed state, and the second confirmation triggers the on-chain transfer and marks the escrow `RELEASED`. The response tells you whether the escrow is fully released or still awaiting the other party.

<Note>
  The `callerSCA` must exactly match either the `depositorSCA` or `beneficiarySCA` recorded at creation. Mismatched addresses will be rejected.
</Note>

## Endpoint

```
POST https://flarehq.xyz/api/escrow/release
```

## Authentication

Pass your merchant bearer token in the `Authorization` header.

```
Authorization: Bearer fhq_sec_...
```

## Request Body

<ParamField body="reference" type="string" required>
  The escrow reference ID returned by `POST /api/escrow/create` — e.g. `"escrow_m5k2r1_a4b8c2"`.
</ParamField>

<ParamField body="callerSCA" type="string" required>
  The SCA wallet address that is confirming delivery. Must be either the `depositorSCA` or `beneficiarySCA` recorded at escrow creation, and must be a wallet your merchant account controls.
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  `true` when the on-chain confirmation transaction was accepted.
</ResponseField>

<ResponseField name="escrow" type="object">
  The updated escrow record.

  <Expandable title="escrow fields">
    <ResponseField name="escrow.status" type="string">
      `"RELEASED"` if both parties have now confirmed. `"ACTIVE"` if only one party has confirmed so far.
    </ResponseField>

    <ResponseField name="escrow.depositorConfirmed" type="boolean">
      Whether the depositor has submitted their confirmation.
    </ResponseField>

    <ResponseField name="escrow.beneficiaryConfirmed" type="boolean">
      Whether the beneficiary has submitted their confirmation.
    </ResponseField>

    <ResponseField name="escrow.releaseTxHash" type="string">
      Populated with the final release transaction hash once both parties have confirmed. `null` until then.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="txHash" type="string">
  The on-chain transaction hash for this release confirmation call.
</ResponseField>

<ResponseField name="explorerUrl" type="string">
  ArcScan link — `https://testnet.arcscan.app/tx/{txHash}`.
</ResponseField>

<ResponseField name="released" type="boolean">
  `true` if this confirmation completed the release (both parties confirmed). `false` if still waiting on the other party.
</ResponseField>

<ResponseField name="message" type="string">
  A human-readable summary — either confirming full release with the USDC amount and recipient, or indicating which party's confirmation is still pending.
</ResponseField>

## Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://flarehq.xyz/api/escrow/release \
    -H "Authorization: Bearer fhq_sec_YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "reference": "escrow_m5k2r1_a4b8c2",
      "callerSCA": "0xDepositorSCAWalletAddress"
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch("https://flarehq.xyz/api/escrow/release", {
    method: "POST",
    headers: {
      "Authorization": "Bearer fhq_sec_YOUR_TOKEN",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      reference: "escrow_m5k2r1_a4b8c2",
      callerSCA: "0xDepositorSCAWalletAddress",
    }),
  });

  const data = await response.json();
  if (data.released) {
    console.log("Escrow fully released:", data.txHash);
  } else {
    console.log("Awaiting second confirmation.");
  }
  ```
</CodeGroup>

### Full Release Response (both parties confirmed)

```json theme={null}
{
  "success": true,
  "escrow": {
    "reference":            "escrow_m5k2r1_a4b8c2",
    "status":               "RELEASED",
    "depositorConfirmed":   true,
    "beneficiaryConfirmed": true,
    "releaseTxHash":        "0xdef456abc789def456abc789def456abc789def456abc789def456abc789def4"
  },
  "txHash":      "0xdef456abc789def456abc789def456abc789def456abc789def456abc789def4",
  "explorerUrl": "https://testnet.arcscan.app/tx/0xdef456abc789...",
  "released":    true,
  "message":     "Escrow fully released — 200 USDC sent to 0xBeneficiarySCAWalletAddress"
}
```

### Partial Confirmation Response (waiting on other party)

```json theme={null}
{
  "success": true,
  "escrow": {
    "reference":            "escrow_m5k2r1_a4b8c2",
    "status":               "ACTIVE",
    "depositorConfirmed":   true,
    "beneficiaryConfirmed": false,
    "releaseTxHash":        null
  },
  "txHash":      "0xaaa111bbb222ccc333ddd444eee555fff666777888999000aaabbbcccdddeee",
  "explorerUrl": "https://testnet.arcscan.app/tx/0xaaa111bbb222...",
  "released":    false,
  "message":     "Delivery confirmed by depositor — waiting for other party."
}
```

### Error — Escrow Already Released

```json theme={null}
{
  "success": false,
  "error": "Escrow is RELEASED — cannot release."
}
```

<Warning>
  You cannot release a `DISPUTED` escrow. If a dispute is active, the FlareHQ arbiter must resolve it first before funds can move.
</Warning>
