Bosta.Net 1.0.1

dotnet add package Bosta.Net --version 1.0.1
                    
NuGet\Install-Package Bosta.Net -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Bosta.Net" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bosta.Net" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Bosta.Net" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Bosta.Net --version 1.0.1
                    
#r "nuget: Bosta.Net, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Bosta.Net@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Bosta.Net&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Bosta.Net&version=1.0.1
                    
Install as a Cake Tool

Bosta.Net

<div align="center">

Bosta.Net

The .NET SDK for the Bosta shipping API

NuGet Build License: MIT

</div>

Create and track shipments, schedule pickups, print airway bills, and handle webhooks — all from clean, strongly-typed C#.

Bosta is Egypt's tech-first shipping company. Their official SDKs cover PHP, Node.js, Python, Java and Ruby — this is the missing .NET piece.

Installation

dotnet add package Bosta.Net

Quick start

using Bosta.Net;
using Bosta.Net.Models;

var client = new BostaClient("your-api-key");

// Create a delivery (COD)
var delivery = await client.Deliveries.CreateAsync(new CreateDeliveryRequest
{
    Type = (int)DeliveryType.Send,          // 10 = Send, 15 = Cash collection, 25 = Return, 30 = Exchange
    Cod = 250,                             // cash to collect on delivery (EGP)
    Receiver = new Receiver
    {
        FirstName = "Ahmed",
        Phone = "01001234567"
    },
    DropOffAddress = new DeliveryAddress
    {
        City = "Cairo",
        FirstLine = "12 Tahrir St, Downtown"
    },
    BusinessReference = "ORDER-1001",      // your own order id
    Notes = "Call before arrival"
});

Console.WriteLine($"Tracking: {delivery.TrackingNumber}");

Tracking

var shipment = await client.Deliveries.TrackAsync("12345678");

Console.WriteLine($"State: {shipment.State.Value}");   // e.g. "Delivered"
Console.WriteLine($"Terminal: {shipment.IsTerminal}");

foreach (var e in shipment.History)
    Console.WriteLine($"{e.Timestamp}: {e.State.Value}");

Cancel a delivery

await client.Deliveries.TerminateAsync("12345678");

Cities, zones & districts

var cities = await client.Cities.ListAsync();
var zones = await client.Cities.GetZonesAsync(cities[0].Id);
var districts = await client.Cities.GetDistrictsAsync(cities[0].Id);

Pickup requests

var pickup = await client.Pickups.CreateAsync(new CreatePickupRequest
{
    ScheduledDate = "2026-10-09",
    ScheduledTimeSlot = "10:00-13:00",
    NumberOfPackages = 3,
    Notes = "Call on arrival"
});

var locations = await client.PickupLocations.ListAsync();
var awb = await client.Deliveries.PrintAwbAsync(new PrintAwbRequest
{
    TrackingNumbers = "11111111,22222222",
    Size = AwbSizes.A4,      // or AwbSizes.A6
    Language = "ar"          // or "en"
});

File.WriteAllBytes("awb.pdf", Convert.FromBase64String(awb.AwbBase64));

Price estimate

var estimate = await client.Pricing.CalculateShipmentPriceAsync(cityId, size: PackageSizes.Medium);

Webhooks

Register your webhook URL in the Bosta dashboard. Bosta POSTs a JSON payload on every state change, including the secret you configured. Validate it with a constant-time comparison (fail-closed):

using Bosta.Net.Webhooks;

[HttpPost("bosta-webhook")]
public IActionResult BostaWebhook([FromQuery] string secret, [FromBody] BostaWebhookEvent evt)
{
    if (!BostaWebhookValidator.IsValid(secret, _config["Bosta:WebhookSecret"]))
        return Unauthorized();

    if (evt.State == (int)DeliveryState.Delivered)
        _orders.MarkDelivered(evt.BusinessReference);

    return Ok();
}

Note: Bosta webhooks carry no HMAC signature — authentication is the dashboard-registered secret compared in constant time.

ASP.NET Core DI

builder.Services.AddBosta("your-api-key");
// or
builder.Services.AddBosta(o => o.ApiKey = configuration["Bosta:ApiKey"]);

// then inject BostaClient anywhere

Error handling

All API failures throw BostaApiException with the API's message, plus ErrorCode and StatusCode when available:

try
{
    await client.Deliveries.CreateAsync(request);
}
catch (BostaApiException ex)
{
    Console.WriteLine($"{ex.StatusCode}: {ex.Message}");
}

API coverage

Area Methods
Deliveries Create, bulk create, get/track, search, terminate, print AWB
Pickups List, get, create, update, delete, available dates
Geo Cities, zones, districts
Pickup locations List, get
Pricing Shipment price estimate
Webhooks Event model + secret validation

License

MIT — see LICENSE.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 52 10/8/2026
1.0.0 45 10/8/2026