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
Standalone (creates its own HTTP connection pool):
use paubox::FormsClient;
let client = FormsClient::new();
Shared connection pool (reuses the HTTP client from an existing PauboxClient):
let forms = email_client.forms();
Retrieve a form’s metadata, field schema, and rendered HTML/CSS:
let form = client.get_form("your-form-uuid").await?;
println!("Title: {}", form.title);
if let Some(html) = &form.form_html {
println!("HTML: {}", html);
}
Form fields:
| Field | Type | Description |
|---|
title | String | Display name of the form |
form_json | Option<serde_json::Value> | Parsed field schema |
form_html | Option<String> | Rendered HTML for embedding |
form_css | Option<String> | Associated stylesheet |
active | bool | Whether the form is accepting submissions |
submission_count | u64 | Number of submissions received |
Build a FormSubmission and call submit_form:
use paubox::FormSubmission;
use serde_json::json;
let submission = FormSubmission::builder()
.form_data(json!({
"first_name": "Jane",
"last_name": "Smith",
"email": "jane@example.com"
}))
.build()?;
client.submit_form("your-form-uuid", &submission).await?;
submit_form returns Ok(()) on success (HTTP 201).
Submitting with file attachments
The maximum total request size is 250 MB. FormAttachment::from_bytes base64-encodes automatically:
use paubox::{FormAttachment, FormSubmission};
use std::fs;
let data = fs::read("consent.pdf")?;
let attachment = FormAttachment::from_bytes("consent.pdf", &data);
let submission = FormSubmission::builder()
.form_data(json!({ "first_name": "Jane" }))
.attachment(attachment)
.build()?;
client.submit_form("your-form-uuid", &submission).await?;
If you already have base64-encoded content:
let attachment = FormAttachment::from_base64("consent.pdf", encoded_string);
Error handling
use paubox::PauboxError;
match client.get_form("your-form-uuid").await {
Ok(form) => println!("Form: {}", form.title),
Err(PauboxError::Http { status, body }) => {
eprintln!("HTTP {}: {}", status, body);
}
Err(e) => eprintln!("Error: {}", e),
}