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
オーディエンスメンバー
メール、電話番号、モバイル広告 ID の SHA-256 ハッシュを送り、Snapchat 顧客リストに人を追加・削除します。
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."
}
オーディエンスを作成 (
type: customerList) で作成した顧客リストセグメントに人を追加、または削除します。各人を正規化した 1 つの識別子の SHA-256 ハッシュとして送ります。Snapchat はハッシュをアカウントと照合します。元の値があなたのシステムの外に出ることはありません。
DELETE /ads/snapchat/audiences/{id}/users は同じボディを受け取り、代わりに人を削除します。
- 1 リクエストにつき 1 種類の識別子: メール、電話番号、モバイル広告 ID は別々のリクエストで送ってください。
- 各リクエストは最大 10,000 行、ボディは最大 10 MiB です。それより大きいリストは複数のリクエストに分けて送ってください。
- Snapchat が十分な人を照合すると、セグメントをブーストで使用できます。その時点で オーディエンスに
status.readyが表示されます。 - ID は
accountIdで指定した広告アカウント上の顧客リストセグメントである必要があります。削除済みや不明な ID を含め、それ以外の ID はcode: 101付きの400を返し、何も送信されません。
ハッシュ化した識別子は個人データです
ハッシュ化したメールや電話番号も、GDPR や同様の法律の下では個人データです。リストをアップロードするとき:- あなたがデータ管理者です。 プライバシーポリシーと Snapchat の広告規約が求めるとおり、リスト上の人のデータを広告に使うには、法的根拠 (通常はその人たちの同意) が必要です。
- Ayrshare は処理者です。 ハッシュを Snapchat に渡し、件数以外は何も保持しません: ボディの行がログ記録、キャッシュ、保存されることはなく、レスポンスが行を返すこともありません。
- 送信前にあなたがハッシュ化します。 Ayrshare が代わりにハッシュ化することはありません。ハッシュでない値は、Snapchat に何かが送られる前に拒否されます。
ハッシュ化の方法
Snapchat の顧客リストのルールの説明どおりに各値を正規化し、SHA-256 でハッシュ化して、結果を 64 文字の小文字 16 進数で送ります。要点:EMAIL: 空白を取り除き、小文字にします。例:jane@example.com。PHONE: 数字のみで国番号を含め、先頭の00や国内の先頭の0は付けません。例:14155551234または448444124653。MADID: モバイル広告 ID (IDFA または Android 広告 ID) を小文字で、ハイフンを残したまま指定します。
ヘッダーパラメータ
パスパラメータ
オーディエンスを作成またはオーディエンスで取得した顧客リストセグメント ID。
ボディパラメータ
1 人につき 1 行: その人の SHA-256 ハッシュを 64 文字の小文字 16 進数で含む配列。最大 10,000 行。そのようなハッシュでないセル、幅の誤った行、サポートされていないキー、または複数のキーは、Snapchat に何かが送られる前に
code: 101 付きの 400 を返します。メッセージは値ではなく行と列を示します。例: data[1][0] (EMAIL) is not a hash: expected 64 lowercase hex characters.レスポンス
件数のみ:received: Snapchat が受け付けた行。invalid: Snapchat が受け付けなかった行。batches: 行を送信したアップロードの回数。
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."
}