Braze.Api 3.0.0

dotnet add package Braze.Api --version 3.0.0
                    
NuGet\Install-Package Braze.Api -Version 3.0.0
                    
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="Braze.Api" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Braze.Api" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Braze.Api" />
                    
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 Braze.Api --version 3.0.0
                    
#r "nuget: Braze.Api, 3.0.0"
                    
#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 Braze.Api@3.0.0
                    
#: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=Braze.Api&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Braze.Api&version=3.0.0
                    
Install as a Cake Tool

.NET client library for the Braze Rest Api

This nuget package provides strongly typed API clients for Braze's API.

NOTE: unofficial and not affiliated with Braze in any way.

Usage

Configuration (e.g. appsettings.json):

{
  "Braze": {
    "BaseAddress": "https://rest.fra-02.braze.eu",
    "ApiKey": "<SECRET KEY>"
  }
}

service.AddBrazeApi();
// or as keyed services
// service.AddBrazeApi("KEY-A", "Braze:A");
// service.AddBrazeApi("KEY-B", "Braze:B");

Client usage:


var userDataClient = provider.GetRequiredService<IUserDataClient>();

// or via IBrazeProviderFactory (usful for keyed services)
// var factory = provider.GetRequiredService<IBrazeProviderFactory>();
// var brazeProvider = factory.Get("KEY-A");
// var userDataClient = brazeProvider.UserDataClient;

// or directly via keyed services
// var userDataClient = provider.GetRequiredKeyedService<IUserDataClient>("KEY-A");

var track = new Track()
{
    Attributes =
    [
        new()
        {
            BrazeId = "72BBAA5C-B137-4895-8735-B163A34CD133",
            Country = "NO",
            DateOfBirth = new DateOnly(2000, 12, 10),
            DateOfFirstSession = DateTimeOffset.Parse("2001-01-01T00:00:00Z"),
            Gender = Gender.PreferNotToSay,
            CustomAttributes = new ()
            {
                { "yolo", PropertyOp.Literal(42) },
                { "yolo_implicit", 42 },
                { "yolo2", PropertyOp.Literal(42.42) },
                { "yolo3", new PropertyOp.IncrementInteger() { IncrementValue = 42, } },
                { "yolo5", (string?)null },

            },
        }
    ],
    Events =
    [
        new ()
        {
            Name = "navn",
            Time = DateTimeOffset.Parse("2003-01-01T00:00:00+00:00"),
            Email = "yolo@foobar.com",
            Properties = new ()
            {
                { "thihi", Property.Create(DateTimeOffset.Parse("2004-01-01T00:00:00+00:00")) },
                { "foobar", 24.2 },
            },
        },
    ],
    Purchases =
    [
        new()
        {
            ProductId = "123",
            Currency = "NOK",
            Price = 42.42M,
            Time = DateTimeOffset.Parse("2002-01-01T00:00:00+00:00"),
            Properties = new ()
            {
                { "foobar", Property.Create("FOOBAR") }
            },
        },
    ]
};

await userDataClient.Track(track, CancellationToken.None);

Ecommerce Events (Beta)

⚠️ Beta: Ecommerce event support is currently in beta. Only OrderPlacedEvent has been tested end-to-end against the Braze API. Other events are implemented according to the Braze ecommerce events specification but may contain issues.

The following recommended ecommerce events are supported via strongly typed classes in the Braze.Api.UserData.ECommerce namespace:

Event class Braze event name Tested end-to-end
ProductViewedEvent ecommerce.product_viewed
CartUpdatedEvent ecommerce.cart_updated
CheckoutStartedEvent ecommerce.checkout_started
OrderPlacedEvent ecommerce.order_placed
OrderRefundedEvent ecommerce.order_refunded
OrderCancelledEvent ecommerce.order_cancelled

Usage example:

var track = new Track()
{
    Events =
    [
        new OrderPlacedEvent()
        {
            ExternalId = "user-123",
            Time = DateTimeOffset.UtcNow,
            Properties = new OrderPlacedProperties
            {
                OrderId = "order-456",
                TotalValue = 99.99m,
                Currency = "USD",
                Source = "storefront",
                Products =
                [
                    new Product
                    {
                        ProductId = "prod-789",
                        ProductName = "T-Shirt",
                        VariantId = "tshirt_medium_blue",
                        Quantity = 1,
                        Price = 99.99m,
                    }
                ],
            },
        }
    ],
};

await userDataClient.Track(track, CancellationToken.None);

Development

The clients implemented in this package tries to replicate the logical structure in the Braze API documentation.

Feature Description Status
Catalogs Create and manage catalogs and catalog items to reference in your Braze campaigns.
Cloud Data Ingestion Manage your data warehouse integrations and syncs.
Email lists and addresses Set up and manage bi-directional sync between Braze and your email systems.
Export Access and export various details of your campaigns, Canvases, KPIs, and more.
Messages Schedule, send, and manage your campaigns and Canvases. Partially implemented (API-triggered campaign)
Preference center Build your preference center and update the styling of it.
SCIM Manage user identities in cloud-based applications and services.
SMS Manage your users’ phone numbers in your subscription groups.
Subscription groups List and update both SMS and email subscription groups stored in the Braze dashboard. Update implemented.
Templates Create and update templates for email messaging and Content Blocks.
User data Identify, track, and manage your users. Partially implemented (track)

Testing

The project includes comprehensive test coverage:

  • Unit Tests (Braze.Api.Tests): Serialization and model validation tests
  • Integration Tests (Braze.Api.IntegrationTests): End-to-end tests that validate:
    • HTTP request formatting (method, URI, headers, body)
    • Response parsing and error handling
    • All documented error scenarios (401, 403, 404, 400, 429, 5XX)
    • Rate limiting header capture
    • Dependency injection configuration
    • JSON serialization compliance with Braze API spec

Run tests with:

dotnet test
Product Compatible and additional computed target framework versions.
.NET 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 is compatible.  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 is compatible.  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. 
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
3.0.0 1,588 4/8/2026
3.0.0-preview.23840153099 119 4/1/2026
2.0.1 300 3/17/2026
2.0.1-preview.23436752044 57 3/23/2026
2.0.0 394 2/26/2026
1.1.1-preview.22444483272 70 2/26/2026
1.1.0 112 2/25/2026
1.1.0-preview.22444178624 62 2/26/2026
1.0.1-preview.22443960081 65 2/26/2026
1.0.0-preview.22264268865 120 2/21/2026
1.0.0-preview.22260430527 65 2/21/2026
1.0.0-preview.22259940276 65 2/21/2026
1.0.0-preview.22259514182 67 2/21/2026
0.1.0-preview.22257341672 67 2/21/2026
0.1.0-preview.22233179547 63 2/20/2026
0.1.0-preview.22231869675 68 2/20/2026
0.0.5 272 2/14/2026
0.0.4 216 2/11/2026
0.0.3 158 2/4/2026
Loading failed