SignDocsBrasil.Api 1.5.0

dotnet add package SignDocsBrasil.Api --version 1.5.0
                    
NuGet\Install-Package SignDocsBrasil.Api -Version 1.5.0
                    
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="SignDocsBrasil.Api" Version="1.5.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SignDocsBrasil.Api" Version="1.5.0" />
                    
Directory.Packages.props
<PackageReference Include="SignDocsBrasil.Api" />
                    
Project file
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 SignDocsBrasil.Api --version 1.5.0
                    
#r "nuget: SignDocsBrasil.Api, 1.5.0"
                    
#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 SignDocsBrasil.Api@1.5.0
                    
#: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=SignDocsBrasil.Api&version=1.5.0
                    
Install as a Cake Addin
#tool nuget:?package=SignDocsBrasil.Api&version=1.5.0
                    
Install as a Cake Tool

SignDocsBrasil .NET SDK

Official .NET SDK for the SignDocs Brasil electronic signature API. Provides full coverage of the SignDocs Brasil REST API with idiomatic C# and F# support, including OAuth2 authentication, automatic retries, auto-pagination, and webhook verification.

Requirements

  • .NET 8.0 or later

Installation

Install the C# SDK via NuGet:

dotnet add package SignDocsBrasil.Api

For idiomatic F# support with Result-based error handling:

dotnet add package SignDocsBrasil.FSharp

Quick Start

C#

using SignDocsBrasil.Api;
using SignDocsBrasil.Api.Models;

using var client = SignDocsBrasilClient.CreateBuilder()
    .ClientId("your-client-id")
    .ClientSecret("your-client-secret")
    .Build();

var transaction = await client.Transactions.CreateAsync(new CreateTransactionRequest
{
    Purpose = "DOCUMENT_SIGNATURE",
    Policy = new Policy { Profile = "CLICK_ONLY" },
    Signer = new Signer
    {
        Name = "João Silva",
        Email = "joao@example.com",
        Cpf = "12345678901"
    }
});

Console.WriteLine($"Transaction ID: {transaction?.TransactionId}");

F#

open SignDocsBrasil.FSharp
open SignDocsBrasil.Api.Models

let config =
    ClientConfig.defaults "your-client-id" (ClientSecret "your-client-secret")

use client = Client.create config

let result =
    client
    |> Transactions.create (CreateTransactionRequest(Purpose = "DOCUMENT_SIGNATURE"))
    |> Async.RunSynchronously

match result with
| Ok tx -> printfn "Transaction ID: %s" tx.TransactionId
| Error err ->
    match err with
    | BadRequest pd -> printfn "Bad request: %s" pd.Detail
    | RateLimit (_, retryAfter) -> printfn "Rate limited, retry after: %A" retryAfter
    | _ -> printfn "Error: %A" err

Available Resources

Resource Methods
Health CheckAsync(), HistoryAsync()
Transactions CreateAsync(), ListAsync(), GetAsync(), CancelAsync(), FinalizeAsync(), ListAutoPaginateAsync()
Documents UploadAsync(), PresignAsync(), ConfirmAsync(), DownloadAsync()
Steps ListAsync(), StartAsync(), CompleteAsync()
Signing PrepareAsync(), CompleteAsync()
Evidence GetAsync()
Verification VerifyAsync(), DownloadsAsync()
Users EnrollAsync()
Webhooks RegisterAsync(), ListAsync(), DeleteAsync(), TestAsync()
SigningSessions CreateAsync(), GetStatusAsync(), CancelAsync(), ListAsync(), WaitForCompletionAsync()
Envelopes CreateAsync(), GetAsync(), AddSessionAsync(), CombinedStampAsync()
DocumentGroups CombinedStampAsync()

Envelopes (Multi-Signer)

var envelope = await client.Envelopes.CreateAsync(new CreateEnvelopeRequest
{
    SigningMode = "PARALLEL",
    TotalSigners = 2,
    DocumentContent = pdfBase64,
    DocumentFilename = "contrato.pdf",
});

var session1 = await client.Envelopes.AddSessionAsync(envelope.EnvelopeId, new AddEnvelopeSessionRequest
{
    SignerName = "João Silva",
    SignerEmail = "joao@example.com",
    PolicyProfile = "CLICK_ONLY",
    SignerIndex = 1,
});

var session2 = await client.Envelopes.AddSessionAsync(envelope.EnvelopeId, new AddEnvelopeSessionRequest
{
    SignerName = "Maria Santos",
    SignerEmail = "maria@example.com",
    PolicyProfile = "CLICK_ONLY",
    SignerIndex = 2,
});

Console.WriteLine($"{session1.Url} {session2.Url}");

Error Handling

C#

The SDK throws typed exceptions that you can catch and handle:

using SignDocsBrasil.Api;
using SignDocsBrasil.Api.Exceptions;

try
{
    var tx = await client.Transactions.CreateAsync(request);
}
catch (SignDocsValidationException ex)
{
    Console.WriteLine($"Validation error: {ex.ProblemDetails.Detail}");
    foreach (var error in ex.ProblemDetails.Errors)
    {
        Console.WriteLine($"  {error.Field}: {error.Message}");
    }
}
catch (SignDocsRateLimitException ex)
{
    Console.WriteLine($"Rate limited. Retry after: {ex.RetryAfter}");
}
catch (SignDocsApiException ex)
{
    Console.WriteLine($"API error {ex.StatusCode}: {ex.Message}");
}

F#

The F# wrapper returns Result<'T, ApiError> instead of throwing exceptions:

let result =
    client
    |> Transactions.create request
    |> Async.RunSynchronously

match result with
| Ok tx ->
    printfn "Created: %s" tx.TransactionId
| Error err ->
    match err with
    | BadRequest pd -> printfn "Validation: %s" pd.Detail
    | NotFound -> printfn "Not found"
    | RateLimit (pd, retryAfter) -> printfn "Rate limited, retry after %A" retryAfter
    | ServerError (status, pd) -> printfn "Server error %d: %s" status pd.Detail
    | NetworkError ex -> printfn "Network error: %s" ex.Message

Pagination

C# (IAsyncEnumerable)

Use ListAutoPaginateAsync() to iterate through all pages automatically:

await foreach (var tx in client.Transactions.ListAutoPaginateAsync())
{
    Console.WriteLine($"{tx.TransactionId}: {tx.Status}");
}

Or retrieve a single page with ListAsync():

var page = await client.Transactions.ListAsync(new ListTransactionsRequest
{
    Page = 1,
    PageSize = 25
});

foreach (var tx in page.Items)
{
    Console.WriteLine($"{tx.TransactionId}: {tx.Status}");
}

F# (AsyncSeq)

let! transactions =
    client
    |> Transactions.listAutoPaginate ()
    |> AsyncSeq.toListAsync

transactions |> List.iter (fun tx ->
    printfn "%s: %s" tx.TransactionId tx.Status)

Webhook Verification

Verify incoming webhook signatures to ensure authenticity.

C#

using SignDocsBrasil.Api.Webhooks;

var verifier = new WebhookVerifier("your-webhook-secret");

bool isValid = verifier.Verify(
    payload: requestBody,
    signature: request.Headers["X-SignDocs-Signature"],
    timestamp: request.Headers["X-SignDocs-Timestamp"]
);

if (isValid)
{
    var webhookEvent = verifier.Parse(requestBody);
    Console.WriteLine($"Event: {webhookEvent.Type}");
}

F#

open SignDocsBrasil.FSharp.Webhooks

let result =
    Webhook.verify "your-webhook-secret" requestBody signature timestamp

match result with
| Ok event -> printfn "Event: %s" event.Type
| Error err -> printfn "Invalid webhook: %s" err

Advanced Configuration

Custom HttpClient

Inject your own HttpClient for custom transport settings:

var httpClient = new HttpClient(new SocketsHttpHandler
{
    PooledConnectionLifetime = TimeSpan.FromMinutes(2)
});

using var client = SignDocsBrasilClient.CreateBuilder()
    .ClientId("your-client-id")
    .ClientSecret("your-client-secret")
    .HttpClient(httpClient)
    .Build();

Logging

Integrate with Microsoft.Extensions.Logging:

using Microsoft.Extensions.Logging;

using var loggerFactory = LoggerFactory.Create(builder =>
    builder.AddConsole().SetMinimumLevel(LogLevel.Debug));

using var client = SignDocsBrasilClient.CreateBuilder()
    .ClientId("your-client-id")
    .ClientSecret("your-client-secret")
    .Logger(loggerFactory)
    .Build();

Per-Request Timeout

Override the default timeout for individual requests:

var tx = await client.Transactions.GetAsync(
    transactionId,
    options: new RequestOptions { Timeout = TimeSpan.FromSeconds(5) }
);

Scopes

Request specific OAuth2 scopes:

using var client = SignDocsBrasilClient.CreateBuilder()
    .ClientId("your-client-id")
    .ClientSecret("your-client-secret")
    .Scopes("transactions:read", "transactions:write", "documents:write")
    .Build();

Private Key JWT Authentication (ES256)

Use private_key_jwt instead of client_secret for enhanced security:

using var client = SignDocsBrasilClient.CreateBuilder()
    .ClientId("your-client-id")
    .PrivateKeyPem(File.ReadAllText("private-key.pem"))
    .Build();

License

MIT

Product 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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.5.0 100 4/27/2026
1.4.0 95 4/23/2026
1.3.0 97 4/21/2026
1.2.0 98 4/14/2026
1.1.1 95 4/8/2026
1.1.0 97 4/8/2026