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 公开个人资料(Public Profile)发布的 Snap。Ayrshare 会将该 Snap 添加到您的广告账户,等待 Snapchat 将其准备就绪,然后在您的 Snapchat 广告账户中创建广告创意、广告活动、广告组(ad squad)和广告。
- Snapchat 广告需按账户单独开通。请联系我们以启用该功能。
- 关联 Snapchat。该关联已包含广告权限(
snapchat-marketing-api),因此您无需重新关联。 - 如果 Snapchat 不再接受您的关联(例如因为在 Snapchat 中移除了访问权限),所有 Snapchat 广告请求都将返回
code: 420和 HTTP 401。请重新关联 Snapchat 后重试。 - 预算设置在广告组(ad squad)上,使用您广告账户的币种。请勿发送
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 快拍(Story),请单独发送 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>"
}