• Version: 1.2.0

Settings

The settings endpoint allows you to control some global API behaviors in your store. Unlike other endpoints, there aren’t multiple settings entries; there’s just one set of field-value pairs. All settings apply across all store data.

This endpoint can access the following settings:

Key Type Details
per_page Integer The default number of entries returned when multiple results are paginated.
return_variations Choice Whether product variations will be returned with any list of products.
quantity_greater_stock Choice Determines whether you allow purchases of products whose stock_level is listed as out of stock.
email_from_address String The email address to use as the sender when sending mail using email templates.
email_from_name String The name to use as the sender when sending mail using email templates.
mail_smtp_host String The address of the mail server that will send all emails generated through email templates.
email_smtp_port Integer The port number associated with the SMTP host address.
email_smtp_username String The login user name used to access the SMTP host.
email_smtp_password String The password associated with the user name on the SMTP server.
email_owner String The primary email address for the store.
email_encryption String Determines whether the SMTP server uses TLS encryption. Valid values are “tls” and “none”.
timezone String  
password_strength_validation String Determines how strong customer passwords must be. Pass one of the following strings: - min_6_letters - At least six alphanumeric characters long. - min_6_letters_case_diff_numbers - At least six alphanumeric characters, including one upper and one lower case letter and one number. - min_8_letters_case_diff_numbers_symbols - At least eight characters, including one upper and one lower case letter, one number, and one non-alphanumeric character.

All settings are automatically set to default values when you create a new store. Settings are hardcoded in that you cannot create new setting fields or destroy existing settings.

Before you can use this (or any endpoint), you need to authenticate to get a bearer token.

This topic will cover the following processes:

Retrieve All Settings

To view the current values of all settings, send a GET call to the settings enpoint.

curl -X GET https://api.molt.in/v1/settings \
  -H "Authorization: Bearer XXXX"

On success, this will return an HTML status code of 200 OK and a JSON array of all settings and values. By default, that array looks like this:

{
  "status":true,
  "result":
  {
    "order":null,
    "per_page":10,
    "return_variations":
    {
      "value":"No",
      "data":
      {
        "key":"0",
        "value":"No"
      }
    },
    "quantity_greater_stock":
    {
      "value":"Yes",
      "data":
      {
        "key":"1",
        "value":"Yes"
      }
    },
    "email_from_address":"",
    "email_from_name":"",
    "email_smtp_host":"",
    "email_smtp_port":587,
    "email_smtp_username":"",
    "email_smtp_password":"",
    "email_owner":"",
    "email_encryption":
    {
      "value":"None",
      "data":
      {
        "key":"none",
        "value":"None"
      }
    },
    "timezone":
    {
      "value":"(UTC+00:00) London",
      "data":
      {
        "key":"EuropeXXXLondon",
        "value":"(UTC+00:00) London"
      }
    },
    "cache_enabled":
    {
      "value":"No",
      "data":
      {
        "key":"0",
        "value":"No"
      }
    },
    "password_strength_validation":
    {
      "value":"Medium (DEFAULT) (>= 6 alphanumeric characters, one uppercase letter and one number)",
      "data":
      {
        "key":"min_6_letters_case_diff_numbers",
        "value":"Medium (DEFAULT) (>= 6 alphanumeric characters, one uppercase letter and one number)"
      }
    }
  }
}

Change a Setting

To configure a setting, send a PUT call to the settings endpoint with the setting key and new value. Many of the settings require specific values as input, so consult the table at the top of this section to find out what values are valid for these settings.

curl -X PUT https://api.molt.in/v1/settings \
  -H "Authorization: Bearer XXXX" \
  -d "email_from_address=person@example.com"

On success, this will return 200 OK and a JSON array of the updated settings and values.