Ynab.Api.Client
1.73.0
See the version list below for details.
dotnet add package Ynab.Api.Client --version 1.73.0
NuGet\Install-Package Ynab.Api.Client -Version 1.73.0
<PackageReference Include="Ynab.Api.Client" Version="1.73.0" />
<PackageVersion Include="Ynab.Api.Client" Version="1.73.0" />
<PackageReference Include="Ynab.Api.Client" />
paket add Ynab.Api.Client --version 1.73.0
#r "nuget: Ynab.Api.Client, 1.73.0"
#:package Ynab.Api.Client@1.73.0
#addin nuget:?package=Ynab.Api.Client&version=1.73.0
#tool nuget:?package=Ynab.Api.Client&version=1.73.0
YNAB.API.Client
A simple and maintainable .NET 9+ client for the YNAB API. This client was generated using NSwag Studio with very few manual changes and has no dependencies. This allows the client to be quickly regenerated as both the YNAB API and .NET SDK evolve over the years. The version number (major/minor) matches the YNAB API version it was built from.
Usage
Add the nuget to your app:
dotnet add package Ynab.Api.Client
Create an access token via the YNAB website and add it to the following code snippet, which shows how to add the client to your app's services (you can alternatively just instantiate the client directly if preferred):
services.AddSingleton<YnabApiClient>(sp =>
{
var accessToken = "<YOUR ACCESS TOKEN>";
return new YnabApiClient(new HttpClient()
{
DefaultRequestHeaders = {
Authorization = new AuthenticationHeaderValue("Bearer", accessToken)
}
});
});
...
public class MyClass(YnabApiClient ynabClient)
{
(await _ynabClient.GetBudgetsAsync(false)).Data.Budgets
.ToList()
.ForEach(budget => {
Console.WriteLine($"Budget Name: {budget.Name}");
});
}
How to update
Download NSwag Studio and launch it. Select Net90
as the Runtime and enter the following as the Specification URL: https://api.ynab.com/papi/open_api_spec.yaml
. Choose CSharp Client
and use all the defaults except for:
- Namespace:
Ynab.Api.Client
- ☑ Generate optional schema properties as nullable
- ☑ Generate nullable Reference Type annotations
- Select: SystemTextJson
- Output: Path to a file named
YnabApiClient.cs
Click Generate files
. It generates one big file so you can use Rider to automatically separate all the classes and types into individual files. Then clean up a few things:
- Create folders:
Enums
,Models
,Responses
,Utils
- Move files with the suffix
Response
into Responses - Move files with the suffix
Type
into Enums - Move files with the suffix
Data
into Responses - Move remaining files into Models
- Rename each file with the suffix
Data
based on the response that uses it.
License
Copyright (c) 2025 Tom Bulatewicz
Licensed under the MIT license
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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 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. |
-
net9.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Ynab.Api.Client:
Package | Downloads |
---|---|
Ynab.Api.Client.Extensions
Helpful extensions to the Ynab.Api.Client |
GitHub repositories
This package is not used by any popular GitHub repositories.