curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/instagram/audiences/23851234567890123/users \
-d '{"accountId": "1234567890", "schema": ["EMAIL", "PHONE"], "data": [["5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7", "a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01"]]}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/instagram/audiences/23851234567890123/users", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"accountId": "1234567890",
"schema": [
"EMAIL",
"PHONE"
],
"data": [
[
"5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7",
"a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01"
]
]
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY', 'Content-Type': 'application/json'}
payload = {
"accountId": "1234567890",
"schema": [
"EMAIL",
"PHONE"
],
"data": [
[
"5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7",
"a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01"
]
]
}
r = requests.post('https://api.ayrshare.com/api/ads/instagram/audiences/23851234567890123/users', json=payload, headers=headers)
print(r.json())
{
"status": "success",
"id": "23851234567890123",
"received": 1,
"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[0][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": "data has 12000 rows; the limit is 10000 per request."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "id 23851234567890123 is not a custom audience of ad account 123456789."
}
{
"action": "request",
"status": "error",
"code": 525,
"message": "The request body is too large. Please reduce the size of the request."
}
{
"action": "ads",
"status": "error",
"code": 369,
"message": "Unable to add people to the audience. Please try again.",
"details": "Meta's reason"
}
Instagram Ads
Audience Members
Instagram customer-list audience में लोगों को जोड़ें या हटाएँ, उनके email, phone या अन्य identifiers के SHA-256 hashes भेजकर।
POST
/
ads
/
instagram
/
audiences
/
{id}
/
users
curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/instagram/audiences/23851234567890123/users \
-d '{"accountId": "1234567890", "schema": ["EMAIL", "PHONE"], "data": [["5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7", "a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01"]]}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/instagram/audiences/23851234567890123/users", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"accountId": "1234567890",
"schema": [
"EMAIL",
"PHONE"
],
"data": [
[
"5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7",
"a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01"
]
]
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY', 'Content-Type': 'application/json'}
payload = {
"accountId": "1234567890",
"schema": [
"EMAIL",
"PHONE"
],
"data": [
[
"5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7",
"a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01"
]
]
}
r = requests.post('https://api.ayrshare.com/api/ads/instagram/audiences/23851234567890123/users', json=payload, headers=headers)
print(r.json())
{
"status": "success",
"id": "23851234567890123",
"received": 1,
"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[0][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": "data has 12000 rows; the limit is 10000 per request."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "id 23851234567890123 is not a custom audience of ad account 123456789."
}
{
"action": "request",
"status": "error",
"code": 525,
"message": "The request body is too large. Please reduce the size of the request."
}
{
"action": "ads",
"status": "error",
"code": 369,
"message": "Unable to add people to the audience. Please try again.",
"details": "Meta's reason"
}
Audience बनाएँ से बनाई गई customer-list audience (
type: customerList) में लोगों को जोड़ें, या उन्हें हटाएँ। आप हर व्यक्ति को उसके normalized identifiers के SHA-256 hashes के रूप में भेजते हैं; Meta hashes का accounts से मिलान करता है; raw मान कभी आपके सिस्टम से बाहर नहीं जाते।
DELETE /ads/instagram/audiences/{id}/users वही body लेता है और इसके बजाय लोगों को हटाता है।
- Meta के कम से कम 100 लोगों का मिलान करने पर सूची boost में उपयोग की जा सकती है, जिसमें 48 घंटे तक लग सकते हैं। ऐसा होने पर Audiences
status.readyदिखाता है। - हर request में अधिकतम 10,000 rows और अधिकतम 10 MiB की body होती है। बड़ी सूची कई requests में भेजें।
- GraphQL के ज़रिए,
addAdAudienceUsersऔरremoveAdAudienceUsersछोटा batch ले जाते हैं: एकschemacolumn के साथ लगभग 900 rows, ज़्यादा columns के साथ कम। बड़े GraphQL request कोRequest body too large.मिलता है। पूरे 10,000-row batches इन REST endpoints पर भेजें। - अगर बड़े upload का कोई एक request विफल होता है, तो उससे पहले के requests audience में बने रहते हैं। विफल request दोबारा भेजें: Meta duplicate rows हटा देता है।
- Id,
accountIdसे बताए गए ad account की custom audience होनी चाहिए। कोई भी अन्य idcode: 101वाला400लौटाता है।
Hashed identifiers personal data हैं
Hashed email या phone number फिर भी GDPR और इसी तरह के कानूनों के तहत personal data है। जब आप सूची upload करते हैं:- आप data controller हैं। विज्ञापन के लिए लोगों का डेटा उपयोग करने के लिए आपको एक कानूनी आधार चाहिए, आमतौर पर सूची के लोगों की सहमति, जैसा आपकी privacy policy और Meta की Custom Audience terms माँगती हैं।
- Ayrshare एक processor है। हम hashes को Meta तक पहुँचाते हैं और counts के अलावा कुछ नहीं रखते: body की कोई row log, cache या store नहीं की जाती, और response कभी कोई row नहीं दोहराता।
- भेजने से पहले hash आप करते हैं। Ayrshare कभी आपके लिए hash नहीं करता। जो मान hash नहीं है, उसे Meta को कुछ भी भेजे जाने से पहले अस्वीकार कर दिया जाता है।
Hash कैसे करें
हर मान को Meta के customer list rules के अनुसार normalize करें, फिर उसे SHA-256 से hash करें और परिणाम को 64 lowercase hex characters के रूप में भेजें। संक्षेप में:EMAIL: spaces हटाएँ और lowercase करें, उदाहरण के लिएjane@example.com।PHONE: सिर्फ़ अंक, country code के साथ और बिना leading zeros या+के, उदाहरण के लिए14155551234।FN,LN,CT,ST,COUNTRY: lowercase, बिना punctuation या spaces के;COUNTRYदो-अक्षर के code के रूप में;STUS राज्य के लिए दो-अक्षर का code, अन्यथा क्षेत्र का नाम।ZIP: lowercase, बिना spaces के; US codes के लिए पहले पाँच अंक।GEN:mयाf।DOBY: चार अंकों का वर्ष।DOBMऔरDOBD: दो अंक।FI: पहले नाम का पहला अक्षर, lowercase में।
हैडर पैरामीटर
पाथ पैरामीटर
Customer-list audience id, Audience बनाएँ या Audiences से।
बॉडी पैरामीटर
हर column में identifier, क्रम से। समर्थित:
EMAIL, PHONE, GEN, DOBY, DOBM, DOBD, FN, LN, FI, CT, ST, ZIP, COUNTRY। Meta MADID, EXTERN_ID और PAGEUID को बिना hash के लेता है, इसलिए वे यहाँ स्वीकार नहीं किए जाते।हर व्यक्ति के लिए एक row: हर
schema column के लिए एक SHA-256 hash वाला array, 64 lowercase hex characters के रूप में। अधिकतम 10,000 rows।ऐसा cell जो इस तरह का hash नहीं है, गलत चौड़ाई वाली row, या असमर्थित key, Meta को कुछ भी भेजे जाने से पहले code: 101 वाला 400 लौटाता है। संदेश row और column बताता है, मान कभी नहीं, उदाहरण के लिए data[1][0] (EMAIL) is not a hash: expected 64 lowercase hex characters.Response
सिर्फ़ counts:received: वे rows जिन्हें Meta ने लिया।invalid: वे rows जिन्हें Meta पढ़ नहीं सका।batches: rows कितने uploads में भेजी गईं।
curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/instagram/audiences/23851234567890123/users \
-d '{"accountId": "1234567890", "schema": ["EMAIL", "PHONE"], "data": [["5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7", "a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01"]]}'
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/ads/instagram/audiences/23851234567890123/users", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"accountId": "1234567890",
"schema": [
"EMAIL",
"PHONE"
],
"data": [
[
"5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7",
"a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01"
]
]
})
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY', 'Content-Type': 'application/json'}
payload = {
"accountId": "1234567890",
"schema": [
"EMAIL",
"PHONE"
],
"data": [
[
"5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7",
"a3f1c2d4e5f60718293a4b5c6d7e8f9012345678abcdef0123456789abcdef01"
]
]
}
r = requests.post('https://api.ayrshare.com/api/ads/instagram/audiences/23851234567890123/users', json=payload, headers=headers)
print(r.json())
{
"status": "success",
"id": "23851234567890123",
"received": 1,
"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[0][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": "data has 12000 rows; the limit is 10000 per request."
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "id 23851234567890123 is not a custom audience of ad account 123456789."
}
{
"action": "request",
"status": "error",
"code": 525,
"message": "The request body is too large. Please reduce the size of the request."
}
{
"action": "ads",
"status": "error",
"code": 369,
"message": "Unable to add people to the audience. Please try again.",
"details": "Meta's reason"
}