![]() |
VOOZH | about |
dotnet add package InsurScan.Sdk --version 0.1.34
NuGet\Install-Package InsurScan.Sdk -Version 0.1.34
<PackageReference Include="InsurScan.Sdk" Version="0.1.34" />
<PackageVersion Include="InsurScan.Sdk" Version="0.1.34" />Directory.Packages.props
<PackageReference Include="InsurScan.Sdk" />Project file
paket add InsurScan.Sdk --version 0.1.34
#r "nuget: InsurScan.Sdk, 0.1.34"
#:package InsurScan.Sdk@0.1.34
#addin nuget:?package=InsurScan.Sdk&version=0.1.34Install as a Cake Addin
#tool nuget:?package=InsurScan.Sdk&version=0.1.34Install as a Cake Tool
Official .NET SDK for InsurScan API - Convert insurance policy and quote PDFs to structured JSON with zero setup. Stateless, secure, and developer-friendly.
Install the NuGet package:
dotnet add package InsurScan.Sdk
Or via Package Manager Console:
Install-Package InsurScan.Sdk
using InsurScan.Sdk;
// In Program.cs or Startup.cs
builder.Services.AddInsurScan("https://api.insurscan.com");
// Or with configuration
builder.Services.AddInsurScan(builder.Configuration.GetSection("InsurScan"));
{
"InsurScan": {
"BaseUrl": "https://api.insurscan.com",
"Timeout": "00:00:30",
"MaxFileSize": 5000000,
"MaxRetryAttempts": 3,
"BaseDelaySeconds": 1.0
}
}
using InsurScan.Sdk;
using InsurScan.Models;
public class InsuranceService
{
private readonly IInsurScanClient _insurScanClient;
private readonly ILogger<InsuranceService> _logger;
public InsuranceService(IInsurScanClient insurScanClient, ILogger<InsuranceService> logger)
{
_insurScanClient = insurScanClient;
_logger = logger;
}
public async Task<KaskoQuoteResult?> ProcessKaskoQuoteAsync(string filePath)
{
// Create PDF content from file
using var pdfContent = PdfContent.FromFile(filePath);
// Process the PDF
var result = await _insurScanClient.ReadQuotePdf(
PdfProductBranch.Kasko,
pdfContent,
InsuranceCompany.Auto // Auto-detect insurance company
);
// Handle the result
return result switch
{
InsurScanResult<KaskoQuoteResult>.Success success => success.Data,
InsurScanResult<KaskoQuoteResult>.Failure failure =>
{
_logger.LogError("Failed to process PDF: {Error}", failure.Error);
return null;
}
};
}
}
using var pdfContent = PdfContent.FromFile("path/to/kasko-quote.pdf");
var result = await client.ReadQuotePdf(PdfProductBranch.Kasko, pdfContent);
using var fileStream = File.OpenRead("kasko-quote.pdf");
using var pdfContent = PdfContent.FromStream(fileStream, "kasko-quote.pdf");
var result = await client.ReadQuotePdf(PdfProductBranch.Kasko, pdfContent);
byte[] pdfBytes = await File.ReadAllBytesAsync("kasko-quote.pdf");
using var pdfContent = PdfContent.FromBytes(pdfBytes, "kasko-quote.pdf");
var result = await client.ReadQuotePdf(PdfProductBranch.Kasko, pdfContent);
[HttpPost("upload")]
public async Task<IActionResult> UploadKaskoQuote(IFormFile file)
{
using var stream = file.OpenReadStream();
using var pdfContent = PdfContent.FromStream(stream, file.FileName);
var result = await _insurScanClient.ReadQuotePdf(
PdfProductBranch.Kasko,
pdfContent,
InsuranceCompany.Auto
);
return result switch
{
InsurScanResult<KaskoQuoteResult>.Success success => Ok(success.Data),
InsurScanResult<KaskoQuoteResult>.Failure failure => BadRequest(failure.Error.ToString())
};
}
The SDK uses discriminated unions for type-safe error handling:
var result = await client.ReadQuotePdf(PdfProductBranch.Kasko, pdfContent);
switch (result)
{
case InsurScanResult<KaskoQuoteResult>.Success success:
// Process successful result
var quote = success.Data;
Console.WriteLine($"Premium: {quote.Premium.TotalPremium}");
break;
case InsurScanResult<KaskoQuoteResult>.Failure failure:
// Handle specific errors
switch (failure.Error)
{
case InsurScanError.EmptyPdf:
Console.WriteLine("PDF file is empty");
break;
case InsurScanError.EncryptedPdf:
Console.WriteLine("PDF file is encrypted");
break;
case InsurScanError.UnsupportedInsuranceCompany:
Console.WriteLine("Insurance company not supported");
break;
case InsurScanError.NetworkError:
Console.WriteLine("Network error occurred");
break;
default:
Console.WriteLine($"Error: {failure.Error}");
break;
}
break;
}
| Property | Type | Default | Description |
|---|---|---|---|
BaseUrl |
string |
Required | The base URL of the InsurScan API |
Timeout |
TimeSpan |
00:00:30 |
HTTP request timeout |
MaxFileSize |
long |
1000000 |
Maximum PDF file size in bytes (1MB) |
MaxRetryAttempts |
int |
3 |
Maximum retry attempts for failed requests |
BaseDelaySeconds |
double |
1.0 |
Base delay for exponential backoff |
CustomHeaders |
Dictionary<string, string> |
{} |
Custom headers for requests |
UserAgent |
string |
Auto-generated | User agent string |
builder.Services.AddInsurScan(options =>
{
options.BaseUrl = "https://api.insurscan.com";
options.Timeout = TimeSpan.FromSeconds(60);
options.MaxFileSize = 5_000_000; // 5MB
options.MaxRetryAttempts = 5;
options.BaseDelaySeconds = 2.0;
options.CustomHeaders.Add("X-API-Key", "your-api-key");
options.CustomHeaders.Add("X-Client-Version", "1.0.0");
});
The SDK supports automatic detection and processing of PDFs from major Turkish insurance companies:
InsuranceCompany.Auto) - Automatically detects the insurance companyInsuranceCompany.Ak)InsuranceCompany.Hdi)InsuranceCompany.Neova)InsuranceCompany.Ray)InsuranceCompany.Sompo)InsuranceCompany.TurkiyeKatilim)The SDK defines comprehensive error types for different failure scenarios:
| Error | Description |
|---|---|
EmptyPdf |
PDF file is empty or has no content |
EncryptedPdf |
PDF file is encrypted and cannot be processed |
InvalidPdf |
PDF file is corrupted or invalid |
FileTooLarge |
PDF file exceeds the maximum size limit |
UnsupportedPdfFormat |
PDF format is not supported |
InsuranceCompanyNotDetected |
Cannot detect insurance company from PDF |
UnsupportedInsuranceCompany |
Insurance company is not supported |
InvalidQuoteFormat |
Quote format in PDF is invalid |
UnsupportedProductBranch |
Product branch is not supported |
NetworkError |
Network error during API request |
Timeout |
Request timeout |
AuthenticationError |
Authentication failed |
AuthorizationError |
Authorization failed |
RateLimitExceeded |
API rate limit exceeded |
ServerError |
Server error |
InvalidResponse |
Invalid response from API |
UnknownError |
Unknown error occurred |
The SDK provides comprehensive structured logging with the InsurScan prefix for easy filtering:
// Configure logging in Program.cs
builder.Logging.AddConsole();
builder.Logging.SetMinimumLevel(LogLevel.Information);
// Example log output:
// [INF] InsurScan starting PDF quote reading for ProductBranch: Kasko, InsuranceCompany: Auto, FileSize: 245760 bytes, FileName: quote.pdf
// [ERR] InsurScan PDF processing failed with error: UnsupportedInsuranceCompany for ProductBranch: Kasko
// ✅ Good - Use DI
public class QuoteService
{
private readonly IInsurScanClient _client;
public QuoteService(IInsurScanClient client) => _client = client;
}
// ❌ Bad - Don't create instances manually
var client = new InsurScanClient(/* ... */);
// ✅ Good - Use using statements
using var pdfContent = PdfContent.FromFile("quote.pdf");
var result = await client.ReadQuotePdf(PdfProductBranch.Kasko, pdfContent);
// ❌ Bad - Memory leaks
var pdfContent = PdfContent.FromFile("quote.pdf");
var result = await client.ReadQuotePdf(PdfProductBranch.Kasko, pdfContent);
// pdfContent not disposed
// ✅ Good - Comprehensive error handling
var result = await client.ReadQuotePdf(PdfProductBranch.Kasko, pdfContent);
return result switch
{
InsurScanResult<KaskoQuoteResult>.Success success => success.Data,
InsurScanResult<KaskoQuoteResult>.Failure failure => HandleError(failure.Error)
};
// ❌ Bad - Ignoring errors
var result = await client.ReadQuotePdf(PdfProductBranch.Kasko, pdfContent);
return ((InsurScanResult<KaskoQuoteResult>.Success)result).Data; // Can throw!
// ✅ Good - Support cancellation
public async Task<KaskoQuoteResult?> ProcessAsync(string filePath, CancellationToken cancellationToken)
{
using var pdfContent = PdfContent.FromFile(filePath);
var result = await _client.ReadQuotePdf(PdfProductBranch.Kasko, pdfContent, cancellationToken: cancellationToken);
// ...
}
// ✅ Good - Set reasonable timeouts based on file sizes
builder.Services.AddInsurScan(options =>
{
options.Timeout = TimeSpan.FromMinutes(2); // For large files
options.MaxFileSize = 10_000_000; // 10MB
});
IPdfContent instances to prevent memory leaksHttpClientFactory for efficient connection management"PDF file is encrypted"
"Insurance company not detected"
"Network error"
"Request timeout"
Enable debug logging to see detailed operation flow:
builder.Logging.SetMinimumLevel(LogLevel.Debug);
This project is licensed under the MIT License - see the file for details.
We welcome contributions! Please see our for details.
Made with ❤️ by InsurUp
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.34 | 84 | 6/17/2026 |
| 0.1.33 | 185 | 6/12/2026 |
| 0.1.32 | 107 | 6/10/2026 |
| 0.1.31 | 94 | 6/4/2026 |
| 0.1.30 | 100 | 6/4/2026 |
| 0.1.29 | 154 | 6/4/2026 |
| 0.1.28 | 95 | 6/3/2026 |
| 0.1.27 | 433 | 5/4/2026 |
| 0.1.26 | 142 | 3/17/2026 |
| 0.1.25 | 133 | 3/10/2026 |
| 0.1.24 | 128 | 3/9/2026 |
| 0.1.23 | 1,664 | 1/31/2026 |
| 0.1.22 | 136 | 1/15/2026 |
| 0.1.21 | 699 | 1/6/2026 |
| 0.1.20 | 140 | 1/5/2026 |
| 0.1.19 | 200 | 12/26/2025 |
| 0.1.18 | 1,273 | 12/2/2025 |
| 0.1.17 | 366 | 11/28/2025 |
| 0.1.16 | 198 | 11/28/2025 |
| 0.1.15 | 287 | 11/26/2025 |