Update Customer Email Preferences

This call allows you to edit the customer email preferences for a specific customer. You must include all the preference entities in the call to perform the edit action, even if you are not modifying some of those preference entities. They would be set to null (account default) otherwise.

Request Parameters

FieldTypeDescription
customerIdIntegerThis is the Fusebill ID of the customer to whom these preferences apply.
preferencesList of Objects (defined below)This is the list of Preference entities.

Preferences Object Fields

FieldTypeDescription
enabledStringSpecify whether or not the specified email notification is enabled. Values should be one of: "true", "false" or NULL (account default)

Note: To override the account default setting you must specify a value of either "true" or "false"
emailTypeEnum:{InvoicePost, PaymentReceived, InvoiceOverdue, PasswordReset, PaymentFailed, CustomerActivation, SubscriptionActivation, SubscriptionCancellation, CustomerCredentialCreate, CustomerCredentialPasswordReset, CustomerSuspend, PaymentMethodUpdate, CreditCardExpiry, StatementNotification, UpcomingBillingNotification, Refund, PendingExpiryRenewalNotice}Used to specify which email notification the changes apply to.
Request Examples
curl -X PUT "https://secure.fusebill.com/v1/CustomerEmailPreferences" \
	-H "Content-Type: application/json" \
	-H "Authorization: Basic {APIKey}" \
	-d "{'customerId':{customerId},'preferences':[{'enabled':true,'accountDefault':false,'emailType':'CreditCardExpiry','emailCategory':'PaymentsAndRefunds'},{'enabled':false,'accountDefault':false,'emailType':'CustomerActivation','emailCategory':'Customers'},{'enabled':false,'accountDefault':false,'emailType':'CustomerCredentialCreate','emailCategory':'Customers'},{'enabled':false,'accountDefault':true,'emailType':'CustomerCredentialPasswordReset','emailCategory':'Customers'},{'enabled':false,'accountDefault':false,'emailType':'CustomerSuspend','emailCategory':'Customers'},{'enabled':false,'accountDefault':false,'emailType':'InvoiceOverdue','emailCategory':'InvoicesAndStatements'},{'enabled':false,'accountDefault':false,'emailType':'InvoicePost','emailCategory':'InvoicesAndStatements'},{'enabled':false,'accountDefault':true,'emailType':'PaymentFailed','emailCategory':'PaymentsAndRefunds'},{'enabled':false,'accountDefault':false,'emailType':'PaymentMethodUpdate','emailCategory':'PaymentsAndRefunds'},{'enabled':false,'accountDefault':false,'emailType':'PaymentReceived','emailCategory':'PaymentsAndRefunds'},{'enabled':false,'accountDefault':false,'emailType':'PendingExpiryRenewalNotice','emailCategory':'Subscriptions'},{'enabled':true,'accountDefault':false,'emailType':'Refund','emailCategory':'PaymentsAndRefunds'},{'enabled':false,'accountDefault':false,'emailType':'StatementNotification','emailCategory':'InvoicesAndStatements'},{'enabled':false,'accountDefault':false,'emailType':'SubscriptionActivation','emailCategory':'Subscriptions'},{'enabled':false,'accountDefault':false,'emailType':'SubscriptionCancellation','emailCategory':'Subscriptions'},{'enabled':false,'accountDefault':false,'emailType':'UpcomingBillingNotification','emailCategory':'InvoicesAndStatements'}]}"
//Json Payload, Replace this customer Id with the FusebillId of the customer you would like to update
string jsonData = "{'customerId':{customerId},'preferences':[{'enabled':false,'accountDefault':false,'emailType':'CreditCardExpiry','emailCategory':'PaymentsAndRefunds'},{'enabled':false,'accountDefault':false,'emailType':'CustomerActivation','emailCategory':'Customers'},{'enabled':false,'accountDefault':false,'emailType':'CustomerCredentialCreate','emailCategory':'Customers'},{'enabled':false,'accountDefault':true,'emailType':'CustomerCredentialPasswordReset','emailCategory':'Customers'},{'enabled':false,'accountDefault':false,'emailType':'CustomerSuspend','emailCategory':'Customers'},{'enabled':false,'accountDefault':false,'emailType':'InvoiceOverdue','emailCategory':'InvoicesAndStatements'},{'enabled':false,'accountDefault':false,'emailType':'InvoicePost','emailCategory':'InvoicesAndStatements'},{'enabled':false,'accountDefault':true,'emailType':'PaymentFailed','emailCategory':'PaymentsAndRefunds'},{'enabled':false,'accountDefault':false,'emailType':'PaymentMethodUpdate','emailCategory':'PaymentsAndRefunds'},{'enabled':false,'accountDefault':false,'emailType':'PaymentReceived','emailCategory':'PaymentsAndRefunds'},{'enabled':false,'accountDefault':false,'emailType':'PendingExpiryRenewalNotice','emailCategory':'Subscriptions'},{'enabled':true,'accountDefault':false,'emailType':'Refund','emailCategory':'PaymentsAndRefunds'},{'enabled':false,'accountDefault':false,'emailType':'StatementNotification','emailCategory':'InvoicesAndStatements'},{'enabled':false,'accountDefault':false,'emailType':'SubscriptionActivation','emailCategory':'Subscriptions'},{'enabled':false,'accountDefault':false,'emailType':'SubscriptionCancellation','emailCategory':'Subscriptions'},{'enabled':false,'accountDefault':false,'emailType':'UpcomingBillingNotification','emailCategory':'InvoicesAndStatements'}]}";
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/CustomerEmailPreferences");
//Add Content type
request.ContentType = "application/json";
//Add Api key authorization
request.Headers.Add(HttpRequestHeader.Authorization, "Basic "+apiKey);
//Set request method
request.Method = "PUT";
//Add the json data to request
using (var streamWriter = new StreamWriter(request.GetRequestStream()))
{
  streamWriter.Write(jsonData);
  streamWriter.Flush();
  streamWriter.Close();
}
//Perform the request
var httpResponse = (HttpWebResponse)request.GetResponse();
//Record the response from our request
var result = "";
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
  result = streamReader.ReadToEnd();
}
#Import library JSON
import json
#Import library Requests
import requests
#Pass in a dictionary to the Headers parameter
headers = {'Authorization' : 'Basic {APIKey}', 'Content-Type' : 'application/json'}
#Pass in a dictionary to the Payload parameter
payload = {"customerId":{id},"preferences":

[{"enabled":None,"accountDefault":"false","emailType":"CreditCardExpiry","emailCategory":"PaymentsAndRefunds"},

{"enabled":None,"accountDefault":"false","emailType":"CustomerActivation","emailCategory":"Customers"},

{"enabled":None,"accountDefault":"false","emailType":"CustomerCredentialCreate","emailCategory":"Customers"},

{"enabled":None,"accountDefault":"true","emailType":"CustomerCredentialPasswordReset","emailCategory":"Customers"},

{"enabled":None,"accountDefault":"false","emailType":"CustomerSuspend","emailCategory":"Customers"},

{"enabled":None,"accountDefault":"false","emailType":"DraftInvoice","emailCategory":"InvoicesAndStatements"},

{"enabled":None,"accountDefault":"false","emailType":"InvoiceOverdue","emailCategory":"InvoicesAndStatements"},

{"enabled":None,"accountDefault":"false","emailType":"InvoicePost","emailCategory":"InvoicesAndStatements"},

{"enabled":None,"accountDefault":"false","emailType":"PaymentFailed","emailCategory":"PaymentsAndRefunds"},

{"enabled":None,"accountDefault":"false","emailType":"PaymentMethodUpdate","emailCategory":"PaymentsAndRefunds"},

{"enabled":None,"accountDefault":"true","emailType":"PaymentReceived","emailCategory":"PaymentsAndRefunds"},

{"enabled":None,"accountDefault":"false","emailType":"PendingExpiryRenewalNotice","emailCategory":"Subscriptions"},

{"enabled":None,"accountDefault":"false","emailType":"Refund","emailCategory":"PaymentsAndRefunds"},

{"enabled":None,"accountDefault":"false","emailType":"StatementNotification","emailCategory":"InvoicesAndStatements"},

{"enabled":None,"accountDefault":"false","emailType":"SubscriptionActivation","emailCategory":"Subscriptions"},

{"enabled":None,"accountDefault":"false","emailType":"SubscriptionCancellation","emailCategory":"Subscriptions"},

{"enabled":None,"accountDefault":"false","emailType":"UpcomingBillingNotification","emailCategory":"InvoicesAndStatements"}]}
#Pass in your URI, Payload and Headers
r = requests.put('https://secure.fusebill.com/v1/CustomerEmailPreferences', data=json.dumps(payload), headers=headers)
print(r.content)
{
  "customerId": 12661902,
  "preferences": [
    {
      "enabled": true,
      "emailType": "CreditCardExpiry",
      "emailCategory": "PaymentsAndRefunds"
    },
    {
      "enabled": null,
      "emailType": "CustomerActivation",
      "emailCategory": "Customers"
    },
    {
      "enabled": null,
      "emailType": "CustomerCredentialCreate",
      "emailCategory": "Customers"
    },
    {
      "enabled": null,
      "emailType": "CustomerCredentialPasswordReset",
      "emailCategory": "Customers"
    },
    {
      "enabled": null,
      "emailType": "CustomerSuspend",
      "emailCategory": "Customers"
    },
    {
      "enabled": null,
      "emailType": "DraftInvoice",
      "emailCategory": "InvoicesAndStatements"
    },
    {
      "enabled": null,
      "emailType": "InvoiceOverdue",
      "emailCategory": "InvoicesAndStatements"
    },
    {
      "enabled": null,
      "emailType": "InvoicePost",
      "emailCategory": "InvoicesAndStatements"
    },
    {
      "enabled": null,
      "emailType": "PaymentFailed",
      "emailCategory": "PaymentsAndRefunds"
    },
    {
      "enabled": null,
      "emailType": "PaymentMethodUpdate",
      "emailCategory": "PaymentsAndRefunds"
    },
    {
      "enabled": null,
      "emailType": "PaymentReceived",
      "emailCategory": "PaymentsAndRefunds"
    },
    {
      "enabled": null,
      "emailType": "PendingExpiryRenewalNotice",
      "emailCategory": "Subscriptions"
    },
    {
      "enabled": null,
      "emailType": "Refund",
      "emailCategory": "PaymentsAndRefunds"
    },
    {
      "enabled": null,
      "emailType": "StatementNotification",
      "emailCategory": "InvoicesAndStatements"
    },
    {
      "enabled": null,
      "emailType": "SubscriptionActivation",
      "emailCategory": "Subscriptions"
    },
    {
      "enabled": null,
      "emailType": "SubscriptionCancellation",
      "emailCategory": "Subscriptions"
    },
    {
      "enabled": null,
      "emailType": "UpcomingBillingNotification",
      "emailCategory": "InvoicesAndStatements"
    }
  ]
}
Request Response
{
    "customerId": 6737347,
    "preferences": [
        {
            "enabled": false,
            "accountDefault": false,
            "emailType": "CreditCardExpiry",
            "emailCategory": "PaymentsAndRefunds"
        },
        {
            "enabled": false,
            "accountDefault": false,
            "emailType": "CustomerActivation",
            "emailCategory": "Customers"
        },
        {
            "enabled": false,
            "accountDefault": false,
            "emailType": "CustomerCredentialCreate",
            "emailCategory": "Customers"
        },
        {
            "enabled": false,
            "accountDefault": true,
            "emailType": "CustomerCredentialPasswordReset",
            "emailCategory": "Customers"
        },
        {
            "enabled": false,
            "accountDefault": false,
            "emailType": "CustomerSuspend",
            "emailCategory": "Customers"
        },
        {
            "enabled": false,
            "accountDefault": false,
            "emailType": "InvoiceOverdue",
            "emailCategory": "InvoicesAndStatements"
        },
        {
            "enabled": false,
            "accountDefault": false,
            "emailType": "InvoicePost",
            "emailCategory": "InvoicesAndStatements"
        },
        {
            "enabled": false,
            "accountDefault": true,
            "emailType": "PaymentFailed",
            "emailCategory": "PaymentsAndRefunds"
        },
        {
            "enabled": false,
            "accountDefault": false,
            "emailType": "PaymentMethodUpdate",
            "emailCategory": "PaymentsAndRefunds"
        },
        {
            "enabled": false,
            "accountDefault": false,
            "emailType": "PaymentReceived",
            "emailCategory": "PaymentsAndRefunds"
        },
        {
            "enabled": false,
            "accountDefault": false,
            "emailType": "PendingExpiryRenewalNotice",
            "emailCategory": "Subscriptions"
        },
        {
            "enabled": true,
            "accountDefault": false,
            "emailType": "Refund",
            "emailCategory": "PaymentsAndRefunds"
        },
        {
            "enabled": false,
            "accountDefault": false,
            "emailType": "StatementNotification",
            "emailCategory": "InvoicesAndStatements"
        },
        {
            "enabled": false,
            "accountDefault": false,
            "emailType": "SubscriptionActivation",
            "emailCategory": "Subscriptions"
        },
        {
            "enabled": false,
            "accountDefault": false,
            "emailType": "SubscriptionCancellation",
            "emailCategory": "Subscriptions"
        },
        {
            "enabled": false,
            "accountDefault": false,
            "emailType": "UpcomingBillingNotification",
            "emailCategory": "InvoicesAndStatements"
        }
    ]
}
{
    "ErrorId": 0,
    "HttpStatusCode": 404,
    "Errors": [
        {
            "Key": "Api Error",
            "Value": "Customer with id 1 not found."
        }
    ]
}
Language
Authorization