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_afterNoDays until link expires (1-180, default 30)
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.",
  "email_id": "e5f6a7b8c9d0"
}
{
  "message": "Record has been sent, we will send a callback upon completion.",
  "email_id": "e5f6a7b8c9d0"
}

Get Email

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

The :id parameter is the email_id 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
{
  "sender_name": "Example Provider",
  "recipient_email": "recipient@example.com",
  "recipient_name": "Dr. Example",
  "reply_to_email": null,
  "patient_name": "John Doe",
  "patient_dob": "1990-01-15",
  "record_status": "activated",
  "email_status": "success",
  "email_id": "e5f6a7b8c9d0",
  "secure_link": "https://records.medsender.com/...",
  "expiry": "2025-02-15T10:00:00.000Z",
  "sent_at": "2025-01-15T10:00:00.000Z",
  "note": "Referral documents",
  "subject": "Secure Medical Documents",
  "last_viewed_at": null,
  "is_test": false,
  "error_details": {
    "error_code": null,
    "error_details": null
  }
}
{
  "sender_name": "Example Provider",
  "recipient_email": "recipient@example.com",
  "recipient_name": "Dr. Example",
  "reply_to_email": null,
  "patient_name": "John Doe",
  "patient_dob": "1990-01-15",
  "record_status": "activated",
  "email_status": "success",
  "email_id": "e5f6a7b8c9d0",
  "secure_link": "https://records.medsender.com/...",
  "expiry": "2025-02-15T10:00:00.000Z",
  "sent_at": "2025-01-15T10:00:00.000Z",
  "note": "Referral documents",
  "subject": "Secure Medical Documents",
  "last_viewed_at": null,
  "is_test": false,
  "error_details": {
    "error_code": null,
    "error_details": null
  }
}

Response Fields

FieldDescription
email_idUnique identifier for this email (use to retrieve status)
recipient_emailEmail address the link was sent to
recipient_nameRecipient name if provided
sender_nameSender name if provided
reply_to_emailReply-to email address if provided
subjectEmail subject line
noteInternal note if provided
patient_namePatient name if provided
patient_dobPatient date of birth if provided
record_statusStatus: "activated", "archived", or "revoked"
email_statusDelivery status: "queued", "inprogress", "success", or "failure"
secure_linkThe secure URL to view the document
expiryWhen the secure link expires (ISO 8601)
sent_atWhen the email was sent (ISO 8601)
last_viewed_atWhen the link was last viewed, or null
is_testWhether this was sent using test credentials
error_detailsError information if email_status is "failure"