Skip to content

Contact List — Opt-in Email

Opt-in email entity for a contact list.

Endpoint

All verbs: /contact_list/<list>/optin_email


GET /contact_list/<list>/optin_email

Payload: No payload.

Returns: The opt-in email.

Example:

curl -u "username:api_key" -H "Accept: application/json" \
  https://app.duo.pt/contact_list/{list_id}/optin_email

Response:

{
  "success": true,
  "data": {
    "email": {
      "envelope_from_domain": null,
      "header_from_name": "Test Sender",
      "header_from": "sender@yourdomain.com",
      "subject": "Please confirm",
      "message": "<html><body>Click to confirm</body></html>",
      "attachment": null,
      "memoizedAttachment": null,
      "list": 1,
      "block_editor_type": null,
      "block_editor_content": null
    }
  }
}

POST /contact_list/<list>/optin_email

Note

Payload must be sent as multipart/form-data to accommodate the attachment parameter.

Parameter Type Description
header_from_name string Human-readable sender name
header_from string Sender email (domain must be enabled as sending domain)
subject string Message subject
message string Message HTML
block_editor_content string (optional) JSON for block editor content (Froala only)
attachment file (optional) Attachment file

Returns: The contact list and new opt-in email.

Example:

curl -u "username:api_key" -H "Accept: application/json" \
  -F "header_from_name=My Brand" \
  -F "header_from=noreply@yourdomain.com" \
  -F "subject=Please+confirm+your+subscription" \
  -F "message=<html><body><a href='{{optin_url}}'>Confirm</a></body></html>" \
  https://app.duo.pt/contact_list/{list_id}/optin_email

Response:

{
  "success": true,
  "data": {
    "contact_list": {
      "id": 1,
      "owner": 1,
      "name": "Example...",
      "default_email_out": null,
      "unsubscribe_message": "You have been unsubscribed.",
      "email_out_custom_fields": null,
      "double_optin": false,
      "optout_allowed": false,
      "optout_category": null,
      "optin_email": null,
      "optin_sms": null,
      "shared_with_children": false,
      "read_shared_with_children": false,
      "segments": null
    },
    "email": {
      "envelope_from_domain": null,
      "header_from_name": "Test Sender",
      "header_from": "sender@yourdomain.com",
      "subject": "Please confirm",
      "message": "<html><body>Click to confirm</body></html>",
      "attachment": null,
      "memoizedAttachment": null,
      "list": 1
    }
  }
}

PUT /contact_list/<list>/optin_email

Same payload as POST.

Returns: The contact list and edited opt-in email.

Example:

curl -u "username:api_key" -H "Accept: application/json" -X PUT \
  -F "header_from_name=My Brand" \
  -F "header_from=noreply@yourdomain.com" \
  -F "subject=Updated+confirmation+subject" \
  -F "message=<html><body><a href='{{optin_url}}'>Confirm</a></body></html>" \
  https://app.duo.pt/contact_list/{list_id}/optin_email

Response:

{
  "success": true,
  "data": {
    "contact_list": {
      "id": 1,
      "owner": 1,
      "name": "Example...",
      "default_email_out": null,
      "unsubscribe_message": "You have been unsubscribed.",
      "email_out_custom_fields": null,
      "double_optin": false,
      "optout_allowed": false,
      "optout_category": null,
      "optin_email": null,
      "optin_sms": null,
      "shared_with_children": false,
      "read_shared_with_children": false,
      "segments": null
    },
    "email": {
      "envelope_from_domain": null,
      "header_from_name": "Test Sender",
      "header_from": "sender@yourdomain.com",
      "subject": "Please confirm",
      "message": "<html><body>Click to confirm</body></html>",
      "attachment": null,
      "memoizedAttachment": null,
      "list": 1,
      "block_editor_type": null,
      "block_editor_content": null
    }
  }
}