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

use Paubox_Forms_SDK;

my $forms = Paubox_Forms_SDK->new();

Get a form

Retrieve a form’s metadata, field schema, and rendered HTML/CSS:
my $response = $forms->getForm("your-form-uuid");
The response is a raw JSON string. Decode it to access fields:
use JSON;
my $form = decode_json($response);

print "Title: " . $form->{title} . "\n";
print "HTML: "  . $form->{form_html} . "\n";
Key fields in the response:
FieldDescription
titleDisplay name of the form
form_jsonParsed field schema
form_htmlRendered HTML for embedding
form_cssAssociated stylesheet
activeWhether the form is accepting submissions
getForm dies if the form UUID is invalid or the form is not found.

Submit a form

my $result = $forms->submitForm(
    "your-form-uuid",
    { first_name => "Jane", last_name => "Smith", email => "jane@example.com" }
);
# $result is an empty string on success (HTTP 201)
submitForm dies on failure with a message containing the HTTP status code and response body.

Submitting with file attachments

The maximum total request size is 250 MB.
use MIME::Base64;

open(my $fh, '<:raw', 'consent.pdf') or die "Cannot open file: $!";
local $/;
my $encoded = encode_base64(<$fh>);
close($fh);

my $result = $forms->submitForm(
    "your-form-uuid",
    { first_name => "Jane" },
    [ { name => "consent.pdf", content => $encoded } ]
);
Each attachment in the arrayref is a hashref with two keys:
KeyDescription
nameFile name including extension
contentBase64-encoded file content

Error handling

Wrap calls in eval to catch failures:
eval {
    my $form   = $forms->getForm("your-form-uuid");
    my $result = $forms->submitForm("your-form-uuid", \%formData);
};
if ($@) {
    print "Error: $@\n";
}