DocSpring.Client 4.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package DocSpring.Client --version 4.0.0
                    
NuGet\Install-Package DocSpring.Client -Version 4.0.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="DocSpring.Client" Version="4.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DocSpring.Client" Version="4.0.0" />
                    
Directory.Packages.props
<PackageReference Include="DocSpring.Client" />
                    
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 DocSpring.Client --version 4.0.0
                    
#r "nuget: DocSpring.Client, 4.0.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 DocSpring.Client@4.0.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=DocSpring.Client&version=4.0.0
                    
Install as a Cake Addin
#tool nuget:?package=DocSpring.Client&version=4.0.0
                    
Install as a Cake Tool

DocSpring C# SDK

The official C# client for the DocSpring API. DocSpring fills PDF templates with your data, generates PDFs from HTML templates, combines PDFs and collects e-signatures.

Documentation · API reference · NuGet · Changelog

The code in this repository is generated from DocSpring's OpenAPI spec (About this SDK). Issues and pull requests are welcome.

Version 4.0.0. Requires .NET Standard 2.0 (.NET 6 or later, or .NET Framework 4.6.2 or later).

Install and configure

Install from NuGet:

Package Manager

PM> Install-Package DocSpring.Client

.NET CLI

dotnet add package DocSpring.Client

Paket CLI

paket add DocSpring.Client

Configure authentication via environment variables:

export DOCSPRING_TOKEN_ID="API_TOKEN_ID"
export DOCSPRING_TOKEN_SECRET="API_TOKEN_SECRET"

You can also configure the region or host. The host takes priority over the region:

export DOCSPRING_REGION="US" # US or EU (defaults to US)
export DOCSPRING_HOST="docspring.yourcompany.com" # For on-premise deployments

Initialize the client:

var api = DocSpring.Client.Client.EnvClientFactory.NewClient();

Or provide credentials directly:

var api = DocSpring.Client.Client.EnvClientFactory.NewClient("API_TOKEN_ID", "API_TOKEN_SECRET");

Generate a PDF

Fill a template with data (use your template's ID in place of tpl_1234567890abcdef01):

var templateId = "tpl_1234567890abcdef01";
var body = new DocSpring.Client.Model.CreateSubmissionRequest() {
  Data = new Dictionary<string, object> {
    { "first_name", "John" },
    { "last_name", "Smith" },
    { "phone_number", "+11234567890" }
  },
  Metadata = new Dictionary<string, object> {
    { "user_id", 42 }
  },
  Test = true
};

var response = await api.CreateSubmissionAsync(templateId, body: body);
var result = response.Created();
Console.WriteLine(result);

By default the call waits for the PDF, for up to 95 seconds, and the submission in the response has a link to download it (files.pdf.download_url). Set wait to false to get a pending submission straight away. Sync vs. async processing covers the time limit, status checks and webhooks.

Methods

docs/apis/Client.md has each method's parameters and return type, and docs/models/ has the models. The API reference has C# code for every method.

Method Description
CopyTemplate Copy a template
CreateCombinedPdf Combine PDFs
CreateCustomFileFromUpload Create a custom file from an upload
CreateFolder Create a folder
CreateSignatureRequestEvent Record a signature request event
CreateSignatureRequestToken Create a signature request token
CreateSubmission Generate a PDF
CreateSubmissionBatch Generate PDFs in a batch
CreateTemplate Create a template
CreateWebhook Create a webhook
DeleteCustomFile Delete a custom file
DeleteFolder Delete a folder
DeleteTemplate Delete a template
DeleteWebhook Delete a webhook
ExpireCombinedPdf Expire a combined PDF
ExpireSubmission Expire a submission
GenerateSubmissionPreview Generate a preview PDF
GetCombinedPdf Get a combined PDF
GetCustomFile Get a custom file
GetFolder Get a folder
GetPresignUrl Get a presigned URL to upload a file
GetSignatureRequest Get a signature request
GetSubmission Get a submission
GetSubmissionBatch Get a batch
GetTemplate Get a template
GetTemplateModelCode Generate typed code for a template's submission data
GetTemplateSchema Get the JSON Schema of a template's submission data
GetWebhook Get a webhook
ListCombinedPdfs List combined PDFs
ListCustomFiles List custom files
ListFolders List folders
ListSubmissions List submissions
ListTemplates List templates
ListTemplateSubmissions List a template's submissions
ListWebhooks List webhooks
MoveFolder Move a folder
MoveTemplate Move a template to a folder
PublishTemplateVersion Publish a template version
RenameFolder Rename a folder
RestoreTemplateVersion Restore a template version
TestAuthentication Test authentication
UpdateSignatureRequest Update a signature request
UpdateTemplate Update a template
UpdateTemplateDocument Replace a template's PDF
UpdateWebhook Update a webhook
UploadTemplate Create a PDF template from an uploaded PDF
UploadTemplateDocument Replace a template's PDF with an uploaded PDF

Errors

Methods return a response object rather than throwing for an error status. IsCreated, IsUnprocessableContent and the other Is... properties say which documented response came back, and Created() or TryCreated(out var result) give you its body.

The client checks each request against the API's request schemas before sending it. A request the API would reject throws a DocSpring.Client.Client.ValidationException (an ArgumentException), whose Details are ErrorDetails with a Code, a Message and a Pointer into the body (or a Parameter). Turn the check off with client.ValidateRequests = false. The details are the ones the API's 422 response would have, so you get them without a round trip.

API changes

DocSpring adds fields and enum values to API v2 without releasing a new API version. Changes that would break existing code, such as removing or renaming a field, go in a new API version (API changes). So this SDK keeps working with responses that are newer than it is:

  • The model leaves out a response field added to the API after this release (models have an AdditionalProperties dictionary, but the generated JSON converters don't fill it).
  • Enum values in responses are strings, so a value added to the API after this release comes back as it is: handle values you don't recognize.

Upgrade the SDK to read new fields and enum values. The changelog lists what each release adds.

About this SDK

This SDK is generated from DocSpring's OpenAPI spec with DocSpring's fork of OpenAPI Generator 7.26.0. The fork changes the C# generator:

  • Enum types are readonly structs rather than C# enums, so an enum value added to the API after this release comes back as the API sent it (ToString()), with IsKnown false. The static properties are the values this release knows, and Values lists them.
  • Nullable and optional enums write null, or leave the property out, without throwing.
  • Model constructors assign required properties, and optional object and list properties serialize their value rather than the Option<T> wrapper.
  • A union whose discriminator has several values for one model (TemplateFieldDependencyConditionInput) compiles.

On top of the generated code, we add:

  • A client constructor that reads your credentials, region and host from the environment.
  • DocSpring.Sdk.NewClient(...) and DocSpring.Sdk.NewClientFromEnv(), which build a client without a .NET host builder.

Each release regenerates every file, so a change made only here would be lost in the next one. Issues and pull requests are welcome all the same: open an issue or a pull request, or email support@docspring.com, and we'll make the fix in the generator so that every release keeps it. AGENTS.md is a guide for AI coding agents that integrate this SDK.

License

MIT. See LICENSE.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
4.4.0 101 11/1/2026
4.3.0 95 10/31/2026
4.2.0 100 10/28/2026
4.1.0 98 10/26/2026
4.0.0 95 10/26/2026
3.5.0 112 10/18/2026
3.4.0 128 10/18/2026
3.3.0 106 10/15/2026
3.2.0 357 9/23/2025
3.1.0 801 3/22/2025
3.0.1 213 2/26/2025
3.0.0 215 2/22/2025
2.0.0 206 1/30/2025
1.4.3 777 11/27/2021
1.4.2 489 11/27/2021
1.4.1 2,663 11/18/2020
1.4.0 836 9/26/2020
1.3.1 707 9/23/2020
1.3.0 676 9/21/2020
1.2.0 646 9/12/2020
Loading failed