Request e-signatures from your C# & .NET app. Send documents to Anvil, collect legally binding signatures from any device.
using Anvil.Client;
using Anvil.Payloads.Request.Types;
class SignExample
{
static async Task Main(string[] args)
{
var apiKey = Environment.GetEnvironmentVariable("ANVIL_API_KEY");
// A sample PDF template available to any account. See
// https://www.useanvil.com/help/tutorials/set-up-a-pdf-template to
// set up your own template.
var pdfTemplateEid = "05xXsZko33JIO6aq5Pnr";
var signerName = "Testy Signer";
var signerEmail = args.Length > 0 ? args[0] : "";
var payload = new Anvil.Payloads.Request.CreateEtchPacket
{
// The packet is ready to send: an email goes to the first
// signer. Use IsDraft = true to review it in the dashboard
// first
IsDraft = false,
// Test packets use development signatures and do not count
// toward your billed packets
IsTest = true,
Name = "Test Docs - " + signerName,
SignatureEmailSubject = "Custom email subject",
SignatureEmailBody = "Custom please sign these documents....",
Files = new IEtchPacketAttachable[]
{
new EtchCastRef()
{
// Your own ID for referencing this file in Data and
// Signers below
Id = "sampleTemplate",
CastEid = pdfTemplateEid,
},
},
Signers = new EtchSigner[]
{
// Signers sign in the order they are specified
new()
{
Id = "signer1",
Name = signerName,
Email = signerEmail,
SignerType = "email",
// The fields this signer clicks through, in this order
Fields = new SignerField[]
{
new()
{
FileId = "sampleTemplate",
FieldId = "signature",
},
},
},
},
// This data fills the PDF before it is sent to any signers.
// IDs here match the fields configured on the PDF template
Data = new
{
Payloads = new
{
sampleTemplate = new
{
data = new Dictionary<string, dynamic>
{
{"name", signerName},
{"email", signerEmail},
}
},
},
},
};
var client = new GraphQLClient(apiKey);
var response = await client.CreateEtchPacket(payload);
// The response's CreateEtchPacket member is a dynamic object;
// fields use the API's camelCase names
Console.WriteLine("Visit the new packet on your dashboard: "
+ response.CreateEtchPacket["detailsURL"]);
}
}
The Anvil package is MIT-licensed and maintained in the open on GitHub.
$ dotnet add package AnvilInstall the Anvil Document SDK plugin in Claude Code and Claude will scaffold the SDK into your codebase — discovery, planning, and production-ready code.
/plugin marketplace add anvilco/anvil-plugins
/plugin install anvil-document-sdk@anvil-pluginsNo API key setup needed. The plugin connects to your Anvil account with OAuth and logs you in automatically.
Upload any PDF and watch Anvil Document AI identify input and signature fields, identify signers and connects them to fields. It's free - no signup required. Try an example below and see documentation when ready to send your own.