Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.paubox.com/llms.txt

Use this file to discover all available pages before exploring further.

The Forms client does not require API credentials. Forms are identified by a UUID that you obtain from the Paubox dashboard.

Instantiation

var formsLib = new FormsLibrary();
Use IFormsLibrary for dependency injection in ASP.NET Core:
builder.Services.AddSingleton<IFormsLibrary, FormsLibrary>();

Get a form

Retrieve a form’s metadata, field schema, and rendered HTML/CSS:
Form form = formsLib.GetForm("your-form-uuid");

Console.WriteLine("Title: " + form.Title);
Console.WriteLine("HTML: "  + form.FormHtml);
The Form object includes:
PropertyDescription
TitleDisplay name of the form
FormJsonParsed field schema
FormHtmlRendered HTML for embedding
FormCssAssociated stylesheet
ActiveWhether the form is accepting submissions
SubmissionCountNumber of submissions received
CreatedAt / UpdatedAtTimestamps

Submit a form

var formData = new Dictionary<string, object>
{
    { "first_name", "Jane" },
    { "last_name",  "Smith" },
    { "email",      "jane@example.com" }
};

formsLib.SubmitForm("your-form-uuid", formData);
SubmitForm returns void on success and throws on failure.

Submitting with file attachments

The maximum total request size is 250 MB.
byte[] fileBytes = File.ReadAllBytes("consent.pdf");

var attachments = new[]
{
    new FormAttachment
    {
        Name    = "consent.pdf",
        Content = Convert.ToBase64String(fileBytes)
    }
};

formsLib.SubmitForm("your-form-uuid", formData, attachments);
The FormAttachment properties:
PropertyDescription
NameFile name including extension
ContentBase64-encoded file content

Error handling

try
{
    Form form = formsLib.GetForm("your-form-uuid");
    formsLib.SubmitForm("your-form-uuid", formData);
}
catch (ArgumentException ex)
{
    // Null or empty formId / formData
    Console.WriteLine("Invalid argument: " + ex.Message);
}
catch (SystemException ex)
{
    // API error (404 form not found, 400 bad request, etc.)
    Console.WriteLine("API error: " + ex.Message);
}