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 service does not require API credentials. Forms are identified by a UUID that you obtain from the Paubox dashboard.

Create the service

const pbMail       = require('paubox-node');
const formsService = pbMail.formService();

Get a form

Retrieve a form’s metadata, field schema, and rendered HTML/CSS:
const form = await formsService.getForm('your-form-uuid');

console.log('Title:', form.title);
console.log('HTML:',  form.form_html);
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
submission_countNumber of submissions received
The Promise rejects with a 404 error if the form UUID is invalid.

Submit a form

await formsService.submitForm('your-form-uuid', {
  first_name: 'Jane',
  last_name:  'Smith',
  email:      'jane@example.com'
});
// Resolves to null on success (HTTP 201)

Submitting with file attachments

The maximum total request size is 250 MB.
const fs = require('fs');

const attachments = [
  {
    name:    'consent.pdf',
    content: fs.readFileSync('consent.pdf').toString('base64')
  }
];

await formsService.submitForm(
  'your-form-uuid',
  { first_name: 'Jane' },
  attachments
);
Each attachment is an object with two fields:
FieldDescription
nameFile name including extension
contentBase64-encoded file content

Error handling

try {
  const form = await formsService.getForm('your-form-uuid');
  await formsService.submitForm('your-form-uuid', formData);
} catch (err) {
  console.error('Forms error:', err.message);
}
The Promise rejects on HTTP 400 (bad request) and 404 (form not found).