Send an email. Requires `type`, `to`, `subject`, and `html`. Optional: `fromAddress`, `fromName`, `schedule`, attachments. The fromAddress must be a verified domain; otherwise our built-in address will be used which is fine for testing purposes.
const url = 'https://api.pingram.io/email';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"type":"example","to":"example","subject":"example","html":"example","fromName":"example","fromAddress":"example","previewText":"example","replyToAddresses":["example"],"ccAddresses":["example"],"bccAddresses":["example"],"attachments":[{"filename":"example","url":"example"}],"schedule":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.pingram.io/email \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "type": "example", "to": "example", "subject": "example", "html": "example", "fromName": "example", "fromAddress": "example", "previewText": "example", "replyToAddresses": [ "example" ], "ccAddresses": [ "example" ], "bccAddresses": [ "example" ], "attachments": [ { "filename": "example", "url": "example" } ], "schedule": "example" }'Authorizations
Request Bodyrequired
Request body for POST /email (send email without a template).
object
The notification type to send.
The email address of the recipient.
The subject of the email.
The HTML body of the email.
The display name of the sender.
The email address of the sender.
The preview text of the email.
The reply-to addresses of the email.
The CC addresses of the email.
The BCC addresses of the email.
URL-based file attachments. Up to 20 MB per file.
object
The ISO 8601 datetime to schedule the email.
Examplegenerated
{ "type": "example", "to": "example", "subject": "example", "html": "example", "fromName": "example", "fromAddress": "example", "previewText": "example", "replyToAddresses": [ "example" ], "ccAddresses": [ "example" ], "bccAddresses": [ "example" ], "attachments": [ { "filename": "example", "url": "example" } ], "schedule": "example"}Responses
200
Successful response
Success response for POST /email.
object
Error response for POST /email.
object
Error details for email send failures.
object
Machine-readable error code.
Human-readable error message.
Actionable hint for fixing the error.
Examplegenerated
{ "trackingId": "example", "messages": [ "example" ]}400
Bad Request - validation errors, invalid input
Standard error response for API errors.
object
Unique tracking ID for the request.
Structured error details for API error responses.
object
Machine-readable error code.
Human-readable error message.
Actionable hint for fixing the error.
Examplegenerated
{ "trackingId": "example", "error": { "code": "example", "message": "example", "fix": "example" }}401
Unauthorized
402
Payment Required - usage limits exceeded
Standard error response for API errors.
object
Unique tracking ID for the request.
Structured error details for API error responses.
object
Machine-readable error code.
Human-readable error message.
Actionable hint for fixing the error.
Examplegenerated
{ "trackingId": "example", "error": { "code": "example", "message": "example", "fix": "example" }}500
Internal Server Error
502
Bad Gateway - provider error
Standard error response for API errors.
object
Unique tracking ID for the request.
Structured error details for API error responses.
object
Machine-readable error code.
Human-readable error message.
Actionable hint for fixing the error.
Examplegenerated
{ "trackingId": "example", "error": { "code": "example", "message": "example", "fix": "example" }}