curl -X POST https://api.ayrshare.com/api/ads/snapchat/boost \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-d '{
"accountId": "5a0d0000-0000-4000-8000-000000000003",
"socialPostId": "6f1c2d3e-0000-4000-8000-00000000000a",
"goal": "brand_awareness",
"budget": { "amount": 20, "type": "daily" },
"targeting": { "locations": { "countries": ["US"] } },
"platformOptions": { "snapchat": { "placements": ["INTERSTITIAL_USER", "INSTREAM"] } }
}'
{
"status": "success",
"id": "c3a1e2d4-0000-4000-8000-0000000000ad",
"platform": "snapchat",
"adStatus": "ACTIVE",
"budget": { "amount": 20, "type": "daily", "level": "adSet", "currency": "USD" },
"schedule": { "start": 1791892800000 },
"platformIds": {
"mediaId": "b7f0e2d4-0000-4000-8000-0000000000me",
"creativeId": "a1b2c3d4-0000-4000-8000-0000000000cr",
"campaignId": "d4c3b2a1-0000-4000-8000-0000000000ca",
"adSquadId": "e5f6a7b8-0000-4000-8000-0000000000sq",
"adId": "c3a1e2d4-0000-4000-8000-0000000000ad"
}
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "platformOptions.snapchat.placements: CHAT_FEED cannot run alone: add one of INTERSTITIAL_USER, INTERSTITIAL_CONTENT beside it."
}
{
"action": "ads",
"status": "error",
"code": 369,
"message": "Unable to boost post. Please try again.",
"details": "Snapchat is still preparing Snap 6f1c2d3e-0000-4000-8000-00000000000a for ads. No ad was created and nothing spends. Try again in a few minutes with a new idempotency key."
}
{
"action": "rate limit",
"status": "error",
"code": 364,
"message": "You are making too many requests. Please reduce the number of requests.",
"details": "<Snapchat's own message about the rate limit>"
}
Snapchat Ads
推廣貼文
將 Snapchat Public Profile 的 Snap 推廣為廣告。Ayrshare 建立廣告活動、ad squad 和廣告,設定目標、預算與受眾。
POST
/
ads
/
snapchat
/
boost
curl -X POST https://api.ayrshare.com/api/ads/snapchat/boost \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-d '{
"accountId": "5a0d0000-0000-4000-8000-000000000003",
"socialPostId": "6f1c2d3e-0000-4000-8000-00000000000a",
"goal": "brand_awareness",
"budget": { "amount": 20, "type": "daily" },
"targeting": { "locations": { "countries": ["US"] } },
"platformOptions": { "snapchat": { "placements": ["INTERSTITIAL_USER", "INSTREAM"] } }
}'
{
"status": "success",
"id": "c3a1e2d4-0000-4000-8000-0000000000ad",
"platform": "snapchat",
"adStatus": "ACTIVE",
"budget": { "amount": 20, "type": "daily", "level": "adSet", "currency": "USD" },
"schedule": { "start": 1791892800000 },
"platformIds": {
"mediaId": "b7f0e2d4-0000-4000-8000-0000000000me",
"creativeId": "a1b2c3d4-0000-4000-8000-0000000000cr",
"campaignId": "d4c3b2a1-0000-4000-8000-0000000000ca",
"adSquadId": "e5f6a7b8-0000-4000-8000-0000000000sq",
"adId": "c3a1e2d4-0000-4000-8000-0000000000ad"
}
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "platformOptions.snapchat.placements: CHAT_FEED cannot run alone: add one of INTERSTITIAL_USER, INTERSTITIAL_CONTENT beside it."
}
{
"action": "ads",
"status": "error",
"code": 369,
"message": "Unable to boost post. Please try again.",
"details": "Snapchat is still preparing Snap 6f1c2d3e-0000-4000-8000-00000000000a for ads. No ad was created and nothing spends. Try again in a few minutes with a new idempotency key."
}
{
"action": "rate limit",
"status": "error",
"code": 364,
"message": "You are making too many requests. Please reduce the number of requests.",
"details": "<Snapchat's own message about the rate limit>"
}
推廣您的 Snapchat 公開個人檔案所發布的 Snap。Ayrshare 會將該 Snap 加入您的廣告帳戶,等待 Snapchat 完成準備,然後在您的 Snapchat 廣告帳戶中建立創意、活動、廣告組(ad squad)和廣告。
- Snapchat 廣告需按帳戶個別開通。請聯絡我們以啟用此功能。
- 請連結 Snapchat。該連結已包含廣告權限(
snapchat-marketing-api),因此您不需要重新連結。 - 如果 Snapchat 不再接受您的連結(例如因為在 Snapchat 中移除了存取權限),所有 Snapchat 廣告請求都會返回
code: 420與 HTTP 401。請重新連結 Snapchat 後重試。 - 預算設定在廣告組上,使用您廣告帳戶的貨幣。請勿傳送
budget.currency或budget.level: "campaign"。 - 最低預算為您廣告帳戶貨幣的 5 個單位。
- Snapchat 通常會在幾秒內準備好 Snap。若 45 秒內仍未準備好,回應會是
code: 369,且不會建立任何廣告,因此不會產生花費。請在幾分鐘後使用新的idempotencyKey重試。 - 如果 Snapchat 完全無法準備好 Snap,回應同樣會是
code: 369,且details會說明 Snapchat 無法準備該 Snap。重試該 Snap 沒有幫助:請確認它仍在您的公開個人檔案中,或推廣其他 Snap。 - 僅能定位國家/地區。
targeting.locations.regions、targeting.locations.cities、targeting.excludedLocations、targeting.keywords和attachTo都會返回code: 101。 - Snapchat 會審核每則新廣告。在核准之前,該廣告在已推廣廣告中的
review.status為PENDING。 - 若 Snapchat 無法開啟新廣告,推廣仍會建立,且回應會帶有
warning。通常廣告會處於暫停狀態(adStatus為PAUSED):請透過狀態更新來恢復它。若 Snapchat 回報廣告正在投放,adStatus為ACTIVE:若您不希望它上線,請透過狀態更新將其暫停。在少數情況下,Snapchat 無法確認廣告的狀態,此時adStatus為UNKNOWN:請勿恢復該廣告,並提供廣告 ID 與我們聯絡。 - 若您傳送請求的速度超過 Snapchat 允許的範圍,回應會是
code: 364,HTTP 狀態為 429,且details中包含 Snapchat 的訊息。請等待一分鐘後重試。若您傳送了idempotencyKey,請使用新的金鑰重試:相同的金鑰會重播code: 364的回應。
廣告目標
brand_awareness:向盡可能多的人展示該 Snap。video_views:取得影片 Snap 的觀看次數。traffic:將使用者導向您的網站。需要搭配含有https://連結的callToAction。
鎖定受眾區隔
若要觸及或排除你的 Snapchat 受眾區隔中的人,請傳送targeting.audiences 和 targeting.excludedAudiences。兩者都是來自受眾的區隔 ID 清單:你的顧客名單、網站訪客和類似受眾。可透過建立受眾或在 Snapchat Ads Manager 中建立它們。
{
"accountId": "5a0d1b2c-0000-4000-8000-000000000003",
"postId": "Ut1fWU6XkqkMayHGnJZ",
"goal": "brand_awareness",
"budget": { "amount": 20, "type": "daily" },
"targeting": {
"locations": { "countries": ["US"] },
"audiences": ["8c1e2f3a-0000-4000-8000-000000000101"],
"excludedAudiences": ["8c1e2f3a-0000-4000-8000-000000000103"]
}
}
- 廣告會觸及你鎖定的國家和年齡範圍內同時屬於這些區隔的人,並且永遠不會觸及被排除區隔中的人。
- 每個清單至少包含一個 ID。空清單會回傳
code: 101:請改為省略該欄位。 - Snapchat 只會在區隔就緒後鎖定它,也就是 Snapchat 已比對到足夠多的人時。推廣前請在受眾中檢查
status.ready。
請求頭參數
請求體參數
要推廣的 Ayrshare 貼文 ID。請傳送
postId 或 socialPostId。對於透過 Ayrshare 發布的 Snapchat 限時動態,請單獨傳送 postId:即使該限時動態包含多個 Snap,Ayrshare 也會推廣該貼文所新增的 Snap,且廣告會保持與該貼文的連結。單獨傳送的 postId 必須是 Ayrshare 發布到 Snapchat 的貼文,否則推廣會失敗並回傳 code: 369。如果同時傳送兩者,由 socialPostId 決定推廣哪個 Snap,且 postId 必須是您自己的貼文之一,否則推廣會失敗並回傳 code: 369。要推廣的 Snap 的 ID。這是貼文 Snapchat 結果中的
mediaId。您也可以傳送該結果中的限時動態 id:Ayrshare 會推廣該限時動態中的 Snap。包含多個 Snap 的限時動態會返回錯誤 101,因此請改為單獨傳送貼文的 postId,或傳送 Snap 的 mediaId。其中一個廣告目標。
顯示 子屬性
顯示 子屬性
要排除的受眾區隔 ID,來自受眾。
traffic 目標必填,且僅在該目標下接受。此推廣請求的唯一非空金鑰。使用相同的金鑰重試相同的請求內容,可避免建立重複的廣告:系統會重播第一次的回應,包括錯誤。以不同的請求內容或平台重複使用該金鑰會返回 HTTP 409。仍在處理中的請求也會返回 409;無法使用的保留會返回 503,且不會建立廣告。在收到
code: 369「仍在準備中」或 code: 364 速率限制後,請使用新的金鑰重試。顯示 子屬性
顯示 子屬性
廣告在 Snapchat 上的顯示位置:
INTERSTITIAL_USER、INTERSTITIAL_CONTENT、INTERSTITIAL_SPOTLIGHT、INSTREAM、INSTREAM_SPOTLIGHT、PUBLIC_STORIES_INSTREAM 或 CHAT_FEED。省略此欄位則由 Snapchat 選擇。CHAT_FEED需要traffic目標,並須同時搭配INTERSTITIAL_USER或INTERSTITIAL_CONTENT。INTERSTITIAL_SPOTLIGHT需要同時搭配另一個版位,且必須是影片 Snap。
curl -X POST https://api.ayrshare.com/api/ads/snapchat/boost \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-d '{
"accountId": "5a0d0000-0000-4000-8000-000000000003",
"socialPostId": "6f1c2d3e-0000-4000-8000-00000000000a",
"goal": "brand_awareness",
"budget": { "amount": 20, "type": "daily" },
"targeting": { "locations": { "countries": ["US"] } },
"platformOptions": { "snapchat": { "placements": ["INTERSTITIAL_USER", "INSTREAM"] } }
}'
{
"status": "success",
"id": "c3a1e2d4-0000-4000-8000-0000000000ad",
"platform": "snapchat",
"adStatus": "ACTIVE",
"budget": { "amount": 20, "type": "daily", "level": "adSet", "currency": "USD" },
"schedule": { "start": 1791892800000 },
"platformIds": {
"mediaId": "b7f0e2d4-0000-4000-8000-0000000000me",
"creativeId": "a1b2c3d4-0000-4000-8000-0000000000cr",
"campaignId": "d4c3b2a1-0000-4000-8000-0000000000ca",
"adSquadId": "e5f6a7b8-0000-4000-8000-0000000000sq",
"adId": "c3a1e2d4-0000-4000-8000-0000000000ad"
}
}
{
"action": "request",
"status": "error",
"code": 101,
"message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
"details": "platformOptions.snapchat.placements: CHAT_FEED cannot run alone: add one of INTERSTITIAL_USER, INTERSTITIAL_CONTENT beside it."
}
{
"action": "ads",
"status": "error",
"code": 369,
"message": "Unable to boost post. Please try again.",
"details": "Snapchat is still preparing Snap 6f1c2d3e-0000-4000-8000-00000000000a for ads. No ad was created and nothing spends. Try again in a few minutes with a new idempotency key."
}
{
"action": "rate limit",
"status": "error",
"code": 364,
"message": "You are making too many requests. Please reduce the number of requests.",
"details": "<Snapchat's own message about the rate limit>"
}