Emails (Secure Links)

Send a secure email link for a document. Useful when you want recipients to access PHI via a time-limited link.

POST /emails — Sends a secure email link for a document.

Request Parameters (multipart form data)

ParameterRequiredDescription
fileYesPDF or TIFF document to share
recipient_emailYesEmail address of the recipient
recipient_nameNoName of the recipient (displayed in email)
sender_nameNoName of the sender (displayed in email)
reply_to_emailNoReply-to email address
subjectNoEmail subject line
noteNoInternal note for your reference
patient_nameNoPatient name for record keeping
patient_dobNoPatient date of birth (YYYY-MM-DD)
expire_afterYesDays until link expires (1-180). Required; no default.
callback_urlNoURL to receive status callback
bash
export API_BASE="https://api.medsender.com/api/v2"
export API_KEY="sk_test_..."

curl -s -X POST -H "Authorization: Bearer $API_KEY" \
  -F "file=@./sample.pdf" \
  -F "recipient_email=recipient@example.com" \
  -F "recipient_name=Recipient" \
  -F "sender_name=Sender" \
  -F "subject=Secure Link" \
  -F "note=Referral" \
  -F "expire_after=30" \
  -F "callback_url=https://example.com/webhooks/email" \
  "$API_BASE/emails"
export API_BASE="https://api.medsender.com/api/v2"
export API_KEY="sk_test_..."

curl -s -X POST -H "Authorization: Bearer $API_KEY" \
  -F "file=@./sample.pdf" \
  -F "recipient_email=recipient@example.com" \
  -F "recipient_name=Recipient" \
  -F "sender_name=Sender" \
  -F "subject=Secure Link" \
  -F "note=Referral" \
  -F "expire_after=30" \
  -F "callback_url=https://example.com/webhooks/email" \
  "$API_BASE/emails"

Response

JSON
{
  "message": "Record has been sent, we will send a callback upon completion.",
  "emailId": "e5f6a7b8c9d0"
}
{
  "message": "Record has been sent, we will send a callback upon completion.",
  "emailId": "e5f6a7b8c9d0"
}

Get Email

GET /emails/:id — Retrieves details for a specific secure link email.

The :id parameter is the emailId returned when you created the email.

bash
curl -s -H "Authorization: Bearer sk_test_..." "https://api.medsender.com/api/v2/emails/REPLACE_EMAIL_ID" | jq
curl -s -H "Authorization: Bearer sk_test_..." "https://api.medsender.com/api/v2/emails/REPLACE_EMAIL_ID" | jq

Response

JSON
{
  "senderName": "Example Provider",
  "recipientEmail": "recipient@example.com",
  "recipientName": "Dr. Example",
  "replyToEmail": null,
  "patientName": "John Doe",
  "patientDob": "1990-01-15",
  "recordStatus": null,
  "emailStatus": "success",
  "emailId": "e5f6a7b8c9d0",
  "secureLink": "https://records.medsender.com/...",
  "expiry": "2025-02-15T10:00:00.000Z",
  "sentAt": "2025-01-15T10:00:00.000Z",
  "note": "Referral documents",
  "subject": "Secure Medical Documents",
  "lastViewedAt": null,
  "isTest": false,
  "errorDetails": {
    "errorCode": null,
    "errorDetails": null
  }
}
{
  "senderName": "Example Provider",
  "recipientEmail": "recipient@example.com",
  "recipientName": "Dr. Example",
  "replyToEmail": null,
  "patientName": "John Doe",
  "patientDob": "1990-01-15",
  "recordStatus": null,
  "emailStatus": "success",
  "emailId": "e5f6a7b8c9d0",
  "secureLink": "https://records.medsender.com/...",
  "expiry": "2025-02-15T10:00:00.000Z",
  "sentAt": "2025-01-15T10:00:00.000Z",
  "note": "Referral documents",
  "subject": "Secure Medical Documents",
  "lastViewedAt": null,
  "isTest": false,
  "errorDetails": {
    "errorCode": null,
    "errorDetails": null
  }
}

Response Fields

FieldDescription
emailIdUnique identifier for this email (use to retrieve status)
recipientEmailEmail address the link was sent to
recipientNameRecipient name if provided
senderNameSender name if provided
replyToEmailReply-to email address if provided
subjectEmail subject line
noteInternal note if provided
patientNamePatient name if provided
patientDobPatient date of birth if provided
recordStatusStatus: "activated", "archived", "revoked", or null. Newly created emails can have null status.
emailStatusDelivery status: "queued", "inprogress", "success", or "failure"
secureLinkThe secure URL to view the document
expiryWhen the secure link expires (ISO 8601)
sentAtWhen the email was sent (ISO 8601)
lastViewedAtWhen the link was last viewed, or null
isTestWhether this was sent using test credentials
errorDetailsError information if emailStatus is "failure"