---
id: "M:cAlgo.API.Http.SendAsync(cAlgo.API.HttpRequest,System.Action{cAlgo.API.HttpResponse})"
kind: "method"
type: "T:cAlgo.API.Http"
url: "https://help.ctrader.com/ctrader-algo/references/HTTP/Http/SendAsync/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# Http.SendAsync

Member of [Http](https://help.ctrader.com/ctrader-algo/references/HTTP/Http/index.md).

## SendAsync(HttpRequest request, Action<HttpResponse> callback)

Performs a request to the specified URI. The request method depends on the value of the `request.Method` property.

Environments: Desktop supported · CLI supported · Cloud not supported.

- Cloud: No request is sent. The response, or the callback, has IsSuccessful false, StatusCode 403 and Body null. No exception is thrown.

C#:

```csharp
void SendAsync(HttpRequest request, Action<HttpResponse> callback)
```

Python:

```python
api.Http.SendAsync(request: HttpRequest, callback: Callable[[HttpResponse], None]) -> None
```

### Parameters

- `request` (`HttpRequest`, Python `HttpRequest`): The `HttpRequest` object representing the request contents.
- `callback` (`Action<HttpResponse>`, Python `Callable[[HttpResponse], None]`): The method to be invoked when the request is being sent.

### Examples

C#:

```csharp
var request = new HttpRequest(new Uri("https://api.example.com/signals"))
{
    Method = HttpMethod.Post,
    Body = "EURUSD buy"
};
Http.SendAsync(request, response => Print("Signal sent: {0}", response.IsSuccessful));
```

Python:

```python
from System import Uri

request = HttpRequest(Uri("https://api.example.com/signals"))
request.Method = HttpMethod.Post
request.Body = "EURUSD buy"
api.Http.SendAsync(request, lambda response: api.Print(f"Signal sent: {response.IsSuccessful}"))
```

