Best Practices
Learn about the normalization and hashing of identifiers.
Hashing
The most common identifiers for the ATS API are hashed emails. The endpoint accepts common hash types of emails:
- MD5
- SHA1
- SHA256
To obtain the best possible envelope for a user, we recommend calling the API with all three email hash types. If you are only able to hash or obtain one, we recommend SHA256.
If you are sending multiple hash types, you will need to use the it and iv values for each hash. The hash type will automatically be determined by our API.
https://api.rlcdn.com/api/identity/v2/envelope?pid=[placement id]&it=[identifier type]&iv=[hashed identifier 1]&it=[identifier type]&iv=[hashed identifier 2]&ct=[consent type]&cv=[consent string]&atype=[source call]
Phone number identifier (US only)
The ATS Envelope API also supports hashed phone numbers for users in the US. Use only SHA1 hashes to pass such identifiers. Hashed phone numbers are only supported for US, ten-digit phone numbers. Ensure you remove any country codes or formatting before SHA1 hashing, e.g.:
+1 (415) 555-6656 should become 4155556656 before hashing.
Hashing Code Samples
We recommend using a library like jshashes on the web or node.
import hashlib
def get_hashes(message):
hash_result = {}
hash_result['md5'] = hashlib.md5(message).hexdigest()
hash_result['sha1'] = hashlib.sha1(message).hexdigest()
hash_result['sha256'] = hashlib.sha256(message).hexdigest()
return hash_result
input_email = '[email protected] '.lower().strip().encode('utf-8')
print(get_hashes(input_email))
Updated 2 months ago