# Enviar transação

### **Cabeçalhos**

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

### **Open API**

## POST /helper/send-transaction

>

```json
{"openapi":"3.0.0","info":{"title":"Trustless Work API","version":"1.0"},"security":[{}],"paths":{"/helper/send-transaction":{"post":{"operationId":"HelperController_sendTransaction","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendTransaction"}}}},"responses":{"200":{"description":"The transaction has been successfully sent to the Stellar network","content":{"application/json":{}}},"400":{"description":"Bad request"},"401":{"description":"Unauthorized access"},"429":{"description":"Too Many Requests"},"500":{"description":"\n      <p>Possible errors:</p>\n      <ul>\n        <li>The transaction could not be sent to the Stellar network for some unknown reason. Please try again.</li>\n      </ul>","content":{"application/json":{}}}},"tags":["Helper"]}}},"components":{"schemas":{"SendTransaction":{"type":"object","properties":{"signedXdr":{"type":"string","description":"The sign's hash. This come from the wallet"}},"required":["signedXdr"]}}}}
```

### Exemplo 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 () => {
    // Obter o endereço do assinante
    const { address } = await kit.getAddress();

    const response = await http.post(
      "/qualquer-endpoint",
      {
        // corpo solicitado para o endpoint
      },
    ); 
    
    // Obter o hash da transação não assinada
    const { unsignedTransaction } = response.data;

    // Assinar a transação pela carteira
    const { signedTxXdr } = await signTransaction(unsignedTransaction, {
      address,
      networkPassphrase: WalletNetwork.TESTNET,
    });

    // Envie a transação para a Rede Stellar  <--------------- ISTO
    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-pt/api-rest/helpers/send-transaction.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.
