# Aprobar hito

### **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>

### API Abierta

## POST /escrow/single-release/approve-milestone

>

```json
{"openapi":"3.0.0","info":{"title":"Trustless Work API","version":"1.0"},"security":[{}],"paths":{"/escrow/single-release/approve-milestone":{"post":{"operationId":"SingleReleaseController_approveMilestone","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApproveMilestone"}}}},"responses":{"201":{"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- Only the approver can change milestone flag\n- You cannot approve a milestone that has already been approved previously\n- The milestone status cannot be empty\n- Escrow initialized without milestone\n- Invalid milestone index\n- An unexpected error occurred","content":{"application/json":{}}}},"tags":["Single Release"]}}},"components":{"schemas":{"ApproveMilestone":{"type":"object","properties":{"contractId":{"type":"string","description":"ID (address) that identifies the escrow contract"},"milestoneIndex":{"type":"string","description":"Position that identifies the milestone within the group of milestones in the escrow"},"approver":{"type":"string","description":"Address of the entity requiring the service"}},"required":["contractId","milestoneIndex","approver"]}}}}
```

<figure><img src="/files/549a759d1392bb3ceffed8804d66d6144604b26e" alt=""><figcaption></figcaption></figure>

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

Este endpoint devuelve la transacción sin firmar para que la transacción pueda ser firmada por medio de 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 () => {
    // Obtener la dirección del firmante
    const { address } = await kit.getAddress();

    const response = await http.post(
      "/escrow/single-release/approve-milestone",
      {
        // cuerpo solicitado para el endpoint
      },
    ); 
    
    // Obtener el hash de la transacción sin firmar
    const { unsignedTransaction } = response.data;

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

    // Enviar 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/change-milestone-flag.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.
