# Update Escrow

### Requirements to use:

1. Only the entity with the admin role has permissions to execute this endpoint.
2. If an escrow has funds, the only thing the platform can do is add more milestones. The other properties cannot be modified under any circumstances.

### Headers

<table><thead><tr><th width="366">Name</th><th>Value</th></tr></thead><tbody><tr><td>Content-Type</td><td><code>application/json</code></td></tr><tr><td>x-api-key</td><td><code>&#x3C;token></code></td></tr></tbody></table>

### Roles:

| Name             | Type                 | Description                                                      |
| ---------------- | -------------------- | ---------------------------------------------------------------- |
| approvers        | string\[] (1–5)      | Addresses of the wallets allowed to approve milestones           |
| serviceProviders | string\[] (1–5)      | Address of the entity providing the service.                     |
| platformAddress  | string               | The address that receives the fee set for the platform           |
| releaseSigners   | string\[] (1–5)      | Addresses of the wallets authorised to release funds             |
| disputeResolvers | string\[] (1–5)      | Addresses in charge of resolving disputes within the escrow.     |
| receiver         | string               | Address where escrow proceeds will be sent to                    |
| admin            | string               | Wallet that authorises update, manage-milestones, and extend-ttl |
| observers        | string\[] (optional) | Read-only wallets. No on-chain authority                         |

### Milestone:

| Name        | Type    | Description                                                            |
| ----------- | ------- | ---------------------------------------------------------------------- |
| description | string  | Text describing the function of the milestone.                         |
| status      | string  | Milestone status. Ex: Approved, In dispute, etc...                     |
| approved    | boolean | Flag indicating whether a milestone has been approved by the approver. |

### Flags

| Name     | Type    | Description                                                       |
| -------- | ------- | ----------------------------------------------------------------- |
| disputed | boolean | Flag indicating that an escrow is in dispute.                     |
| released | boolean | Flag indicating that escrow funds have already been released.     |
| resolved | boolean | Flag indicating that a disputed escrow has already been resolved. |

### Trustline

| Name    | Type   | Description                                                                            |
| ------- | ------ | -------------------------------------------------------------------------------------- |
| address | string | Public address establishing permission to accept and use a specific token.             |
| symbol  | string | Official abbreviation representing the token in wallets, exchanges, and documentation. |

### Open API

## PUT /escrow/single-release/update-escrow

>

```json
{"openapi":"3.0.0","info":{"title":"Trustless Work API","version":"1.0"},"security":[{}],"paths":{"/escrow/single-release/update-escrow":{"put":{"operationId":"SingleReleaseController_updateEscrow","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSingleReleaseEscrow"}}}},"responses":{"200":{"description":"This endpoint returns an unsigned transaction in XDR format. This XDR is then used to sign the transaction using the “/helper/send-transaction” endpoint.","content":{"application/json":{}}},"400":{"description":"Bad request"},"401":{"description":"Unauthorized access"},"429":{"description":"Too Many Requests"},"500":{"description":"Possible errors:\n- Escrow not found\n- The platform fee cannot exceed 99%\n- Amount cannot be equal to or less than zero\n- Escrow initialized without milestone\n- Cannot define more than 50 milestones in an escrow\n- Only the platform address should be able to execute this function\n- The platform address of the escrow cannot be changed\n- Escrow has been opened for dispute resolution\n- All flags (approved, disputed, released) must be false in order to execute this function\n- The provided escrow properties do not match the stored escrow\n- You can't change the escrow properties after the milestone is approved\n- An unexpected error occurred","content":{"application/json":{}}}},"tags":["Single Release"]}}},"components":{"schemas":{"UpdateSingleReleaseEscrow":{"type":"object","properties":{"signer":{"type":"string","description":"Entity that signs the transaction that deploys and initializes the escrow"},"contractId":{"type":"string","description":"ID (address) that identifies the escrow contract"},"escrow":{"description":"Escrow data to update","allOf":[{"$ref":"#/components/schemas/EscrowData"}]}},"required":["signer","contractId","escrow"]},"EscrowData":{"type":"object","properties":{"engagementId":{"type":"string","description":"Unique identifier for the escrow"},"title":{"type":"string","description":"Name of the escrow"},"description":{"type":"string","description":"Text describing the function of the escrow"},"roles":{"description":"Roles that make up the escrow structure","type":"array","items":{"type":"object"}},"amount":{"type":"number","description":"Amount to be transferred upon completion of escrow milestones"},"platformFee":{"type":"number","description":"Commission that the platform will receive when the escrow is completed"},"milestones":{"description":"Objectives to be completed to define the escrow as completed","type":"array","items":{"type":"string"}},"flags":{"description":"Flags validating certain escrow life states","type":"array","items":{"type":"object"}},"isActive":{"type":"boolean","description":"Flag indicating whether the escrow is active or not at the database level. Makes only a logical deletion, the escrow will continue to function at the blockchain level."},"receiverMemo":{"type":"number","description":"Field used to identify the recipient's address in transactions through an intermediary account. This value is included as a memo in the transaction and allows the funds to be correctly routed to the wallet of the specified recipient"},"trustline":{"description":"Information on the trustline that will manage the movement of funds in escrow","type":"array","items":{"type":"object"}}},"required":["engagementId","title","description","roles","amount","platformFee","milestones","flags","isActive","receiverMemo","trustline"]}}}}
```

<figure><img src="/files/XFk9K10g9osvvfuLFQBG" alt=""><figcaption></figcaption></figure>

### **What this Endpoint returns?**

This endpoint returns the transaction unsigned so that the transaction can be signed by means of a customer wallet.

### Use Example:

```typescript
import axios from "axios";

const http = axios.create({
  baseURL: "https://dev.api.trustlesswork.com",
  timeout: 10000,
  headers: {
    "Content-Type": "application/json",
    "x-api-key": your_api_key,
  },
});

export const useExample = async () => {
    // Get the signer address
    const { address } = await kit.getAddress();

    const response = await http.put(
      "/escrow/single-release/v2/update",
      {
        // body requested for the endpoint
      },
    ); 
    
    // Get the unsigned transaction hash
    const { unsignedTransaction } = response.data;

    // Sign the transaction by wallet
    const { signedTxXdr } = await signTransaction(unsignedTransaction, {
      address,
      networkPassphrase: WalletNetwork.TESTNET,
    });

    // Send the transaction to Stellar Network
    const tx = await http.post("/stellar/submit-transaction", {
      signedXdr: signedTxXdr,
    });

    const { data } = tx;

    return data;
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.trustlesswork.com/trustless-work/v2-en/api-rest/deploy/update-escrow-properties.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
