curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/snapchat/audiences/8c1e2f3a-0000-4000-8000-000000000101/users \
-d '{"accountId": "5a0d1b2c-0000-4000-8000-000000000003", "schema": ["EMAIL"], "data": [["5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"], ["a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01"]]}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/snapchat/audiences/8c1e2f3a-0000-4000-8000-000000000101/users", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
accountId: "5a0d1b2c-0000-4000-8000-000000000003",
schema: ["EMAIL"],
data: [
["5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"],
["a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01"]
]
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {
'accountId': '5a0d1b2c-0000-4000-8000-000000000003',
'schema': ['EMAIL'],
'data': [
['5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7'],
['a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01']
]
}
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer API_KEY'}
r = requests.post('https://api.ayrshare.com/api/ads/snapchat/audiences/8c1e2f3a-0000-4000-8000-000000000101/users', json=payload, headers=headers)
print(r.json())
{
"status": "success",
"id": "8c1e2f3a-0000-4000-8000-000000000101",
"received": 2,
"invalid": 0,
"batches": 1
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "data[1][0] (EMAIL) is not a hash: expected 64 lowercase hex characters."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "schema takes one key per request on snapchat: send EMAIL, PHONE and MADID in separate requests."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "id 8c1e2f3a-0000-4000-8000-000000000102 is a lookalike audience; members can be added to or removed from a customerList audience only."
}
Snapchat Ads
Audience Members
Snapchat customer-list segment में लोगों को जोड़ें या हटाएँ, उनके email, phone या mobile ad id के SHA-256 hashes भेजकर।
POST
/
ads
/
snapchat
/
audiences
/
{id}
/
users
curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/snapchat/audiences/8c1e2f3a-0000-4000-8000-000000000101/users \
-d '{"accountId": "5a0d1b2c-0000-4000-8000-000000000003", "schema": ["EMAIL"], "data": [["5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"], ["a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01"]]}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/snapchat/audiences/8c1e2f3a-0000-4000-8000-000000000101/users", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
accountId: "5a0d1b2c-0000-4000-8000-000000000003",
schema: ["EMAIL"],
data: [
["5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"],
["a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01"]
]
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {
'accountId': '5a0d1b2c-0000-4000-8000-000000000003',
'schema': ['EMAIL'],
'data': [
['5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7'],
['a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01']
]
}
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer API_KEY'}
r = requests.post('https://api.ayrshare.com/api/ads/snapchat/audiences/8c1e2f3a-0000-4000-8000-000000000101/users', json=payload, headers=headers)
print(r.json())
{
"status": "success",
"id": "8c1e2f3a-0000-4000-8000-000000000101",
"received": 2,
"invalid": 0,
"batches": 1
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "data[1][0] (EMAIL) is not a hash: expected 64 lowercase hex characters."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "schema takes one key per request on snapchat: send EMAIL, PHONE and MADID in separate requests."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "id 8c1e2f3a-0000-4000-8000-000000000102 is a lookalike audience; members can be added to or removed from a customerList audience only."
}
Audience बनाएँ (
type: customerList) से बने customer-list segment में लोगों को जोड़ें, या उन्हें हटाएँ। आप हर व्यक्ति को एक normalized identifier के SHA-256 hash के रूप में भेजते हैं; Snapchat hashes को accounts से match करता है; raw values कभी आपके system से बाहर नहीं जातीं।
DELETE /ads/snapchat/audiences/{id}/users वही body लेता है और इसके बजाय लोगों को हटाता है।
- हर request में एक identifier: emails, phones और mobile ad ids अलग-अलग requests में भेजें।
- हर request में अधिकतम 10,000 rows और अधिकतम 10 MiB की body होती है। बड़ी list को कई requests में भेजें।
- जब Snapchat पर्याप्त लोगों को match कर लेता है, तब segment boost में उपयोग किया जा सकता है। तब Audiences
status.readyदिखाता है। - id,
accountIdमें बताए गए ad account का customer-list segment होना चाहिए। कोई भी अन्य id, हटाया गया या अज्ञात id भी,code: 101के साथ400लौटाता है, और कुछ भी नहीं भेजा जाता।
Hashed identifiers personal data हैं
Hashed email या phone number भी GDPR और इसी तरह के कानूनों के तहत personal data है। जब आप list upload करते हैं:- आप data controller हैं। विज्ञापन के लिए list के लोगों का data उपयोग करने के लिए आपको एक lawful basis चाहिए, आमतौर पर उनकी सहमति, जैसा आपकी privacy policy और Snapchat की advertising terms माँगती हैं।
- Ayrshare एक processor है। हम hashes को Snapchat तक पहुँचाते हैं और गिनती के अलावा कुछ नहीं रखते: body की कोई row log, cache या store नहीं की जाती, और response कभी कोई row वापस नहीं दिखाता।
- भेजने से पहले आप hash करते हैं। Ayrshare कभी आपके लिए hash नहीं करता। जो मान hash नहीं है, उसे Snapchat को कुछ भी भेजे जाने से पहले अस्वीकार कर दिया जाता है।
Hash कैसे करें
हर मान को वैसे normalize करें जैसा Snapchat के customer list rules बताते हैं, फिर उसे SHA-256 से hash करें और परिणाम 64 lowercase hex characters के रूप में भेजें। संक्षेप में:EMAIL: spaces हटाएँ और lowercase करें, उदाहरण के लिएjane@example.com।PHONE: केवल अंक, country code के साथ, शुरुआती00या राष्ट्रीय शुरुआती0के बिना, उदाहरण के लिए14155551234या448444124653।MADID: mobile ad id (IDFA या Android advertising id) lowercase में, hyphens को बनाए रखते हुए।
हैडर पैरामीटर
पाथ पैरामीटर
Customer-list segment id, Audience बनाएँ या Audiences से।
बॉडी पैरामीटर
Rows में मौजूद एक identifier:
["EMAIL"], ["PHONE"] या ["MADID"]। ये वही नाम हैं जो Facebook और Instagram लेते हैं।हर व्यक्ति के लिए एक row: व्यक्ति के SHA-256 hash वाला array, 64 lowercase hex characters के रूप में। अधिकतम 10,000 rows।ऐसा cell जो इस तरह का hash नहीं है, गलत चौड़ाई वाली row, असमर्थित key या एक से ज़्यादा key, Snapchat को कुछ भी भेजे जाने से पहले
code: 101 के साथ 400 लौटाता है। संदेश row और column का नाम बताता है, मान का कभी नहीं, उदाहरण के लिए data[1][0] (EMAIL) is not a hash: expected 64 lowercase hex characters.Response
केवल गिनती:received: Snapchat द्वारा ली गई rows।invalid: वे rows जिन्हें Snapchat ने नहीं लिया।batches: rows कितने uploads में भेजी गईं।
curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/snapchat/audiences/8c1e2f3a-0000-4000-8000-000000000101/users \
-d '{"accountId": "5a0d1b2c-0000-4000-8000-000000000003", "schema": ["EMAIL"], "data": [["5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"], ["a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01"]]}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/snapchat/audiences/8c1e2f3a-0000-4000-8000-000000000101/users", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
accountId: "5a0d1b2c-0000-4000-8000-000000000003",
schema: ["EMAIL"],
data: [
["5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"],
["a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01"]
]
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {
'accountId': '5a0d1b2c-0000-4000-8000-000000000003',
'schema': ['EMAIL'],
'data': [
['5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7'],
['a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01']
]
}
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer API_KEY'}
r = requests.post('https://api.ayrshare.com/api/ads/snapchat/audiences/8c1e2f3a-0000-4000-8000-000000000101/users', json=payload, headers=headers)
print(r.json())
{
"status": "success",
"id": "8c1e2f3a-0000-4000-8000-000000000101",
"received": 2,
"invalid": 0,
"batches": 1
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "data[1][0] (EMAIL) is not a hash: expected 64 lowercase hex characters."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "schema takes one key per request on snapchat: send EMAIL, PHONE and MADID in separate requests."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "id 8c1e2f3a-0000-4000-8000-000000000102 is a lookalike audience; members can be added to or removed from a customerList audience only."
}