Docs

C# / .NET SDK

Use dotnet add package RelayPDF in C# / .NET 8 when you want async HttpClient helpers instead of raw HTTP. Request JSON field names match REST; methods are PascalCase. The package README is the full method and error reference.

The official .NET SDK uses HttpClient and System.Text.Json. Field names in request bodies match REST. Methods are async PascalCase.

Installation

Targets net8.0. Until NuGet publish, add a project reference to sdks/dotnet/src/RelayPDF.csproj.

dotnet
dotnet add package RelayPDF

Quick start

apiKey is required. Load RELAYPDF_API_KEY from the environment.

Program.cs
using RelayPDF;

var client = new RelayPDF.RelayPDF(Environment.GetEnvironmentVariable("RELAYPDF_API_KEY")!);
var pdf = await client.Pdf.FromHtmlAsync(
    "<h1>Invoice #1042</h1><p>Total: $1,200.00</p>",
    extra: new() { ["filename"] = "invoice.pdf" }
);
pdf.Save("invoice.pdf");

Errors and webhooks

Failures throw RelayPDFException. Webhook.Verify checks RelayPDF-Signature against the raw body.

errors / webhooks
try {
    await client.Pdf.FromUrlAsync("https://example.com");
} catch (RelayPDFException err) {
    Console.WriteLine($"{err.Status} {err.Code} {err.Message} {err.RetryAfter}");
}

var ok = Webhook.Verify(
    Environment.GetEnvironmentVariable("RELAYPDF_WEBHOOK_SECRET")!,
    rawBody,
    signatureHeader
);

SDK reference

Pass extra dictionaries for REST camelCase fields. File bytes are Base64-encoded automatically.

MethodHTTPDescription
HealthAsync / AccountAsyncGET /health · /v1/accountLiveness and wallet
Pdf.FromHtmlAsync / FromUrlAsync / FromMarkdownAsync / FromTemplateAsyncPOST /v1/pdfGenerate PDF
Pdf.MergeAsync / ExtractAsync / ProtectAsync / … / FormFillAsyncPOST /v1/pdf/*PDF tools
Images / Convert / Templates / Barcodes / Zip / Jobs / Files / Webhooksmatching RESTSame surface as Node
Webhook.VerifyRelayPDF-SignatureHMAC-SHA256