Skip to main content

Developer guide

Connect your mailing workflow.

Read operational reports, review mailing address structure, 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 address review 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. Draft generation and address review 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.

Review address structure

Post the complete U.S. address to /api/agent/v1/mail/verify-address. ProfileScribe checks required fields and formatting for print review. The response marks postal deliverability as unverified.

Read /api/agent/v1/mail/address-verifications/:requestId to retrieve an existing lookup receipt.

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

ToolPermissionResult
read_mail_reportread:mailOperational counts and bounded metadata
create_mail_draft_from_briefwrite:mailOne 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.
  • 410 on a postal lookup: external postal verification has been retired.
  • provider_payment_required: the provider requires billing attention; it does not establish that its balance is zero.

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.