How-to · 3 min read
Receive an OTP in C# / .NET
A minimal HttpClient example for provisioning a number and reading the verification code from .NET.
No SDK needed — the REST API is a couple of HttpClient calls.
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization = new("Bearer", Environment.GetEnvironmentVariable("EVESES_KEY"));
var body = new StringContent(
"""{"country":"ua","mode":"activation","service":"telegram"}""",
Encoding.UTF8, "application/json");
var created = await http.PostAsync("https://api.eveses.com/api/v1/numbers/orders", body);
var order = await created.Content.ReadFromJsonAsync<Order>();
// poll for the code (or receive it on a webhook endpoint)
string? otp = null;
while (otp is null) {
var r = await http.GetFromJsonAsync<SmsResponse>(
$"https://api.eveses.com/api/v1/numbers/orders/{order.OrderId}/sms");
otp = r?.Sms?.FirstOrDefault()?.Otp;
if (otp is null) await Task.Delay(1500);
}
For production, expose a webhook controller and verify the HMAC signature rather than polling.
Ready to build? Create a free Eveses account, top up a wallet, and grab your API key — no KYC. See the API docs or live pricing.
FAQ
▸How do I receive an SMS code in C#?
Call the REST API with HttpClient: POST /account/orders to provision, then GET /orders/{id}/sms (or a webhook) to read the code.
Related guides