@primitivedotdev/sdk 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,12 @@
1
- import { AuthConfidence$1 as AuthConfidence, AuthVerdict$1 as AuthVerdict, DkimResult$1 as DkimResult, DkimSignature, DmarcPolicy$1 as DmarcPolicy, DmarcResult$1 as DmarcResult, EmailAddress, EmailAnalysis, EmailAuth, EmailReceivedEvent, EventType$1 as EventType, ForwardAnalysis, ForwardOriginalSender, ForwardResult, ForwardResultAttachmentAnalyzed, ForwardResultAttachmentSkipped, ForwardResultInline, ForwardVerdict$1 as ForwardVerdict, ForwardVerification, KnownWebhookEvent, ParsedData, ParsedDataComplete, ParsedDataFailed, ParsedError, ParsedStatus$1 as ParsedStatus, RawContent, RawContentDownloadOnly, RawContentInline, SpfResult$1 as SpfResult, UnknownEvent, ValidateEmailAuthResult, WebhookAttachment, WebhookEvent } from "./types-CKFmgitP.js";
2
- import { DecodeRawEmailOptions, GenerateDownloadTokenOptions, HandleWebhookOptions, LEGACY_CONFIRMED_HEADER$1 as LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER$1 as LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS$1 as PAYLOAD_ERRORS, PRIMITIVE_CONFIRMED_HEADER$1 as PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER$1 as PRIMITIVE_SIGNATURE_HEADER, PrimitiveWebhookError$1 as PrimitiveWebhookError, RAW_EMAIL_ERRORS$1 as RAW_EMAIL_ERRORS, RawEmailDecodeError$1 as RawEmailDecodeError, RawEmailDecodeErrorCode, STANDARD_WEBHOOK_ID_HEADER$1 as STANDARD_WEBHOOK_ID_HEADER, STANDARD_WEBHOOK_SIGNATURE_HEADER$1 as STANDARD_WEBHOOK_SIGNATURE_HEADER, STANDARD_WEBHOOK_TIMESTAMP_HEADER$1 as STANDARD_WEBHOOK_TIMESTAMP_HEADER, SignResult, StandardWebhooksSignResult, StandardWebhooksVerifyOptions, VERIFICATION_ERRORS$1 as VERIFICATION_ERRORS, VerifyDownloadTokenOptions, VerifyDownloadTokenResult, VerifyOptions, WEBHOOK_VERSION$1 as WEBHOOK_VERSION, WebhookErrorCode, WebhookHeaders, WebhookPayloadError$1 as WebhookPayloadError, WebhookPayloadErrorCode, WebhookValidationError$1 as WebhookValidationError, WebhookValidationErrorCode, WebhookVerificationError$1 as WebhookVerificationError, WebhookVerificationErrorCode, confirmedHeaders$1 as confirmedHeaders, decodeRawEmail$1 as decodeRawEmail, emailReceivedEventJsonSchema$1 as emailReceivedEventJsonSchema, generateDownloadToken$1 as generateDownloadToken, getDownloadTimeRemaining$1 as getDownloadTimeRemaining, handleWebhook$1 as handleWebhook, isDownloadExpired$1 as isDownloadExpired, isEmailReceivedEvent$1 as isEmailReceivedEvent, isRawIncluded$1 as isRawIncluded, parseWebhookEvent$1 as parseWebhookEvent, safeValidateEmailReceivedEvent$1 as safeValidateEmailReceivedEvent, signStandardWebhooksPayload$1 as signStandardWebhooksPayload, signWebhookPayload$1 as signWebhookPayload, validateEmailAuth$1 as validateEmailAuth, validateEmailReceivedEvent$1 as validateEmailReceivedEvent, verifyDownloadToken$1 as verifyDownloadToken, verifyRawEmailDownload$1 as verifyRawEmailDownload, verifyStandardWebhooksSignature$1 as verifyStandardWebhooksSignature, verifyWebhookSignature$1 as verifyWebhookSignature } from "./index-DLmAI4UQ.js";
3
- export { AuthConfidence, AuthVerdict, DecodeRawEmailOptions, DkimResult, DkimSignature, DmarcPolicy, DmarcResult, EmailAddress, EmailAnalysis, EmailAuth, EmailReceivedEvent, EventType, ForwardAnalysis, ForwardOriginalSender, ForwardResult, ForwardResultAttachmentAnalyzed, ForwardResultAttachmentSkipped, ForwardResultInline, ForwardVerdict, ForwardVerification, GenerateDownloadTokenOptions, HandleWebhookOptions, KnownWebhookEvent, LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS, PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER, ParsedData, ParsedDataComplete, ParsedDataFailed, ParsedError, ParsedStatus, PrimitiveWebhookError, RAW_EMAIL_ERRORS, RawContent, RawContentDownloadOnly, RawContentInline, RawEmailDecodeError, RawEmailDecodeErrorCode, STANDARD_WEBHOOK_ID_HEADER, STANDARD_WEBHOOK_SIGNATURE_HEADER, STANDARD_WEBHOOK_TIMESTAMP_HEADER, SignResult, SpfResult, StandardWebhooksSignResult, StandardWebhooksVerifyOptions, UnknownEvent, VERIFICATION_ERRORS, ValidateEmailAuthResult, VerifyDownloadTokenOptions, VerifyDownloadTokenResult, VerifyOptions, WEBHOOK_VERSION, WebhookAttachment, WebhookErrorCode, WebhookEvent, WebhookHeaders, WebhookPayloadError, WebhookPayloadErrorCode, WebhookValidationError, WebhookValidationErrorCode, WebhookVerificationError, WebhookVerificationErrorCode, confirmedHeaders, decodeRawEmail, emailReceivedEventJsonSchema, generateDownloadToken, getDownloadTimeRemaining, handleWebhook, isDownloadExpired, isEmailReceivedEvent, isRawIncluded, parseWebhookEvent, safeValidateEmailReceivedEvent, signStandardWebhooksPayload, signWebhookPayload, validateEmailAuth, validateEmailReceivedEvent, verifyDownloadToken, verifyRawEmailDownload, verifyStandardWebhooksSignature, verifyWebhookSignature };
1
+ import { AuthConfidence$1 as AuthConfidence, AuthVerdict$1 as AuthVerdict, DkimResult$1 as DkimResult, DkimSignature, DmarcPolicy$1 as DmarcPolicy, DmarcResult$1 as DmarcResult, EmailAddress, EmailAnalysis, EmailAuth, EmailReceivedEvent, EventType$1 as EventType, ForwardAnalysis, ForwardOriginalSender, ForwardResult, ForwardResultAttachmentAnalyzed, ForwardResultAttachmentSkipped, ForwardResultInline, ForwardVerdict$1 as ForwardVerdict, ForwardVerification, KnownWebhookEvent, ParsedData, ParsedDataComplete, ParsedDataFailed, ParsedError, ParsedStatus$1 as ParsedStatus, RawContent, RawContentDownloadOnly, RawContentInline, SpfResult$1 as SpfResult, UnknownEvent, ValidateEmailAuthResult, WebhookAttachment, WebhookEvent } from "./types-CIOzt1FY.js";
2
+ import { ReceivedEmail, ReceivedEmailAddress, ReceivedEmailThread, buildForwardSubject$1 as buildForwardSubject, buildReplySubject$1 as buildReplySubject, formatAddress$1 as formatAddress, normalizeReceivedEmail$1 as normalizeReceivedEmail, parseHeaderAddress$1 as parseHeaderAddress } from "./received-email-C67Z7Dha.js";
3
+ import { ForwardInput, PrimitiveApiError$1 as PrimitiveApiError, PrimitiveClient$1 as PrimitiveClient, PrimitiveClientOptions, ReplyInput, SendInput, SendResult, SendThreadInput, client$1 as client, createPrimitiveClient$1 as createPrimitiveClient } from "./index-D9lanVFt.js";
4
+ import { DecodeRawEmailOptions, GenerateDownloadTokenOptions, HandleWebhookOptions, LEGACY_CONFIRMED_HEADER$1 as LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER$1 as LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS$1 as PAYLOAD_ERRORS, PRIMITIVE_CONFIRMED_HEADER$1 as PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER$1 as PRIMITIVE_SIGNATURE_HEADER, PrimitiveWebhookError$1 as PrimitiveWebhookError, RAW_EMAIL_ERRORS$1 as RAW_EMAIL_ERRORS, RawEmailDecodeError$1 as RawEmailDecodeError, RawEmailDecodeErrorCode, ReceiveRequestOptions, STANDARD_WEBHOOK_ID_HEADER$1 as STANDARD_WEBHOOK_ID_HEADER, STANDARD_WEBHOOK_SIGNATURE_HEADER$1 as STANDARD_WEBHOOK_SIGNATURE_HEADER, STANDARD_WEBHOOK_TIMESTAMP_HEADER$1 as STANDARD_WEBHOOK_TIMESTAMP_HEADER, SignResult, StandardWebhooksSignResult, StandardWebhooksVerifyOptions, VERIFICATION_ERRORS$1 as VERIFICATION_ERRORS, VerifyDownloadTokenOptions, VerifyDownloadTokenResult, VerifyOptions, WEBHOOK_VERSION$1 as WEBHOOK_VERSION, WebhookErrorCode, WebhookHeaders, WebhookPayloadError$1 as WebhookPayloadError, WebhookPayloadErrorCode, WebhookValidationError$1 as WebhookValidationError, WebhookValidationErrorCode, WebhookVerificationError$1 as WebhookVerificationError, WebhookVerificationErrorCode, confirmedHeaders$1 as confirmedHeaders, decodeRawEmail$1 as decodeRawEmail, emailReceivedEventJsonSchema$1 as emailReceivedEventJsonSchema, generateDownloadToken$1 as generateDownloadToken, getDownloadTimeRemaining$1 as getDownloadTimeRemaining, handleWebhook$1 as handleWebhook, isDownloadExpired$1 as isDownloadExpired, isEmailReceivedEvent$1 as isEmailReceivedEvent, isRawIncluded$1 as isRawIncluded, parseWebhookEvent$1 as parseWebhookEvent, receive$1 as receive, safeValidateEmailReceivedEvent$1 as safeValidateEmailReceivedEvent, signStandardWebhooksPayload$1 as signStandardWebhooksPayload, signWebhookPayload$1 as signWebhookPayload, validateEmailAuth$1 as validateEmailAuth, validateEmailReceivedEvent$1 as validateEmailReceivedEvent, verifyDownloadToken$1 as verifyDownloadToken, verifyRawEmailDownload$1 as verifyRawEmailDownload, verifyStandardWebhooksSignature$1 as verifyStandardWebhooksSignature, verifyWebhookSignature$1 as verifyWebhookSignature } from "./index-CuuP1JkG.js";
5
+
6
+ //#region src/index.d.ts
7
+
8
+ declare const primitive: {
9
+ client: typeof client;
10
+ receive: typeof receive;
11
+ }; //#endregion
12
+ export { AuthConfidence, AuthVerdict, DecodeRawEmailOptions, DkimResult, DkimSignature, DmarcPolicy, DmarcResult, EmailAddress, EmailAnalysis, EmailAuth, EmailReceivedEvent, EventType, ForwardAnalysis, ForwardInput, ForwardOriginalSender, ForwardResult, ForwardResultAttachmentAnalyzed, ForwardResultAttachmentSkipped, ForwardResultInline, ForwardVerdict, ForwardVerification, GenerateDownloadTokenOptions, HandleWebhookOptions, KnownWebhookEvent, LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS, PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER, ParsedData, ParsedDataComplete, ParsedDataFailed, ParsedError, ParsedStatus, PrimitiveApiError, PrimitiveClient, PrimitiveClientOptions, PrimitiveWebhookError, RAW_EMAIL_ERRORS, RawContent, RawContentDownloadOnly, RawContentInline, RawEmailDecodeError, RawEmailDecodeErrorCode, ReceiveRequestOptions, ReceivedEmail, ReceivedEmailAddress, ReceivedEmailThread, ReplyInput, STANDARD_WEBHOOK_ID_HEADER, STANDARD_WEBHOOK_SIGNATURE_HEADER, STANDARD_WEBHOOK_TIMESTAMP_HEADER, SendInput, SendResult, SendThreadInput, SignResult, SpfResult, StandardWebhooksSignResult, StandardWebhooksVerifyOptions, UnknownEvent, VERIFICATION_ERRORS, ValidateEmailAuthResult, VerifyDownloadTokenOptions, VerifyDownloadTokenResult, VerifyOptions, WEBHOOK_VERSION, WebhookAttachment, WebhookErrorCode, WebhookEvent, WebhookHeaders, WebhookPayloadError, WebhookPayloadErrorCode, WebhookValidationError, WebhookValidationErrorCode, WebhookVerificationError, WebhookVerificationErrorCode, buildForwardSubject, buildReplySubject, client, confirmedHeaders, createPrimitiveClient, decodeRawEmail, primitive as default, emailReceivedEventJsonSchema, formatAddress, generateDownloadToken, getDownloadTimeRemaining, handleWebhook, isDownloadExpired, isEmailReceivedEvent, isRawIncluded, normalizeReceivedEmail, parseHeaderAddress, parseWebhookEvent, receive, safeValidateEmailReceivedEvent, signStandardWebhooksPayload, signWebhookPayload, validateEmailAuth, validateEmailReceivedEvent, verifyDownloadToken, verifyRawEmailDownload, verifyStandardWebhooksSignature, verifyWebhookSignature };
package/dist/index.js CHANGED
@@ -1,3 +1,14 @@
1
- import { AuthConfidence, AuthVerdict, DkimResult, DmarcPolicy, DmarcResult, EventType, ForwardVerdict, LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS, PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER, ParsedStatus, PrimitiveWebhookError, RAW_EMAIL_ERRORS, RawEmailDecodeError, STANDARD_WEBHOOK_ID_HEADER, STANDARD_WEBHOOK_SIGNATURE_HEADER, STANDARD_WEBHOOK_TIMESTAMP_HEADER, SpfResult, VERIFICATION_ERRORS, WEBHOOK_VERSION, WebhookPayloadError, WebhookValidationError, WebhookVerificationError, confirmedHeaders, decodeRawEmail, emailReceivedEventJsonSchema, generateDownloadToken, getDownloadTimeRemaining, handleWebhook, isDownloadExpired, isEmailReceivedEvent, isRawIncluded, parseWebhookEvent, safeValidateEmailReceivedEvent, signStandardWebhooksPayload, signWebhookPayload, validateEmailAuth, validateEmailReceivedEvent, verifyDownloadToken, verifyRawEmailDownload, verifyStandardWebhooksSignature, verifyWebhookSignature } from "./webhook-COe5N_Uj.js";
1
+ import "./address-parser-CfPHs3mE.js";
2
+ import { buildForwardSubject, buildReplySubject, formatAddress, normalizeReceivedEmail, parseHeaderAddress } from "./received-email-Q6Cha3wc.js";
3
+ import { PrimitiveApiError, PrimitiveClient, client, createPrimitiveClient } from "./api-BH8PnmHs.js";
4
+ import { AuthConfidence, AuthVerdict, DkimResult, DmarcPolicy, DmarcResult, EventType, ForwardVerdict, LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS, PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER, ParsedStatus, PrimitiveWebhookError, RAW_EMAIL_ERRORS, RawEmailDecodeError, STANDARD_WEBHOOK_ID_HEADER, STANDARD_WEBHOOK_SIGNATURE_HEADER, STANDARD_WEBHOOK_TIMESTAMP_HEADER, SpfResult, VERIFICATION_ERRORS, WEBHOOK_VERSION, WebhookPayloadError, WebhookValidationError, WebhookVerificationError, confirmedHeaders, decodeRawEmail, emailReceivedEventJsonSchema, generateDownloadToken, getDownloadTimeRemaining, handleWebhook, isDownloadExpired, isEmailReceivedEvent, isRawIncluded, parseWebhookEvent, receive, safeValidateEmailReceivedEvent, signStandardWebhooksPayload, signWebhookPayload, validateEmailAuth, validateEmailReceivedEvent, verifyDownloadToken, verifyRawEmailDownload, verifyStandardWebhooksSignature, verifyWebhookSignature } from "./webhook-2TALcBQz.js";
2
5
 
3
- export { AuthConfidence, AuthVerdict, DkimResult, DmarcPolicy, DmarcResult, EventType, ForwardVerdict, LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS, PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER, ParsedStatus, PrimitiveWebhookError, RAW_EMAIL_ERRORS, RawEmailDecodeError, STANDARD_WEBHOOK_ID_HEADER, STANDARD_WEBHOOK_SIGNATURE_HEADER, STANDARD_WEBHOOK_TIMESTAMP_HEADER, SpfResult, VERIFICATION_ERRORS, WEBHOOK_VERSION, WebhookPayloadError, WebhookValidationError, WebhookVerificationError, confirmedHeaders, decodeRawEmail, emailReceivedEventJsonSchema, generateDownloadToken, getDownloadTimeRemaining, handleWebhook, isDownloadExpired, isEmailReceivedEvent, isRawIncluded, parseWebhookEvent, safeValidateEmailReceivedEvent, signStandardWebhooksPayload, signWebhookPayload, validateEmailAuth, validateEmailReceivedEvent, verifyDownloadToken, verifyRawEmailDownload, verifyStandardWebhooksSignature, verifyWebhookSignature };
6
+ //#region src/index.ts
7
+ const primitive = {
8
+ client,
9
+ receive
10
+ };
11
+ var src_default = primitive;
12
+
13
+ //#endregion
14
+ export { AuthConfidence, AuthVerdict, DkimResult, DmarcPolicy, DmarcResult, EventType, ForwardVerdict, LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS, PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER, ParsedStatus, PrimitiveApiError, PrimitiveClient, PrimitiveWebhookError, RAW_EMAIL_ERRORS, RawEmailDecodeError, STANDARD_WEBHOOK_ID_HEADER, STANDARD_WEBHOOK_SIGNATURE_HEADER, STANDARD_WEBHOOK_TIMESTAMP_HEADER, SpfResult, VERIFICATION_ERRORS, WEBHOOK_VERSION, WebhookPayloadError, WebhookValidationError, WebhookVerificationError, buildForwardSubject, buildReplySubject, client, confirmedHeaders, createPrimitiveClient, decodeRawEmail, src_default as default, emailReceivedEventJsonSchema, formatAddress, generateDownloadToken, getDownloadTimeRemaining, handleWebhook, isDownloadExpired, isEmailReceivedEvent, isRawIncluded, normalizeReceivedEmail, parseHeaderAddress, parseWebhookEvent, receive, safeValidateEmailReceivedEvent, signStandardWebhooksPayload, signWebhookPayload, validateEmailAuth, validateEmailReceivedEvent, verifyDownloadToken, verifyRawEmailDownload, verifyStandardWebhooksSignature, verifyWebhookSignature };
@@ -43,6 +43,10 @@ export const openapiDocument = {
43
43
  "name": "Emails",
44
44
  "description": "List, inspect, and manage received emails"
45
45
  },
46
+ {
47
+ "name": "Sending",
48
+ "description": "Send outbound emails through the Primitive API"
49
+ },
46
50
  {
47
51
  "name": "Endpoints",
48
52
  "description": "Manage webhook endpoints that receive email events"
@@ -1427,6 +1431,85 @@ export const openapiDocument = {
1427
1431
  }
1428
1432
  }
1429
1433
  }
1434
+ },
1435
+ "/send-mail": {
1436
+ "post": {
1437
+ "operationId": "sendEmail",
1438
+ "summary": "Send outbound email",
1439
+ "description": "Sends an outbound email through Primitive's outbound relay. By default\nthe request returns once the relay accepts the message for delivery.\nSet `wait: true` to wait for the first downstream SMTP delivery outcome.\n",
1440
+ "tags": [
1441
+ "Sending"
1442
+ ],
1443
+ "parameters": [
1444
+ {
1445
+ "name": "Idempotency-Key",
1446
+ "in": "header",
1447
+ "required": false,
1448
+ "schema": {
1449
+ "type": "string",
1450
+ "minLength": 1,
1451
+ "maxLength": 255,
1452
+ "pattern": "^[\\x21-\\x7E]+$"
1453
+ },
1454
+ "description": "Optional customer-supplied idempotency key. If omitted, Primitive\nderives one from the canonical request payload and echoes the\neffective value in the `Idempotency-Key` response header.\n"
1455
+ }
1456
+ ],
1457
+ "requestBody": {
1458
+ "required": true,
1459
+ "content": {
1460
+ "application/json": {
1461
+ "schema": {
1462
+ "$ref": "#/components/schemas/SendMailInput"
1463
+ }
1464
+ }
1465
+ }
1466
+ },
1467
+ "responses": {
1468
+ "200": {
1469
+ "description": "Outbound relay result",
1470
+ "content": {
1471
+ "application/json": {
1472
+ "schema": {
1473
+ "allOf": [
1474
+ {
1475
+ "$ref": "#/components/schemas/SuccessEnvelope"
1476
+ },
1477
+ {
1478
+ "type": "object",
1479
+ "properties": {
1480
+ "data": {
1481
+ "$ref": "#/components/schemas/SendMailResult"
1482
+ }
1483
+ }
1484
+ }
1485
+ ]
1486
+ }
1487
+ }
1488
+ }
1489
+ },
1490
+ "400": {
1491
+ "$ref": "#/components/responses/ValidationError"
1492
+ },
1493
+ "401": {
1494
+ "$ref": "#/components/responses/Unauthorized"
1495
+ },
1496
+ "403": {
1497
+ "$ref": "#/components/responses/Forbidden"
1498
+ },
1499
+ "429": {
1500
+ "$ref": "#/components/responses/RateLimited"
1501
+ },
1502
+ "500": {
1503
+ "$ref": "#/components/responses/InternalError"
1504
+ },
1505
+ "502": {
1506
+ "$ref": "#/components/responses/BadGateway"
1507
+ },
1508
+ "503": {
1509
+ "$ref": "#/components/responses/ServiceUnavailable"
1510
+ }
1511
+ }
1512
+ }
1430
1513
  }
1431
1514
  },
1432
1515
  "components": {
@@ -1492,6 +1575,23 @@ export const openapiDocument = {
1492
1575
  }
1493
1576
  }
1494
1577
  },
1578
+ "Forbidden": {
1579
+ "description": "Authenticated caller lacks permission for the operation",
1580
+ "content": {
1581
+ "application/json": {
1582
+ "schema": {
1583
+ "$ref": "#/components/schemas/ErrorResponse"
1584
+ },
1585
+ "example": {
1586
+ "success": false,
1587
+ "error": {
1588
+ "code": "forbidden",
1589
+ "message": "Insufficient permissions"
1590
+ }
1591
+ }
1592
+ }
1593
+ }
1594
+ },
1495
1595
  "NotFound": {
1496
1596
  "description": "Resource not found",
1497
1597
  "content": {
@@ -1551,6 +1651,57 @@ export const openapiDocument = {
1551
1651
  }
1552
1652
  }
1553
1653
  },
1654
+ "BadGateway": {
1655
+ "description": "Primitive could not complete the downstream SMTP request",
1656
+ "content": {
1657
+ "application/json": {
1658
+ "schema": {
1659
+ "$ref": "#/components/schemas/ErrorResponse"
1660
+ },
1661
+ "example": {
1662
+ "success": false,
1663
+ "error": {
1664
+ "code": "bad_gateway",
1665
+ "message": "Outbound SMTP service request failed"
1666
+ }
1667
+ }
1668
+ }
1669
+ }
1670
+ },
1671
+ "ServiceUnavailable": {
1672
+ "description": "Primitive is temporarily unable to process the request",
1673
+ "content": {
1674
+ "application/json": {
1675
+ "schema": {
1676
+ "$ref": "#/components/schemas/ErrorResponse"
1677
+ },
1678
+ "example": {
1679
+ "success": false,
1680
+ "error": {
1681
+ "code": "outbound_capacity_exhausted",
1682
+ "message": "Outbound capacity is temporarily exhausted"
1683
+ }
1684
+ }
1685
+ }
1686
+ }
1687
+ },
1688
+ "InternalError": {
1689
+ "description": "Primitive encountered an internal error",
1690
+ "content": {
1691
+ "application/json": {
1692
+ "schema": {
1693
+ "$ref": "#/components/schemas/ErrorResponse"
1694
+ },
1695
+ "example": {
1696
+ "success": false,
1697
+ "error": {
1698
+ "code": "internal_error",
1699
+ "message": "Internal server error"
1700
+ }
1701
+ }
1702
+ }
1703
+ }
1704
+ },
1554
1705
  "Deleted": {
1555
1706
  "description": "Resource deleted",
1556
1707
  "content": {
@@ -1659,7 +1810,17 @@ export const openapiDocument = {
1659
1810
  "rate_limit_exceeded",
1660
1811
  "internal_error",
1661
1812
  "conflict",
1662
- "mx_conflict"
1813
+ "mx_conflict",
1814
+ "bad_gateway",
1815
+ "outbound_disabled",
1816
+ "cannot_send_from_domain",
1817
+ "recipient_not_allowed",
1818
+ "outbound_key_missing",
1819
+ "outbound_unreachable",
1820
+ "outbound_key_invalid",
1821
+ "outbound_capacity_exhausted",
1822
+ "outbound_response_malformed",
1823
+ "outbound_relay_failed"
1663
1824
  ]
1664
1825
  },
1665
1826
  "message": {
@@ -1687,8 +1848,38 @@ export const openapiDocument = {
1687
1848
  "description": "Subdomain to try instead (e.g. \"mail\" for `mail.example.com`)."
1688
1849
  }
1689
1850
  }
1851
+ },
1852
+ "required_entitlements": {
1853
+ "type": "array",
1854
+ "items": {
1855
+ "type": "string"
1856
+ },
1857
+ "description": "Entitlements that would allow a denied send when no recipient-scope gate was granted."
1858
+ },
1859
+ "sent_email_id": {
1860
+ "type": "string",
1861
+ "description": "ID of the persisted sent-email attempt associated with the error."
1862
+ },
1863
+ "content_hash": {
1864
+ "type": "string",
1865
+ "description": "Content hash of the original request on idempotency cache-hit errors."
1866
+ },
1867
+ "client_idempotency_key": {
1868
+ "type": "string",
1869
+ "description": "Effective idempotency key associated with the original request."
1690
1870
  }
1691
1871
  }
1872
+ },
1873
+ "gates": {
1874
+ "type": "array",
1875
+ "items": {
1876
+ "$ref": "#/components/schemas/GateDenial"
1877
+ },
1878
+ "description": "Structured per-gate denial detail for recipient-scope send-mail failures."
1879
+ },
1880
+ "request_id": {
1881
+ "type": "string",
1882
+ "description": "Server-issued request identifier for support and tracing."
1692
1883
  }
1693
1884
  },
1694
1885
  "required": [
@@ -1702,6 +1893,71 @@ export const openapiDocument = {
1702
1893
  "error"
1703
1894
  ]
1704
1895
  },
1896
+ "GateDenial": {
1897
+ "type": "object",
1898
+ "properties": {
1899
+ "name": {
1900
+ "type": "string",
1901
+ "enum": [
1902
+ "send_to_confirmed_domains",
1903
+ "send_to_known_addresses"
1904
+ ],
1905
+ "description": "Public recipient-scope gate name that denied the send."
1906
+ },
1907
+ "reason": {
1908
+ "type": "string",
1909
+ "enum": [
1910
+ "domain_not_confirmed",
1911
+ "recipient_unauthenticated",
1912
+ "recipient_not_known"
1913
+ ],
1914
+ "description": "Stable machine-readable denial reason."
1915
+ },
1916
+ "message": {
1917
+ "type": "string",
1918
+ "description": "Human-readable explanation of the gate denial."
1919
+ },
1920
+ "subject": {
1921
+ "type": "string",
1922
+ "description": "Domain or address the gate evaluated."
1923
+ },
1924
+ "fix": {
1925
+ "$ref": "#/components/schemas/GateFix"
1926
+ },
1927
+ "docs_url": {
1928
+ "type": "string",
1929
+ "description": "Public docs URL with more context."
1930
+ }
1931
+ },
1932
+ "required": [
1933
+ "name",
1934
+ "reason",
1935
+ "message",
1936
+ "subject"
1937
+ ]
1938
+ },
1939
+ "GateFix": {
1940
+ "type": "object",
1941
+ "properties": {
1942
+ "action": {
1943
+ "type": "string",
1944
+ "enum": [
1945
+ "confirm_domain",
1946
+ "sender_must_fix_authentication",
1947
+ "wait_for_inbound"
1948
+ ],
1949
+ "description": "Suggested next action for the caller."
1950
+ },
1951
+ "subject": {
1952
+ "type": "string",
1953
+ "description": "Entity the action applies to."
1954
+ }
1955
+ },
1956
+ "required": [
1957
+ "action",
1958
+ "subject"
1959
+ ]
1960
+ },
1705
1961
  "Account": {
1706
1962
  "type": "object",
1707
1963
  "properties": {
@@ -2337,6 +2593,162 @@ export const openapiDocument = {
2337
2593
  "to_email"
2338
2594
  ]
2339
2595
  },
2596
+ "SendMailInput": {
2597
+ "type": "object",
2598
+ "additionalProperties": false,
2599
+ "properties": {
2600
+ "from": {
2601
+ "type": "string",
2602
+ "minLength": 3,
2603
+ "maxLength": 998,
2604
+ "description": "RFC 5322 From header. The sender domain must be a verified outbound domain for your organization."
2605
+ },
2606
+ "to": {
2607
+ "type": "string",
2608
+ "minLength": 3,
2609
+ "maxLength": 320,
2610
+ "description": "Recipient address. Recipient eligibility depends on your account's outbound entitlements."
2611
+ },
2612
+ "subject": {
2613
+ "type": "string",
2614
+ "minLength": 1,
2615
+ "maxLength": 998,
2616
+ "description": "Subject line for the outbound message"
2617
+ },
2618
+ "body_text": {
2619
+ "type": "string",
2620
+ "description": "Plain-text message body. At least one of body_text or body_html is required. The combined UTF-8 byte length of body_text and body_html must be at most 262144 bytes."
2621
+ },
2622
+ "body_html": {
2623
+ "type": "string",
2624
+ "description": "HTML message body. At least one of body_text or body_html is required. The combined UTF-8 byte length of body_text and body_html must be at most 262144 bytes."
2625
+ },
2626
+ "in_reply_to": {
2627
+ "type": "string",
2628
+ "minLength": 1,
2629
+ "maxLength": 998,
2630
+ "pattern": "^[^\\x00-\\x1F\\x7F]+$",
2631
+ "description": "Message-ID of the direct parent email when sending a threaded reply."
2632
+ },
2633
+ "references": {
2634
+ "type": "array",
2635
+ "maxItems": 100,
2636
+ "description": "Full ordered message-id chain for the thread.",
2637
+ "items": {
2638
+ "type": "string",
2639
+ "minLength": 1,
2640
+ "maxLength": 998,
2641
+ "pattern": "^[^\\x00-\\x1F\\x7F]+$"
2642
+ }
2643
+ },
2644
+ "wait": {
2645
+ "type": "boolean",
2646
+ "description": "When true, wait for the first downstream SMTP delivery outcome before returning."
2647
+ },
2648
+ "wait_timeout_ms": {
2649
+ "type": "integer",
2650
+ "minimum": 1000,
2651
+ "maximum": 30000,
2652
+ "description": "Maximum time to wait for a delivery outcome when wait is true. Defaults to 30000."
2653
+ }
2654
+ },
2655
+ "required": [
2656
+ "from",
2657
+ "to",
2658
+ "subject"
2659
+ ]
2660
+ },
2661
+ "SentEmailStatus": {
2662
+ "type": "string",
2663
+ "enum": [
2664
+ "queued",
2665
+ "submitted_to_agent",
2666
+ "agent_failed",
2667
+ "unknown",
2668
+ "delivered",
2669
+ "bounced",
2670
+ "deferred",
2671
+ "wait_timeout"
2672
+ ]
2673
+ },
2674
+ "DeliveryStatus": {
2675
+ "type": "string",
2676
+ "enum": [
2677
+ "delivered",
2678
+ "bounced",
2679
+ "deferred",
2680
+ "wait_timeout"
2681
+ ]
2682
+ },
2683
+ "SendMailResult": {
2684
+ "type": "object",
2685
+ "properties": {
2686
+ "id": {
2687
+ "type": "string",
2688
+ "description": "Persisted sent-email attempt ID."
2689
+ },
2690
+ "status": {
2691
+ "$ref": "#/components/schemas/SentEmailStatus"
2692
+ },
2693
+ "queue_id": {
2694
+ "type": [
2695
+ "string",
2696
+ "null"
2697
+ ],
2698
+ "description": "Message identifier assigned by Primitive's outbound relay, when available."
2699
+ },
2700
+ "accepted": {
2701
+ "type": "array",
2702
+ "items": {
2703
+ "type": "string"
2704
+ },
2705
+ "description": "Recipient addresses accepted by the relay."
2706
+ },
2707
+ "rejected": {
2708
+ "type": "array",
2709
+ "items": {
2710
+ "type": "string"
2711
+ },
2712
+ "description": "Recipient addresses rejected by the relay."
2713
+ },
2714
+ "client_idempotency_key": {
2715
+ "type": "string",
2716
+ "description": "Effective idempotency key used for this send."
2717
+ },
2718
+ "request_id": {
2719
+ "type": "string",
2720
+ "description": "Server-issued request identifier for support and tracing."
2721
+ },
2722
+ "content_hash": {
2723
+ "type": "string",
2724
+ "description": "Stable hash of the canonical send payload."
2725
+ },
2726
+ "delivery_status": {
2727
+ "$ref": "#/components/schemas/DeliveryStatus"
2728
+ },
2729
+ "smtp_response_code": {
2730
+ "type": [
2731
+ "integer",
2732
+ "null"
2733
+ ],
2734
+ "description": "SMTP response code from the first downstream delivery outcome when wait is true."
2735
+ },
2736
+ "smtp_response_text": {
2737
+ "type": "string",
2738
+ "description": "SMTP response text from the first downstream delivery outcome when wait is true."
2739
+ }
2740
+ },
2741
+ "required": [
2742
+ "id",
2743
+ "status",
2744
+ "queue_id",
2745
+ "accepted",
2746
+ "rejected",
2747
+ "client_idempotency_key",
2748
+ "request_id",
2749
+ "content_hash"
2750
+ ]
2751
+ },
2340
2752
  "Endpoint": {
2341
2753
  "type": "object",
2342
2754
  "properties": {
@@ -580,6 +580,22 @@ export const operationManifest = [
580
580
  "tag": "Filters",
581
581
  "tagCommand": "filters"
582
582
  },
583
+ {
584
+ "binaryResponse": false,
585
+ "bodyRequired": true,
586
+ "command": "send-email",
587
+ "description": "Sends an outbound email through Primitive's outbound relay. By default\nthe request returns once the relay accepts the message for delivery.\nSet `wait: true` to wait for the first downstream SMTP delivery outcome.\n",
588
+ "hasJsonBody": true,
589
+ "method": "POST",
590
+ "operationId": "sendEmail",
591
+ "path": "/send-mail",
592
+ "pathParams": [],
593
+ "queryParams": [],
594
+ "sdkName": "sendEmail",
595
+ "summary": "Send outbound email",
596
+ "tag": "Sending",
597
+ "tagCommand": "sending"
598
+ },
583
599
  {
584
600
  "binaryResponse": false,
585
601
  "bodyRequired": false,