Get Variables API

Overview

The Get Variables API endpoint retrieves variables and their values for the current user or device.

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

The HTTP method is GET for the GET Variables API

Body Parameters

ParameterDescriptionTypeExampleRequired/Optional
identityUniquely identifies the user. It can be the user’s email, phone number, or any other identifier you use to tag your users.String("[email protected]" / Martin )Required

(If identity is provided, guidbecomes optional)
`guidUniquely identifies the user with CleverTap Global Object ID.Stringβ€œ34322425"Optional
(If guid is provided, identity becomes optional)
includeDefaultsDetermines whether the response should include default values for variables that do not have set override values.Booleanfalse (default)Optional

πŸ“˜

Note

If the profile or GUID does not exist, the API returns the default values for all defined variables. It does not create new profiles.

Sample Request

curl -X GET -d '{"identity":"[email protected]","objectId":"34322425","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 API may return the following 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 deviceThe 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.