A strongly typed .NET client for the PeerBerry investor HTTP API. It is not an official PeerBerry SDK or product of the platform.
- PeerBerry terms of use may restrict bots, scripts, or other automation. Using this library in ways that conflict with those rules may violate the platform terms.
- This repository is for educational and technical purposes only. You use it at your own risk, including any legal consequences, account suspension, or loss of funds.
- Authors and contributors accept no liability for how this code is used.
- Strongly typed request/response models
- Sign-in with email/password (with 2FA or email-code flows when required), or access/refresh tokens
- Automatic token refresh on
401(with optionalOnUnauthorizedAsyncand credential callback) - Loans list, investments, primary buy, secondary market list/buy, loan details, profile, balance
SendCustomApiAsyncfor endpoints not yet wrapped in the client
- Target .NET 8 or later (same major as the package)
- Transitive dependencies include
Microsoft.Extensions.Logging.AbstractionsandMicrosoft.AspNetCore.WebUtilities; you normally do not reference them manually
1. Add the NuGet package:
dotnet add package PeerBerry.API2. Create the client and call the API (replace placeholders with your credentials):
using PeerBerry.API;
using PeerBerry.API.Initialize;
using Microsoft.Extensions.Logging;
using var client = new PeerBerryClient(NullLogger<PeerBerryClient>.Instance);
// Option A — existing tokens (simplest for a smoke test)
await client.InitializeUsingTokensAsync(accessToken, refreshToken);
// Option B — email and password (handle InitResult for 2FA or email code)
// var init = await client.InitializeUsingEmailAsync("you@example.com", "password");
// if (init.Result != InitResultEnum.Succeed) { /* InitializeUsing2Fa / InitializeUsingEmailCode */ }
var balance = await client.GetBalanceMainAsync();Use a real ILogger<PeerBerryClient> (e.g. from LoggerFactory) instead of NullLogger when you want log output. Pass a credentials callback to the PeerBerryClient constructor if you need to persist refreshed tokens.
See LICENSE.txt.
“PeerBerry” is a trademark of its owner. This project is not affiliated with or endorsed by PeerBerry.