# Deploy

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

### Milestone

| Name            | Type                              | Description                                                                                                               |
| --------------- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| description     | string                            | Text describing the function of the milestone                                                                             |
| status          | string (Default value: "pending") | Milestone status. Ex: Approved, In dispute, etc...                                                                        |
| approved        | boolean (Default value: false)    | Flag indicating whether a milestone has been approved by the approver                                                     |
| evidence        | string (optional)                 | Evidence reference (URL, IPFS hash, etc.) attached to the milestone                                                       |
| approvalsTarget | number (optional, default: 1)     | Number of distinct approvers required to consider the milestone approved. Must be ≥ 1 and ≤ the length of roles.approvers |

### Roles:

| Name             | Type                           | Description                                                                                                         |
| ---------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------- |
| approvers        | string\[] (1–5, no duplicates) | Addresses of the wallets allowed to approve milestones                                                              |
| serviceProviders | string\[] (1–5, no duplicates) | Addresses of the wallets that perform the work and change milestone status                                          |
| plataformAddress | string                         | The address that receives the fee set for the platform                                                              |
| releaseSigners   | string\[] (1–5, no duplicates) | Addresses of the wallets authorised to release funds once milestones are met                                        |
| disputeResolvers | string\[] (1–5, no duplicates) | Addresses of the wallets that resolve disputes. Cannot overlap with any other role                                  |
| receiver         | string                         | Address where escrow proceeds will be sent to                                                                       |
| admin            | string                         | Wallet that authorises update, manage-milestones, and extend-ttl operations. Must be distinct from every other role |
| observers        | string\[]                      | Read-only wallets attached to the escrow. No on-chain authority. Defaults to \[]                                    |

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

### Initialize Escrow

## POST /deployer/single-release

>

```json
{"openapi":"3.0.0","info":{"title":"Trustless Work API","version":"1.0"},"security":[{}],"paths":{"/deployer/single-release":{"post":{"operationId":"DeployerController_deploySingleReleaseContract","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SingleReleaseContract"}}}},"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- Amount cannot be zero\n- Escrow already initialized\n- The platform fee cannot exceed 99%\n- Escrow initialized without milestone\n- Cannot define more than 50 milestones in an escrow\n- All flags (approved, disputed, released) must be false in order to execute this function\n- An unexpected error occurred","content":{"application/json":{}}}},"tags":["Deployer"]}}},"components":{"schemas":{"SingleReleaseContract":{"type":"object","properties":{"signer":{"type":"string","description":"Entity that signs the transaction that deploys and initializes the escrow"},"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. (In this case it is not necessary to send the properties “approvedFlag” and “status” inside the objects of these milestones)","type":"array","items":{"type":"object"}},"trustline":{"description":"Information on the trustline that will manage the movement of funds in escrow","type":"array","items":{"type":"object"}}},"required":["signer","engagementId","title","description","roles","amount","platformFee","milestones","trustline"]}}}}
```

<figure><img src="/files/cBr0NPEm0WBYgg4GoHhy" 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:

<pre class="language-typescript"><code class="lang-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();

    // Execute the endpoint
<strong>    const response = await http.post(
</strong>      "/escrow/single-release/v2/deploy",
      {
        // 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; 
}
</code></pre>


---

# 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/initialize-escrow.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.
