Skip to content

Configuration Options

This page documents shared configuration options for both Client to Server and Server to Server integration methods.


Storage Types

The storageType option controls how DeviceAssure caches responses to prevent redundant API calls.

local-storage (default)

DeviceAssure.load({
  licence: '<LICENCE_KEY>',
  storageType: 'local-storage'  // This is the default
});

Uses browser localStorage to cache responses. Stores a JSON string containing the expiry time and response data. The cache persists across browser sessions until it expires or is cleared.

DeviceAssure.load({
  licence: '<LICENCE_KEY>',
  storageType: 'cookie'
});

Uses browser cookies to cache responses. The cookie's expiration time determines when a fresh API call is made.

none

DeviceAssure.load({
  licence: '<LICENCE_KEY>',
  storageType: 'none'
});

Disables caching entirely. Every call to DeviceAssure.load() triggers a fresh API request.

Recommended when:

  • Using IMEI validation (different IMEIs need different results)
  • You need real-time validation on every user action
  • Using Server to Server mode (caching is your server's responsibility)

Note: Using none does not clear existing cache - it simply ignores it.


Cache Expiry

The storageExpiry option sets how long cached responses remain valid.

DeviceAssure.load({
  licence: '<LICENCE_KEY>',
  storageType: 'local-storage',
  storageExpiry: 8 * 60 * 60 * 1000  // 8 hours in milliseconds
});
Value Duration
1800000 30 minutes (default)
3600000 1 hour
86400000 24 hours (maximum)

Once the cache expires, the next call to DeviceAssure.load() will make a fresh API request.


Custom Tags

Tags allow you to attach custom metadata to API requests. This metadata is returned in the response under the meta field.

DeviceAssure.load({
  licence: '<LICENCE_KEY>',
  tags: [
    { key: 'page', value: 'checkout' },
    { key: 'user-type', value: 'premium' },
    { key: 'session-id', value: 'abc123' }
  ]
});

Constraints:

  • Maximum key length: 64 characters
  • Maximum value length: 128 characters
  • Both key and value must be strings

Use cases:

  • Tracking which page triggered validation
  • Correlating validations with user sessions
  • Adding business context to validation results

Note: Custom tag data is NOT stored by DeviceAtlas and is not available for subsequent data retrieval or analysis.


IMEI Corroboration

The imei option enables IMEI corroboration, which validates alignment between the IMEI and device characteristics. This feature can also check if a device has been reported lost or stolen via the GSMA Device Check service.

Note: This feature requires a licence with IMEI enabled. Contact support@deviceassure.com for details.

Configuration

DeviceAssure.load({
  licence: '<LICENCE_KEY>',
  imei: '123456789012345',
  storageType: 'none'  // Recommended with IMEI
});

Requirements

  • Licence must have IMEI feature enabled
  • IMEI must be a non-empty string
  • Leading/trailing whitespace is automatically trimmed

Best Practices

  • Always use storageType: 'none' when validating IMEIs
  • Handle the onError callback for IMEI validation errors

Error Messages

Client to Server:

{ "message": "IMEI is not present, please enable it in config. API request not sent." }

Server to Server:

{ "message": "IMEI is not present, please provide an IMEI." }


See Also