Skip to main content

Email Opt-in API Documentation

Overview

The Email Opt-in API allows you to capture email opt-ins and receive comprehensive consumer information. This API is designed to process email subscriptions while providing detailed demographic, financial, and behavioral insights about your subscribers, enabling more targeted marketing and personalized customer interactions.

How It Works

The Email Opt-in API works through the following process:

  1. Submit Email Opt-in: You send the subscriber's email along with any additional information you have, such as name or phone number.
  2. Matching Process: The system processes the opt-in and attempts to match the provided information against a comprehensive consumer database.
  3. Data Enrichment: When a match is found, the API returns detailed consumer data, including demographic information, financial details, property data, and behavioral insights.
  4. Response Handling: You can use the enriched data to better understand your subscribers, personalize marketing efforts, or enhance your CRM records with valuable consumer insights.

Authentication

Most mutations and queries require authentication. The auth object must be provided as part of the request. It includes:

Auth Object

FieldTypeDescription
appIdStringThe application ID. Request this from [email protected].
appSecretStringThe application secret. Request this from [email protected].

Operations

Mutation: email

Captures email opt-ins and returns enriched consumer data.

Endpoint

mutation Email(
$auth: AuthRequestInput!
$event: EmailOptinEventInput!
) {
email(auth: $auth, event: $event) {
code
data
message
}
}

Parameters

ParameterTypeRequiredDescription
authAuthRequestInputYesThe authentication credentials.
eventEmailOptinEventInputYesDetails of the email opt-in.

EmailOptinEventInput Fields

FieldTypeRequiredDescription
emailStringYesEmail address of the subscriber.
pixel_idIntYesThe unique ID for the pixel.
domainStringYesThe domain where the event occurred.
pusher_channelStringNoPusher channel identifier.
first_nameStringNoFirst name of the subscriber.
last_nameStringNoLast name of the subscriber.
tcpaIntNoTCPA compliance flag.
phoneStringNoPhone number of the subscriber.
md5StringNoMD5 hash for identification.
hemStringNoHEM identifier.
request_idStringNoUnique request identifier.
asStringNoAS identifier.
canonicalStringNoCanonical URL.
cityStringNoCity of the subscriber.
countryStringNoCountry of the subscriber.
descriptionStringNoDescription of the event.
ipStringNoIP address of the subscriber.
ispStringNoInternet Service Provider.
languageStringNoLanguage preference of the user.
latFloatNoLatitude coordinate.
lonFloatNoLongitude coordinate.
orgStringNoOrganization.
referrerStringNoReferring URL.
timestampIntNoTimestamp of the event.
timezoneStringNoTimezone of the subscriber.
titleStringNoPage title.
urlStringNoCurrent URL.
sessionidStringNoSession identifier.
zipStringNoZIP/Postal code.
ageStringNoAge of the subscriber.
genderStringNoGender of the subscriber.
sha1StringNoSHA-1 hash.
sha2StringNoSHA-2 hash.
nonIdStringNoNon-ID identifier.
utm_sourceStringNoUTM source parameter.
utm_mediumStringNoUTM medium parameter.
utm_campaignStringNoUTM campaign parameter.
utm_termStringNoUTM term parameter.
utm_contentStringNoUTM content parameter.
osStringNoOperating system.
fingerprintStringNoBrowser fingerprint.
user_agentStringNoUser agent string.
browserStringNoBrowser name and version.
device_typeStringNoType of device.
resolutionStringNoScreen resolution.
eventStringNoEvent type.
region_nameStringNoRegion/state name.
country_codeStringNoCountry code.
unique_idStringNoUnique identifier.
is_new_sessionBooleanNoWhether this is a new session.
is_euBooleanNoWhether the user is in the EU.
referring_domainStringNoReferring domain.
inner_resolutionStringNoInner window resolution.
custom_oneStringNoCustom field one.
custom_twoStringNoCustom field two.
custom_threeStringNoCustom field three.
custom_fourStringNoCustom field four.
custom_fiveStringNoCustom field five.

Example Request

{
"query": "mutation Email($auth: AuthRequestInput!, $event: EmailOptinEventInput!) { email(auth: $auth, event: $event) { code data message } }",
"variables": {
"auth": {
"appId": "yourAppIdHere",
"appSecret": "yourAppSecretHere"
},
"event": {
"email": "[email protected]",
"pixel_id": 123,
"domain": "example.com",
"first_name": "John",
"last_name": "Smith"
}
}
}

Example CURL Request

curl -X POST https://sweet-colt-9750.ddn.hasura.app/graphql \
-H "Content-Type: application/json" \
-d '{
"query": "mutation Email($auth: AuthRequestInput!, $event: EmailOptinEventInput!) { email(auth: $auth, event: $event) { code data message } }",
"variables": {
"auth": {
"appId": "yourAppIdHere",
"appSecret": "yourAppSecretHere"
},
"event": {
"email": "[email protected]",
"pixel_id": 123,
"domain": "example.com",
"first_name": "John",
"last_name": "Smith"
}
}
}'

Example Response

{
"data": {
"email": {
"code": 200,
"data": {
"consumer_data": {
"pusher_channel": null,
"event": "email_optin",
"team_id": 1,
"first_name": "John",
"last_name": "Smith",
"website_id": 123,
"pixel_id": 123,
"domain": "example.com",
"canonical": "undefined",
"consumer_id": "10000001",
"isUniqueLead": false,
"created_at": 1716979200,
"timestamp": "2024-05-29 12:00:00.000",
"tcpa": null,
"hem": "",
"sha2": "",
"email": "[email protected]",
"country_code": "",
"is_eu": false,
"lat": 0,
"lon": 0,
"timezone": "",
"language": "",
"request_id": null,
"description": null,
"ip": "",
"url": "undefined",
"nonId": null,
"is_new_session": null,
"as": null,
"title": null,
"sessionid": null,
"fingerprint": null,
"unique_id": "a1b2c3d4e5f6g7h8i9j0",
"org": "",
"isp": "",
"referrer": "",
"referring_domain": "",
"utm_source": "",
"utm_medium": "",
"utm_campaign": "",
"utm_term": "",
"utm_content": "",
"os": "",
"user_agent": "",
"_unmapped_data": "",
"browser": "",
"device_type": "",
"resolution": "",
"inner_resolution": "",
"custom_one": "",
"custom_two": "",
"custom_three": "",
"custom_four": "",
"custom_five": "",
"phone": "",
"phone_formatted": "",
"phone_voip": "",
"phone_carrier": "",
"phone_type": "",
"phone_dialing_code": 0,
"phone_do_not_call": false,
"phone_activity": "",
"phone_is_callable": false,
"phone_can_receive_texts": false,
"md5": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
"sha1": "",
"address": "123 Main St",
"city": "Washington",
"region_name": "DC",
"zip": "20001",
"country": "United States",
"age": 45,
"gender": "Male",
"multilingual": false,
"marital_status": "Married",
"ethnic_group": "",
"generation": "Generation X",
"political_party": "Independent",
"religion": "Christian",
"education": "College Graduate",
"occupation_detail": "Professional",
"income_hh": "$100,000 - $150,000",
"net_worth_hh": "$500,000 - $999,999",
"income_levels": "",
"credit_range": "750-799",
"new_credit_offered_hh": false,
"amex_card": false,
"bank_card": false,
"owns_investments": false,
"premium_amex_card": false,
"premium_card": false,
"owns_stocks_and_bonds": false,
"political_contributor": false,
"premium_income_hh": "",
"income_midpts_hh": 0,
"home_owner": "Home Owner",
"dwelling_type": "Single Family",
"home_heat_type": "",
"home_price": 350000,
"home_purchased_years_ago": 5,
"home_value": 400000,
"mortgage_age": 5,
"mortgage_amount": 280000,
"mortgage_loan_type": "Conventional",
"mortgage_refi_age": 2,
"mortgage_refi_amount": "250000",
"mortgage_refi_type": "Fixed",
"urbanicity": "Urban",
"child_aged_0_3_hh": 0,
"child_aged_4_6_hh": 1,
"child_aged_7_9_hh": 1,
"child_aged_10_12_hh": 0,
"child_aged_13_18_hh": 0,
"veteran_hh": 0,
"num_persons_hh": 4,
"num_adults_hh": 2,
"num_children_hh": 2,
"number_of_vehicles_in_hh": 2,
"ledger": {
"credits_pixel_total": 500,
"credits_team_balance": 10000,
"credits_team_today": 1,
"credits_pixel_today": 1
}
}
},
"message": "Success"
}
}
}

Response Object

The response object for all API calls adheres to the following structure:

export interface ApiResponseType {
code: number;
message: string;
data: sdk.JSONValue;
}
  • code: Indicates the result of the operation.
    • 200: Successful operation.
    • 400: Client error, such as invalid input.
    • 500: Server error.
  • message: A descriptive message about the operation's outcome.
  • data: Contains the result of the operation. For errors, this will be an empty object.

For all error responses, the data field will be an empty object, and the message field will describe the issue encountered.


Contact

For additional support or questions about the Email API, contact our development team at [email protected].