Developer guide
Connect your mailing workflow.
Read operational reports, request an explicit postal address check, and prepare a new draft from a saved campaign brief. ProfileScribe keeps evidence, account limits, revisions and approval checks in the same path.
Authentication and permissions
Create a revocable agent token in Your agent. Grant read:mail for reports or write:mail for verification and preparation. Add mcp:tools when using MCP at https://profilescribe.com/api/mcp. Keep the token on your server; never embed it in a public website.
Token authority is limited to its workspace. Preparing a draft does not approve printing or mailing. New generation and postal checks require active mail access; inspecting existing reports remains available after membership ends.
Read a report
curl "https://profilescribe.com/api/agent/v1/mail/report?limit=100" -H "Authorization: Bearer $PROFILESCRIBE_AGENT_TOKEN"Filter by campaignId or status. JSON returns total, returned and truncated; summary counts cover the complete filtered set. Request up to 500 rows. Use format=csv for a spreadsheet export; a CSV that would omit rows returns 413 so you can narrow its filters.
Reports omit recipient names, addresses, messages and artwork. Confirmed physical mailing, historical provider acceptance and test submission have separate counters. Recorded reviews are descriptive; final approval still validates the current artifact. Replies, meetings and paid outcomes live in CRM.
Request a postal check
Post requestId, the complete saved US business address, and postalVerification: true to /api/agent/v1/mail/verify-address. The optional provider must be configured by the operator. Each new request reserves one lookup before dispatch, within workspace and global monthly limits.
Read /api/agent/v1/mail/address-verifications/:requestId to inspect the original receipt. Reuse the same ID and input after an uncertain response. Completed requests return their saved receipt; pending or uncertain requests return 409 without another provider call. Test mode proves no live deliverability. A correction is a proposal: updating a CRM contact or the printed draft remains an explicit operation with fresh proof checks.
Prepare a draft from a permissioned event
Your authenticated server can post this shape to /api/agent/v1/mail/drafts/from-brief after an event whose scope permits preparation for that exact recipient. Read the source draft and its revision first using read_mail_drafts. Use one stable request ID per event and preserve the full request for recovery.
{
"requestId": "crm-event-example-001",
"sourceDraftId": "mail-your-saved-draft",
"sourceRevision": "your-current-source-revision",
"to": { "name": "Alex Example" },
"artPreference": "none"
}Only the source instructions and format are reused. The normal LLM drafting path resolves the current sender and evidence again; old recipient facts, finished copy, artwork, CRM links, proofs and mailing authority are not copied. A recipient name is enough to save a draft; a complete business address is required later for mailing.
This supports draft preparation from your permissioned CRM or website events. It does not identify anonymous visitors, infer sensitive traits, schedule outreach or send follow-ups. Native CRM outbound webhooks can notify your server; configure their existing signature and retry contract in CRM.
Use the same operations through MCP
| Tool | Permission | Result |
|---|---|---|
| read_mail_report | read:mail | Operational counts and bounded metadata |
| verify_mail_address | write:mail | One explicit address-only lookup and saved receipt |
| create_mail_draft_from_brief | write:mail | One new draft under the ordinary generation gates |
Reconnect the client after deployment to refresh its catalog. For draft generation, read_mail_preparation accepts the original client request ID. Resume only the recovery step the receipt permits; accepted copy and artwork remain saved.
Diagnose a failure
- 401 or 403: check token expiry, revocation, workspace permission and active mail access.
- 409: inspect the original request or current revision. Do not invent a replacement request to bypass the conflict.
- 413 on export: filter by campaign or status and request at most 500 rows.
- 429 on postal verification: the configured lookup allowance has been reached.
provider_payment_required: the provider requires billing attention; it does not establish that its balance is zero.response_uncertainor a provider/storage failure: retain the original request ID and inspect its receipt before requesting another lookup.
For support, retain the request ID, time, operation and safe error code. Keep tokens, recipient details, provider response bodies and artwork out of public issue reports.