# Actualizar escrow

### Requisitos para usar:

1. Solo la entidad con el rol de plataforma tiene permisos para ejecutar este endpoint
2. Si un escrow tiene fondos, lo único que la plataforma puede hacer es añadir más hitos. Las otras propiedades no pueden modificarse bajo ninguna circunstancia.

### Encabezados

<table><thead><tr><th width="366">Nombre</th><th>Valor</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:

| Nombre          | Tipo   | Descripción                                                                                 |
| --------------- | ------ | ------------------------------------------------------------------------------------------- |
| approver        | string | Dirección de la entidad que requiere el servicio.                                           |
| serviceProvider | string | Dirección de la entidad que presta el servicio.                                             |
| platformAddress | string | Dirección de la entidad que posee el escrow                                                 |
| releaseSigner   | string | Dirección del usuario encargado de liberar los fondos del escrow al proveedor del servicio. |
| disputeResolver | string | Dirección encargada de resolver disputas dentro del escrow.                                 |
| receiver        | string | Dirección donde se enviarán los fondos del escrow                                           |

### Hito:

| Nombre      | Tipo    | Descripción                                       |
| ----------- | ------- | ------------------------------------------------- |
| description | string  | Texto que describe la función del hito.           |
| status      | string  | Estado del hito. Ej: Aprobado, En disputa, etc... |
| amount      | boolean | Cantidad del hito                                 |

### Trustline

| Nombre  | Tipo   | Descripción                                                                      |
| ------- | ------ | -------------------------------------------------------------------------------- |
| address | string | Dirección pública que establece permiso para aceptar y usar un token específico. |

### Open API

## PUT /escrow/multi-release/update-escrow

>

```json
{"openapi":"3.0.0","info":{"title":"Trustless Work API","version":"1.0"},"security":[{}],"paths":{"/escrow/multi-release/update-escrow":{"put":{"operationId":"MultiReleaseController_updateEscrow","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateMultiReleaseEscrow"}}}},"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- The platform fee cannot exceed 99%\n- Escrow initialized without milestone\n- Cannot define more than 50 milestones in an escrow\n- Amount cannot be zero\n- Escrow not found\n- Only the platform address should be able to execute this function\n- The platform address of the escrow cannot be changed\n- The provided escrow properties do not match the stored escrow\n- All flags (approved, disputed, released) must be false in order to execute this function","content":{"application/json":{}}}},"tags":["Multi Release"]}}},"components":{"schemas":{"UpdateMultiReleaseEscrow":{"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/526173607ea4afa325d17e4527243d41c8bdee9b" alt=""><figcaption></figcaption></figure>

### **¿Qué devuelve este Endpoint?**

Este endpoint devuelve la transacción sin firmar para que la transacción pueda ser firmada mediante la billetera del cliente.

### Ejemplo de uso:

```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 () => {
    // Obtén la dirección del firmante
    const { address } = await kit.getAddress();

    const response = await http.put(
      "/escrow/multi-release/update-escrow",
      {
        // cuerpo solicitado para el endpoint
      },
    ); 
    
    // Obtén el hash de la transacción sin firmar
    const { unsignedTransaction } = response.data;

    // Firma la transacción con la billetera
    const { signedTxXdr } = await signTransaction(unsignedTransaction, {
      address,
      networkPassphrase: WalletNetwork.TESTNET,
    });

    // Envía la transacción a la Red Stellar
    const tx = await http.post("/helper/send-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/v1-es/api-rest/deploy-1/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.
