{"openapi":"3.1.0","info":{"title":"ProfileScribe Mail Operations","version":"1.0.0","description":"Scoped reports, explicit address verification and draft preparation from saved briefs. These endpoints do not approve, print or send mail. Business results remain in the native CRM."},"servers":[{"url":"https://profilescribe.com/api/agent/v1"}],"security":[{"agentToken":[]}],"components":{"securitySchemes":{"agentToken":{"type":"http","scheme":"bearer","description":"Revocable workspace agent token with the operation's explicit read:mail or write:mail permission."}}},"paths":{"/mail/report":{"get":{"operationId":"readMailReport","summary":"Read operational counts and bounded metadata","x-required-scopes":["read:mail"],"parameters":[{"name":"campaignId","in":"query","schema":{"type":"string","maxLength":200}},{"name":"status","in":"query","schema":{"type":"string","enum":["draft","queued","print_queued","sent","submitted","failed","unknown"]}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":500,"default":100}},{"name":"format","in":"query","schema":{"type":"string","enum":["json","csv"],"default":"json"}}],"responses":{"200":{"description":"Totals cover all matching items; CSV rejects truncated exports and omits recipient information.","content":{"application/json":{"schema":{"type":"object","required":["version","asOf","total","returned","truncated","summary","items","limitations"],"properties":{"version":{"const":1},"asOf":{"type":"string","format":"date-time"},"total":{"type":"integer","minimum":0},"returned":{"type":"integer","minimum":0},"truncated":{"type":"integer","minimum":0},"summary":{"type":"object"},"items":{"type":"array","maxItems":500,"items":{"type":"object"}},"limitations":{"type":"array","items":{"type":"string"}}}}},"text/csv":{"schema":{"type":"string"}}}},"400":{"description":"Invalid or ambiguous filter","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Invalid or revoked token","content":{"application/json":{"schema":{"type":"object"}}}},"403":{"description":"Missing read:mail permission","content":{"application/json":{"schema":{"type":"object"}}}},"413":{"description":"CSV exceeds the item limit; narrow the filters","content":{"application/json":{"schema":{"type":"object"}}}},"500":{"description":"Report unavailable; never substitute an empty report","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/mail/address-verifications/{requestId}":{"get":{"operationId":"readAddressVerification","summary":"Inspect the original lookup without dispatching a provider call","x-required-scopes":["read:mail"],"parameters":[{"name":"requestId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-zA-Z0-9_-]{8,100}$"}}],"responses":{"200":{"description":"requestId, state, optional completed verification and automaticRetry=false","content":{"application/json":{"schema":{"type":"object"}}}},"403":{"description":"Missing read:mail permission","content":{"application/json":{"schema":{"type":"object"}}}},"503":{"description":"Receipt unavailable","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/mail/verify-address":{"post":{"operationId":"verifyMailAddress","summary":"Perform one explicitly requested address-only lookup","x-required-scopes":["write:mail"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["requestId","address","postalVerification"],"properties":{"requestId":{"type":"string","pattern":"^[a-zA-Z0-9_-]{8,100}$"},"address":{"type":"object","additionalProperties":false,"required":["name","addressLine1","addressCity","addressState","addressZip","addressCountry"],"properties":{"name":{"type":"string"},"title":{"type":"string"},"company":{"type":"string"},"addressLine1":{"type":"string"},"addressLine2":{"type":"string"},"addressCity":{"type":"string"},"addressState":{"type":"string"},"addressZip":{"type":"string"},"addressCountry":{"type":"string","enum":["US"]}}},"postalVerification":{"const":true}}}}}},"responses":{"200":{"description":"Exact input, proposed address, live/test marker, status, retrieval time and content hash; identical completed retries reuse the receipt","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid address or request ID","content":{"application/json":{"schema":{"type":"object"}}}},"403":{"description":"Missing write:mail or active mail access","content":{"application/json":{"schema":{"type":"object"}}}},"409":{"description":"Changed, pending or uncertain original request; no automatic redispatch","content":{"application/json":{"schema":{"type":"object"}}}},"429":{"description":"Monthly lookup allowance exhausted","content":{"application/json":{"schema":{"type":"object"}}}},"502":{"description":"Safe provider diagnosis; retain the original request ID","content":{"application/json":{"schema":{"type":"object"}}}},"503":{"description":"Provider configuration or receipt storage unavailable","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/mail/drafts/from-brief":{"post":{"operationId":"prepareMailFromBrief","summary":"Prepare one new draft using a saved revision's instructions","x-required-scopes":["write:mail"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["requestId","sourceDraftId","sourceRevision","to"],"properties":{"requestId":{"type":"string","pattern":"^[a-zA-Z0-9_-]{8,100}$"},"sourceDraftId":{"type":"string","maxLength":100},"sourceRevision":{"type":"string","maxLength":128},"to":{"type":"object","additionalProperties":false,"required":["name"],"properties":{"name":{"type":"string"},"title":{"type":"string"},"company":{"type":"string"},"addressLine1":{"type":"string"},"addressLine2":{"type":"string"},"addressCity":{"type":"string"},"addressState":{"type":"string"},"addressZip":{"type":"string"},"addressCountry":{"type":"string","enum":["US"]}}},"artPreference":{"type":"string","enum":["auto","image","vector","none"]},"proofReviewOnly":{"type":"boolean"},"retryUnfinished":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Original accepted preparation on an identical retry","content":{"application/json":{"schema":{"type":"object"}}}},"201":{"description":"Saved draft using normal evidence, metering, request claims and independent proof review","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object"}}}},"403":{"description":"Missing write:mail or active mail access","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"description":"Source draft is outside this workspace","content":{"application/json":{"schema":{"type":"object"}}}},"409":{"description":"Source revision or frozen preparation changed; inspect original work","content":{"application/json":{"schema":{"type":"object"}}}},"502":{"description":"Generation or review incomplete; retain the original request and accepted artifacts","content":{"application/json":{"schema":{"type":"object"}}}}}}}}}