getForm and submitForm do not require API credentials. Forms are identified by a UUID that you obtain from the Paubox dashboard. The form management methods require a scoped API key; see Manage forms.
Instantiation
Get a form
Retrieve a form’s metadata, field schema, and rendered HTML/CSS:stdClass includes:
getForm throws Paubox\Forms\PauboxFormsException if the form is not found or the response is invalid.
Submit a form
submitForm returns true on a successful submission (HTTP 201) and throws Paubox\Forms\PauboxFormsException on failure. The message contains the operation and HTTP status; read the body with getResponseBody().
Submitting with file attachments
The maximum total request size is 250 MB.FormAttachment fields:
Manage forms
The management methods require a scoped API key with theforms scope, passed to the constructor or set as PAUBOX_FORMS_API_KEY. It can be the same key as PAUBOX_API_KEY if that key also has the forms scope.
getFormById, listForms, createForm, updateForm, archiveForm, unarchiveForm, copyForm, getFormStats, listSubmissions, getSubmissionsCsv, getSubmissionCsv, and getSubmissionPdf. Calling one without a key throws Paubox\Forms\PauboxFormsException.
Error handling
API errors from Forms methods throwPaubox\Forms\PauboxFormsException (a network failure surfaces as Httpful’s ConnectionErrorException instead), which provides getStatusCode(), getUrl(), and getResponseBody():