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

require 'paubox'

forms_client = Paubox::FormsClient.new

Get a form

Retrieve a form’s metadata, field schema, and rendered HTML/CSS:
form = forms_client.get_form('your-form-uuid')

puts form.title
puts form.form_html
The returned Paubox::Form object exposes:
Method / AttributeDescription
#titleDisplay name of the form
#form_jsonParsed field schema
#form_htmlRendered HTML for embedding
#form_cssAssociated stylesheet
#active?Whether the form is accepting submissions
#submission_countNumber of submissions received
#signable?Whether the form supports e-signatures
#deleted? / #archived?Form state flags

Submit a form

form_data = {
  first_name: 'Jane',
  last_name:  'Smith',
  email:      'jane@example.com'
}

response = forms_client.submit_form('your-form-uuid', form_data: form_data)
# response is 201 Created on success

Submitting with file attachments

The maximum total request size is 250 MB.
require 'base64'

encoded = Base64.strict_encode64(File.read('consent.pdf'))

attachments = [
  { name: 'consent.pdf', content: encoded }
]

response = forms_client.submit_form(
  'your-form-uuid',
  form_data:   form_data,
  attachments: attachments
)

Error handling

require 'rest-client'

begin
  form     = forms_client.get_form('your-form-uuid')
  response = forms_client.submit_form('your-form-uuid', form_data: form_data)
rescue RestClient::ExceptionWithResponse => e
  puts "HTTP #{e.response.code}: #{e.response.body}"
end