Falco.Api
1.0.4
dotnet add package Falco.Api --version 1.0.4
NuGet\Install-Package Falco.Api -Version 1.0.4
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="Falco.Api" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Falco.Api" Version="1.0.4" />
<PackageReference Include="Falco.Api" />
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 Falco.Api --version 1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Falco.Api, 1.0.4"
#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 Falco.Api@1.0.4
#: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=Falco.Api&version=1.0.4
#tool nuget:?package=Falco.Api&version=1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
๐ README.md โ Falco.Api SDK for .NET
# Falco.Api (.NET SDK)
Falco.Api is the official .NET client library for interacting with the **Falco API**, allowing developers to import PDF and UBL documents, validate UBL against Peppol BIS 3.0 rules, and prepare for future modules such as Peppol sending, billing, document management, and more.
The SDK is designed to be:
- Easy to plug into ASP.NET Core using Dependency Injection
- Fully compatible with `IHttpClientFactory`
- Environment-aware (`Production` or `Sandbox`)
- Versioned (`v1` by default)
- Flexible (supports multiple API keys)
- Typed and testable
---
## ๐ Installation
Install via NuGet:
```bash
dotnet add package Falco.Api
Or using the Package Manager Console:
Install-Package Falco.Api
๐งญ Quick Start
1. Register the client in your Program.cs
using Falco.Api;
using Falco.Api.Extensions;
builder.Services.AddFalcoClient(options =>
{
options.Environment = FalcoEnvironment.Sandbox; // or Production
options.Version = FalcoApiVersion.V1;
options.AppSecret = builder.Configuration["Falco:AppSecret"];
// ApiKey is optional and can be overridden per request
// options.ApiKey = builder.Configuration["Falco:ApiKey"];
});
2. Inject and use FalcoClient
public class ImportService
{
private readonly FalcoClient _falco;
public ImportService(FalcoClient falco)
{
_falco = falco;
}
public async Task<DocumentImportResponse> ImportPdfAsync(byte[] pdfBytes)
{
var metadata = new PdfImportMetadata
{
DocumentType = "sale_invoice",
DocumentDate = DateOnly.FromDateTime(DateTime.Today),
Sender = new PartyMetadata
{
Name = "ACME Corp",
VatNumber = "BE0123456789",
Address = new PartyAddress
{
Line1 = "Main Street 1",
Zip = "1000",
City = "Brussels",
Country = "BE"
}
}
};
return await _falco.Imports.ImportPdfAsync(
pdfBytes,
"invoice.pdf",
metadata
);
}
}
๐ฅ Importing a PDF
var response = await falco.Imports.ImportPdfAsync(
pdfBytes,
"invoice.pdf",
new PdfImportMetadata
{
DocumentType = "sale_invoice",
DocumentDate = DateOnly.FromDateTime(DateTime.Today),
SendPeppol = true,
SendAccounting = true
}
);
Response example:
{
"document_id": "doc_123",
"peppol_status": {
"status": "submitted",
"peppol_identifier": "..."
},
"accounting_status": {
"status": "submitted"
}
}
๐ค Importing a UBL
var response = await falco.Imports.ImportUblAsync(
ublXmlBytes,
"invoice.xml",
new UblImportMetadata
{
SendPeppol = true,
SendAccounting = true
}
);
๐งช Validating a UBL
var validation = await falco.Imports.ValidateUblAsync(ublXmlBytes);
if (validation.Status == "failure")
{
foreach (var msg in validation.Messages)
{
Console.WriteLine($"{msg.Level}: {msg.Description}");
}
}
๐ Authentication Model
Every request to Falco uses:
| Header | Description |
|---|---|
X-Falco-App-Secret |
Required. Secret for your app. |
X-Falco-Api-Key |
Optional. Identifies the client. |
You can override the API key per request:
await falco.Imports.ImportPdfAsync(
pdfBytes,
"invoice.pdf",
metadata,
apiKeyOverride: clientApiKey
);
๐ Environments
The SDK automatically selects the correct API base URL:
| Environment | Base URL |
|---|---|
Production (default) |
https://api.falco-app.be/v1/ |
Sandbox |
https://sandbox.api.falco-app.be/v1/ |
Configured via:
options.Environment = FalcoEnvironment.Sandbox; // (Production by default)
๐งฉ API Versioning
The API version is included in the base URL.
options.Version = FalcoApiVersion.V1;
Future versions like V2 will be supported transparently.
โ ๏ธ Error Handling
All non-successful HTTP responses throw FalcoApiException.
try
{
await falco.Imports.ImportPdfAsync(...);
}
catch (FalcoApiException ex)
{
Console.WriteLine(ex.StatusCode);
Console.WriteLine(ex.Problem?.Detail);
}
The exception includes:
- HTTP status code
- Parsed RFC 9457
ProblemDetails - Raw response body
๐ License
MIT License ยฉ Horus Software SA
| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Microsoft.Extensions.DependencyInjection (>= 8.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Http (>= 8.0.1)
- Microsoft.Extensions.Http.Polly (>= 8.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.