BrickTrack 0.1.0
dotnet add package BrickTrack --version 0.1.0
NuGet\Install-Package BrickTrack -Version 0.1.0
<PackageReference Include="BrickTrack" Version="0.1.0" />
<PackageVersion Include="BrickTrack" Version="0.1.0" />
<PackageReference Include="BrickTrack" />
paket add BrickTrack --version 0.1.0
#r "nuget: BrickTrack, 0.1.0"
#:package BrickTrack@0.1.0
#addin nuget:?package=BrickTrack&version=0.1.0
#tool nuget:?package=BrickTrack&version=0.1.0
BrickTrack .NET SDK
The official .NET SDK for the BrickTrack LEGO price tracking API.
Track LEGO set prices with a scheduled watchlist, price history and alerts.
The SDK exposes 9 typed async methods, one per documented endpoint (with required properties checked at compile time), plus ClearTargetPriceAsync and a generic RequestAsync.
Requirements
- .NET 8 or newer
Installation
dotnet add package BrickTrack
Get your API key
Sign up for BrickTrack or sign in, then copy your API key from the dashboard. new BrickTrackClient() reads the BRICKTRACK_API_KEY environment variable.
Quick start
using BrickTrack;
using var client = new BrickTrackClient();
var response = await client.SearchSetsAsync(new SearchSetsParams { Query = "millennium falcon" });
Console.WriteLine(response.Json);
Parameter classes mirror the API reference. Use response.Deserialize<MyType>() to map the JSON onto your own types.
HTTP methods
Each method uses the HTTP verb of its endpoint. GET and DELETE send parameters in the query string; POST and PATCH send them as a JSON body, except wait on /products/{id}/check, which stays in the query string. Null values are never sent: to remove a product's target price, call ClearTargetPriceAsync(id), which sends {"target_price": null}.
Any endpoint
var response = await client.RequestAsync("GET", "/account");
Errors
try
{
await client.SearchSetsAsync(new SearchSetsParams { Query = "millennium falcon" });
}
catch (BrickTrackApiException exception)
{
Console.Error.WriteLine($"{exception.StatusCode} {exception.ErrorCode}: {exception.Message}");
}
ErrorCode is the API's error.code (such as insufficient_credits, product_limit or not_found), or null when the body has none.
| Exception | When |
|---|---|
BrickTrackConfigurationException |
Missing API key, invalid options or unsupported method. |
BrickTrackSerializationException |
A required parameter is missing or a value can't be sent. |
BrickTrackTransportException |
Network failure or timeout. |
BrickTrackApiException |
Non-2xx status (StatusCode, ErrorMessage, ErrorCode, ResponseBody, RawResponse). |
BrickTrackResponseDecodingException |
A success response could not be decoded. |
All of them derive from BrickTrackException. Caller cancellation surfaces as OperationCanceledException.
Retries
Requests are retried up to 3 times after a network error, a 408, 500, 502, 503 or 504. Other statuses, such as 400, 401, 402, 404 or 429, and client-side timeouts are not retried: the API's rate limits last until the hour (or the day) is over, and on the free plan every retry would count as a request. The delay starts at 1 second and grows 1.5× per retry (capped at 30 seconds); a Retry-After header wins.
using var client = new BrickTrackClient(new BrickTrackClientOptions { MaxRetries = 5, RetryDelay = TimeSpan.FromMilliseconds(500) });
await client.SearchSetsAsync(new SearchSetsParams { Query = "millennium falcon" }, new RequestOptions { MaxRetries = 0 }); // one request without retries
Batch requests
BatchAsync runs a function per item with at most 10 in flight (concurrency) and returns one BatchResult per item, in input order. A failing item never stops the others.
string[] inputs = { "millennium falcon", "titanic", "botanical" };
var results = await client.BatchAsync(inputs, (value, ct) =>
client.SearchSetsAsync(new SearchSetsParams { Query = value }, cancellationToken: ct), concurrency: 5);
foreach (var result in results)
{
if (result.Ok)
{
Console.WriteLine(result.Value!.Json);
}
else
{
Console.Error.WriteLine($"{inputs[result.Index]}: {result.Error!.Message}");
}
}
| Constant | Default | Description |
|---|---|---|
BrickTrackClient.DefaultConcurrency |
10 |
Tasks run at the same time by batch |
BrickTrackClient.DefaultTimeout |
TimeSpan.FromSeconds(120) |
Request timeout |
BrickTrackClient.MaxRetries |
3 |
Retry attempts after a network error, a 408/5xx |
BrickTrackClient.RetryBackoffFactor |
1.5 |
Exponential backoff multiplier |
BrickTrackClient.DefaultRetryDelay |
TimeSpan.FromSeconds(1) |
Delay before the first retry |
Configuration
using var client = new BrickTrackClient(new BrickTrackClientOptions
{
ApiKey = Environment.GetEnvironmentVariable("BRICKTRACK_API_KEY"),
Timeout = TimeSpan.FromSeconds(60), // default 120 s
HttpClient = myHttpClient, // optional, you keep ownership
});
Endpoints
9 methods, generated from the OpenAPI document, plus ClearTargetPriceAsync.
| Method | HTTP | Description |
|---|---|---|
CheckProductAsync |
POST /products/{id}/check |
Asks for a check right away (1 credit), at most once per 5 minutes; earlier calls return the product unchanged. A paused product has to be… |
ClearTargetPriceAsync |
PATCH /products/{id} |
Removes the product's target price (sends {"target_price": null}). |
DeleteProductAsync |
DELETE /products/{id} |
Removes the product and its price history. |
GetAccountAsync |
GET /account |
Your plan, the credits left (monthly allowance and packs), how many products you track and the credits they use per month, the credits each… |
GetProductAsync |
GET /products/{id} |
The product's latest state and every price read of the period, oldest first. The history covers every read of this set number on this marke… |
GetSetHistoryAsync |
GET /history |
Every price BrickTrack read for a set number on a marketplace over the period, whoever tracks it, oldest first, with the lowest, highest an… |
ListProductsAsync |
GET /products |
Your watchlist, newest first, with each product's latest state and its recent prices (trend). Filter with set_number (and marketplace) to k… |
SearchSetsAsync |
GET /search |
LEGO sets matching a name, a theme or the start of a set number (up to 20, the biggest first), from BrickTrack's catalog of official sets,… |
TrackProductAsync |
POST /products |
Adds a set number or a LEGO link to your watchlist. The first check runs in the background within seconds (checking is true until then): po… |
UpdateProductAsync |
PATCH /products/{id} |
Target price, drop alerts, check interval, or pause. Send only what changes. On the free plan, alerts (price drop, back in stock, target pr… |
All BrickTrack SDKs
| SDK | Package | Install |
|---|---|---|
| Node.js | @bricktrack/sdk |
npm install @bricktrack/sdk |
| Python | bricktrack |
pip install bricktrack |
| Go | bricktrack-go |
go get github.com/bricktrackdev/bricktrack-go |
| .NET | BrickTrack |
dotnet add package BrickTrack |
| Ruby | bricktrack |
gem install bricktrack |
| PHP | bricktrack/sdk |
composer require bricktrack/sdk |
| Java | bricktrack-java |
build from source, see its README |
| CLI | @bricktrack/cli |
npm install -g @bricktrack/cli |
| MCP server | @bricktrack/mcp |
npx -y @bricktrack/mcp |
Trademarks
LEGO® is a trademark of the LEGO Group of companies which does not sponsor, authorize or endorse this software.
License
MIT — see LICENSE.
| Product | Versions 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 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. |
-
net8.0
- No dependencies.
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 |
|---|---|---|
| 0.1.0 | 0 | 12/1/2026 |