# Code example guide

Learn how to use our Signature solution in just a few steps. This guide will show you how to use our solution to sign and download a document. This guide is designed to get you started quickly using the simplest use case, not to exhaustively cover everything the Signature solution can do. The back end is written in C# and the front end is written in React. The complete code example can be downloaded at the end of this guide.

See our API reference for detailed information about all the available endpoints.

# 1. Install Signicat Express SDK

The easiest way to enable signature in .NET is to use our SDK.

# Install via dotnet
dotnet add package Signicat.SDK
dotnet restore
# Or install via NuGet
PM> Install-Package Signicat.SDK

# 2. Call the backend signing process

In the front end of your application, add a button that calls a server-side endpoint to trigger the signing process.

const SignDisplay = () => (
    <h1> Welcome to Signicat Express Signature </h1>
    <div className="sign">
      <form action="/signature-session" method="POST">
        <button type="submit">
          Sign document

In the back end of your application, define an endpoint that sets the signature settings and the document to be signed. You need these values:

  • Your ClientId and ClientSecret, and the following scopes added to the OAuthScope list: DocumentWrite, DocumentRead and DocumentFile. (If you don't have an account already, you can make a free Signicat account here (opens new window))
  • Signers specifying the settings for the signers. Here you also need Redirect settings specifying where the end user will be redirected according to SuccessUrl, ErrorUrl or AbortUrl. An alternative option is iframe, which you can read more about here.
  • A Title for the signature job. ContactDetails for your company's contact information. ExternalId as a reference for your internal use.
  • DataToSign, where we put the document to be signed in the field Base64Content.
public async Task<ActionResult> Create()
    // Get local file to be signed
    var filePath = Path.Combine(_env.ContentRootPath, "letter_of_intent.pdf");
    var data = await System.IO.File.ReadAllBytesAsync(filePath);

    // Configure the signing settings
    var options = new DocumentCreateOptions()
        Title = "Sign job",

        // Set the redirect and eID-methods
        Signers = new List<SignerOptions>()
            new SignerOptions()
                RedirectSettings = new RedirectSettings()
                    RedirectMode = RedirectMode.Redirect,
                    Error = _frontendAppUrl + "?error=true",
                    Cancel = _frontendAppUrl + "?canceled=true",
                    Success = _frontendAppUrl + "?success=true"
                SignatureType = new SignatureType()
                    Mechanism = SignatureMechanism.Identification,
                    SignatureMethods = new List<SignatureMethod>()

                ExternalSignerId = Guid.NewGuid().ToString(),
        ContactDetails = new ContactDetails()
            Email = ""

        // Reference for internal use 
        ExternalId = Guid.NewGuid().ToString(),

        // Optional: Notifications for signers. See API for details
        Notification = new Notification()
            SignRequest = new SignRequest()
                Email = new List<Email>()
                    new Email()
                        Language = Language.NO,
                        Subject = "Subject text",
                        Text = "The text of the email",
                        SenderName = "Senders Name"

        // Optional: Retrieve social security number of signer(s)
        Advanced = new Advanced()
            GetSocialSecurityNumber = true,

        // The document to be signed and format
        DataToSign = new DataToSign()
            FileName = "letterOfIntent.pdf",
            Base64Content = Convert.ToBase64String(data),
            Packaging = new Packaging()
                SignaturePackageFormats = new List<SignaturePackageFormat>

    // Create document with the settings specified
    var res = await _signatureService.CreateDocumentAsync(options);

    // Redirect user to the URL retrieved from the SDK
    Response.Headers.Add("Location", res.Signers[0].Url);
    return new StatusCodeResult(303);

# 3. The end user signs the document

The end user is redirected to the Url returned in the response. The user reads the document, approves and signs with one of the supported identity methods.

Sign screen

# 4. Retrieve user data and download the signed document

After the end user has signed the document, you can fetch info about the signer such as name, national identification number and signature method in the SDK with GetDocumentSummaryAsync or with the API using Retrieve document summary (opens new window). You can download the signed document with the SDK using GetFileAsync or with the API using Retrieve file (opens new window). Downloading the signed document is coded in the pre-built code example found below.

# Download pre-built code example

The complete code example includes additional functionality, such as downloading the signed document, retrieving the personal identification number and handling the information flow to the front end. Please note that the example is built to be easy to understand and best practice is not always followed.

Or check out our GitHub page: (opens new window).

Questions, comments, or suggestions? Check out our community (opens new window).

Last updated: 10/10/2023 17:58 UTC