Get Variables API

Overview

The Get API endpoint retrieves Variables and their values for the current user or device. If the profile or clevertap ID does not exist, the API returns the default values or values associated with all users for the variables. It does not generate new profiles or devices.

Endpoint

Here is a base sample endpoint from the account in the India region:
https://in1.api.clevertap.com/1/getVars

Authentication

Authentication is required using accountId and passcode headers.

Headers

Refer to Headers for more details.

Region

Refer to Regions to view region-specific sample endpoints

HTTP Method

POST

Body Parameters

ParameterDescriptionTypeExampleRequired/Optional
identityThis indicates an identity to recognize a unique user. It can be the user’s email ID, phone number, or any other identifier that you are using to tag your users.String("[email protected]" / user )Required

(Either identity or guid is required)
clevertapIdIdentify a unique user by CleverTap Global Object ID.Stringβ€œ12345678"Optional
(Either identity or clevertapId is required)
includeDefaultsThis parameter determines if the response must return the default values of Variables that do not have set override.Booleanfalse (default)Optional

πŸ“˜

Note

In case the identity or clevertapId does not exist, the API returns all defined Variables default values. New user profiles are not created.

Sample Request

curl -X POST -d '{"identity":"[email protected]","cleverTapId":"12345678","includeDefaults":false}' "https://in1.api.clevertap.com/1/getVars" \
-H "X-CleverTap-Account-Id: ACCOUNT_ID" \
-H "X-CleverTap-Passcode: PASSCODE" \
-H "Content-Type: application/json; charset=utf-8"

Sample Response

{
    "variables": {
      	"zFolderA.aVariable": 9.9,
        "zFolderA.AVariable": 10.0,
        "variableB": 9.9,
        "zFolderB.dummy": 10.1,
        "zFolderA.zFolder.dummy": 25.0,
        "variableA": 10.0},
    "status": "success"
}

Errors

The Get Variables endpoint can return some of the following warnings or errors:

Error NameReason
Profile not foundThe user profile could not be located.
Profile lookup is not available at the momentAccess to user profile lookup is currently unavailable.
Blacklisted deviceThis device is blacklisted.
Given identity is not in device profile identitiesThe provided identity does not match any identities associated with the device.
Something happened. Contact the support.An unexpected error. Contact support for assistance.