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.
Creating a client
fc, err := paubox.NewFormsClient()
if err != nil {
log.Fatal(err)
}
Optional configuration is available via FormsOption values:
| Option | Description |
|---|
paubox.WithFormsBaseURL(url) | Override the Forms API base URL |
paubox.WithFormsHTTPClient(c) | Supply a custom *http.Client |
paubox.WithFormsTimeout(d) | Set a per-request timeout |
paubox.WithFormsRetry(cfg) | Configure retry behavior |
paubox.WithFormsUserAgent(s) | Append to the User-Agent header |
Retrieve a form’s metadata, field schema, and rendered HTML/CSS:
ctx := context.Background()
form, err := fc.GetForm(ctx, "your-form-uuid")
if err != nil {
log.Fatal(err)
}
fmt.Println("Form:", form.Title)
for _, field := range form.FormJSON.Body {
fmt.Printf(" [%s] id=%s label=%s\n", field.Type, field.ID, field.Label)
}
The Form struct includes:
| Field | Description |
|---|
Title | Display name of the form |
FormJSON | Parsed field schema (FormJSON.Body is []FormField) |
HTML | Rendered HTML for embedding |
CSS | Associated stylesheet |
_, err = fc.SubmitForm(ctx, "your-form-uuid", paubox.FormSubmission{
FormData: map[string]any{
"name": "Jane Smith",
"email": "jane@example.com",
"dob": "1990-01-15",
},
})
if err != nil {
log.Fatal(err)
}
Submitting with file attachments
Attach files by base64-encoding their content:
import (
"encoding/base64"
"os"
)
fileBytes, err := os.ReadFile("consent.pdf")
if err != nil {
log.Fatal(err)
}
_, err = fc.SubmitForm(ctx, "your-form-uuid", paubox.FormSubmission{
FormData: map[string]any{
"name": "Jane Smith",
},
Attachments: []paubox.FormAttachment{
{
Name: "consent.pdf",
Content: base64.StdEncoding.EncodeToString(fileBytes),
},
},
})
The FormAttachment struct:
| Field | Type | Description |
|---|
Name | string | File name including extension |
Content | string | Base64-encoded file content |