简介
通过托管 OAuth 接入 Snapchat Marketing API,实现广告账户、投放计划、创意素材及受众的完整生命周期管理,支持程序化广告投放与数据追踪。
原始描述
Snapchat Marketing API integration with managed OAuth. Manage ad accounts, campaigns, ad squads, ads, creatives, and audiences. Use this skill when users wan...
通过你的 Agent 添加
点「快速安装」复制一段指令,粘给你正在用的 Agent(Claude Code、Codex、OpenClaw 等),它会自己完成安装。
或者手动安装
包里是 SKILL.md 加作者附带的文件,解压后目录名就是技能名。
技能申请的权限由作者决定,装之前请确认它能读什么、能执行什么。
中文使用说明 来自收录源
核心用法
Snapchat Marketing API Skill 是面向广告主的官方营销接口封装,通过 Maton 网关实现托管式 OAuth 认证,用户无需自建授权流程即可调用 Snapchat 广告平台的全部核心能力。该 Skill 采用 RESTful 设计,所有请求通过 https://gateway.maton.ai/snapchat/v1/ 路由,统一使用 Authorization: Bearer $MATON_API_KEY 头部鉴权。
功能覆盖:
- 组织与账户管理:查询用户所属组织、列出广告账户、管理成员权限与资金源
- 投放架构:Campaign(推广计划)→ Ad Squad(广告组)→ Ad(广告)三级结构,支持预算分配、出价策略、排期设置
- 创意与素材:创建 Snap Ads 创意、上传媒体素材、绑定 Pixel 追踪转化
- 受众定向:基于地理位置(国家/地区)、设备 OS 类型、兴趣类目等维度精准定向
- 数据报表:按小时/天/生命周期粒度获取账户、计划层级的效果统计
- 透明广告库:无需认证即可查询欧盟地区公开广告(Ads Gallery),支持按广告主名称与国家搜索历史投放记录
关键特性:
- 货币单位为微货币(1 USD = 1,000,000 micro),避免浮点精度问题
- 支持批量创建/更新(数组形式提交),提升操作效率
- 分页采用游标机制(cursor-based),单次返回 50-1000 条记录
- 时间戳强制要求 ISO 8601 带时区格式
显著优点
- 托管 OAuth 零配置:用户通过
ctrl.maton.ai可视化界面完成 Snapchat 授权,无需处理 token 刷新与密钥存储,大幅降低集成门槛 - 完整广告管理能力:从账户结构搭建到创意上线、从预算调控到效果追踪,覆盖广告主日常运营全场景
- 程序化批量操作:API 原生支持批量创建 Campaign/Ad Squad/Ad,适合大规模自动化投放需求
- 公开广告情报获取:Ads Gallery 接口可获取欧盟市场竞品广告素材与投放策略,为市场研究提供合规数据源
- 多连接管理:支持绑定多个 Snapchat 广告账户,通过
Maton-Connection头部灵活切换,适配代理公司多客户场景
潜在缺点与局限性
- 地域覆盖不均:Ads Gallery 仅支持欧盟国家(fr、de、gb 等),美国广告因法规限制无法查询,全球竞品分析存在盲区
- 转化 API 未集成:Conversions API(tr.snapchat.com)当前未路由至本网关,事件回传需单独对接
- Public Profile 支持不确定:官方文档提及公共主页 API 可能需额外配置或不可用
- 汇率与时区依赖:广告账户强制绑定单一货币与时区,跨国多币种账户需分别管理
- 速率限制:未明确披露限速阈值,高频调用存在 429 风险,需客户端实现退避重试
- Shell 环境变量陷阱:curl 管道至 jq 时
$MATON_API_KEY可能无法展开,建议使用脚本封装
适合人群
- 品牌广告主:需统一管理 Snapchat 渠道投放,整合至内部 CRM/CDP 的数字化营销团队
- 广告代理公司(Agency):为多个客户代运营 Snapchat 账户,依赖多连接切换与批量操作提升效率
- 程序化买家:通过 API 实现自动出价、预算再分配、素材轮播等算法驱动的投放策略
- 市场情报分析师:利用 Ads Gallery 监测竞品在欧盟市场的广告动向与创意趋势
常规风险
| 风险类别 | 说明 |
|---|---|
| 授权安全 | OAuth token 由 Maton 托管,若 Maton 网关遭入侵,可能导致广告账户被恶意操作;建议定期审计连接状态 |
| 预算失控 | API 支持实时修改预算与出价,自动化脚本若逻辑缺陷可能导致单日花费激增,建议配合账户层级日限额 |
| 数据合规 | 通过 Ads Gallery 获取的广告数据受欧盟数字服务法约束,二次分发需遵守平台条款 |
| API 变更 | Snapchat 官方 API 版本迭代可能导致字段废弃或行为变更,需关注官方开发者文档更新 |
技能正文
name: snapchat description: | Snapchat Marketing API integration with managed OAuth. Manage ad accounts, campaigns, ad squads, ads, creatives, and audiences. Use this skill when users want to create and manage Snapchat advertising campaigns, view ad performance stats, or manage targeting. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Requires network access and valid Maton API key. metadata: author: maton version: "1.0" clawdbot: emoji: 🧠 homepage: "https://maton.ai" requires: env: - MATON_API_KEY
Snapchat
Access the Snapchat Marketing API with managed OAuth authentication. Manage organizations, ad accounts, campaigns, ad squads, ads, creatives, media, and audiences.
Quick Start
# List your organizations
python3 <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/snapchat/v1/me/organizations')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Base URL
https://gateway.maton.ai/snapchat/{api-path}
The Snapchat Marketing API uses the path pattern:
https://gateway.maton.ai/snapchat/v1/{resource}
Authentication
All requests require the Maton API key in the Authorization header:
Authorization: Bearer $MATON_API_KEY
Environment Variable: Set your API key as MATON_API_KEY:
export MATON_API_KEY="YOUR_API_KEY"
Getting Your API Key
- Sign in or create an account at maton.ai
- Go to maton.ai/settings
- Copy your API key
Connection Management
Manage your Snapchat OAuth connections at https://ctrl.maton.ai.
List Connections
python3 <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections?app=snapchat&status=ACTIVE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Create Connection
python3 <<'EOF'
import urllib.request, os, json
data = json.dumps({'app': 'snapchat'}).encode()
req = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Get Connection
python3 <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Response:
{
"connection": {
"connection_id": "f5d5458b-fb65-458c-9e51-08844662dd39",
"status": "ACTIVE",
"creation_time": "2026-02-14T00:00:00.000000Z",
"last_updated_time": "2026-02-14T00:00:00.000000Z",
"url": "https://connect.maton.ai/?session_token=...",
"app": "snapchat",
"metadata": {}
}
}
Open the returned url in a browser to complete OAuth authorization.
Delete Connection
python3 <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}', method='DELETE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
Specifying Connection
If you have multiple Snapchat connections, specify which one to use with the Maton-Connection header:
python3 <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/snapchat/v1/me/organizations')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Maton-Connection', 'f5d5458b-fb65-458c-9e51-08844662dd39')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
If omitted, the gateway uses the default (oldest) active connection.
API Reference
Current User
Get Current User
GET /v1/me
Response:
{
"request_status": "SUCCESS",
"request_id": "...",
"me": {
"id": "...",
"email": "user@example.com",
"display_name": "User Name"
}
}
List My Organizations
GET /v1/me/organizations
Response:
{
"request_status": "SUCCESS",
"request_id": "...",
"organizations": [
{
"sub_request_status": "SUCCESS",
"organization": {
"id": "63acee69-77ff-4378-8492-3f8d28e8f241",
"name": "My Organization",
"country": "US",
"contact_name": "John Doe",
"contact_email": "john@example.com"
}
}
]
}
Organizations
Get Organization
GET /v1/organizations/{organizationId}
List Organization Ad Accounts
GET /v1/organizations/{organizationId}/adaccounts
List Organization Funding Sources
GET /v1/organizations/{organizationId}/fundingsources
List Organization Members
GET /v1/organizations/{organizationId}/members
List Organization Roles
GET /v1/organizations/{organizationId}/roles
List Product Catalogs
GET /v1/organizations/{organizationId}/catalogs
Ad Accounts
Get Ad Account
GET /v1/adaccounts/{adAccountId}
Response:
{
"request_status": "SUCCESS",
"request_id": "...",
"adaccounts": [
{
"sub_request_status": "SUCCESS",
"adaccount": {
"id": "6e916ba9-db2f-40cd-9553-a90e32cedea3",
"name": "My Ad Account",
"type": "PARTNER",
"status": "ACTIVE",
"organization_id": "...",
"currency": "USD",
"timezone": "America/Los_Angeles"
}
}
]
}
List Ad Account Roles
GET /v1/adaccounts/{adAccountId}/roles
Campaigns
List Campaigns
GET /v1/adaccounts/{adAccountId}/campaigns
GET /v1/adaccounts/{adAccountId}/campaigns?limit=50
Query Parameters:
limit- Number of results (50-1000)
Get Campaign
GET /v1/campaigns/{campaignId}
Create Campaign
POST /v1/adaccounts/{adAccountId}/campaigns
Content-Type: application/json
{
"campaigns": [{
"name": "Campaign Name",
"status": "PAUSED",
"ad_account_id": "{adAccountId}",
"start_time": "2026-02-15T00:00:00.000-08:00"
}]
}
Update Campaign
PUT /v1/adaccounts/{adAccountId}/campaigns
Content-Type: application/json
{
"campaigns": [{
"id": "{campaignId}",
"name": "Updated Campaign Name",
"status": "ACTIVE"
}]
}
Delete Campaign
DELETE /v1/campaigns/{campaignId}
Ad Squads
List Ad Squads
GET /v1/adaccounts/{adAccountId}/adsquads
GET /v1/campaigns/{campaignId}/adsquads
Get Ad Squad
GET /v1/adsquads/{adSquadId}
Create Ad Squad
POST /v1/campaigns/{campaignId}/adsquads
Content-Type: application/json
{
"adsquads": [{
"name": "Ad Squad Name",
"status": "PAUSED",
"campaign_id": "{campaignId}",
"type": "SNAP_ADS",
"placement": "SNAP_ADS",
"optimization_goal": "IMPRESSIONS",
"bid_micro": 1000000,
"daily_budget_micro": 50000000,
"start_time": "2026-02-15T00:00:00.000-08:00",
"targeting": {
"geos": [{"country_code": "us"}]
}
}]
}
Update Ad Squad
PUT /v1/campaigns/{campaignId}/adsquads
Content-Type: application/json
{
"adsquads": [{
"id": "{adSquadId}",
"name": "Updated Ad Squad Name"
}]
}
Delete Ad Squad
DELETE /v1/adsquads/{adSquadId}
Ads
List Ads
GET /v1/adaccounts/{adAccountId}/ads
GET /v1/adsquads/{adSquadId}/ads
Get Ad
GET /v1/ads/{adId}
Create Ad
POST /v1/adsquads/{adSquadId}/ads
Content-Type: application/json
{
"ads": [{
"name": "Ad Name",
"status": "PAUSED",
"ad_squad_id": "{adSquadId}",
"creative_id": "{creativeId}",
"type": "SNAP_AD"
}]
}
Update Ad
PUT /v1/adsquads/{adSquadId}/ads
Content-Type: application/json
{
"ads": [{
"id": "{adId}",
"name": "Updated Ad Name"
}]
}
Delete Ad
DELETE /v1/ads/{adId}
Creatives
List Creatives
GET /v1/adaccounts/{adAccountId}/creatives
GET /v1/adaccounts/{adAccountId}/creatives?limit=50&sort=updated_at-desc
Get Creative
GET /v1/creatives/{creativeId}
Create Creative
POST /v1/adaccounts/{adAccountId}/creatives
Content-Type: application/json
{
"creatives": [{
"name": "Creative Name",
"ad_account_id": "{adAccountId}",
"type": "SNAP_AD",
"top_snap_media_id": "{mediaId}",
"headline": "Headline Text",
"brand_name": "Brand Name",
"call_to_action": "VIEW_MORE"
}]
}
Update Creative
PUT /v1/adaccounts/{adAccountId}/creatives
Content-Type: application/json
{
"creatives": [{
"id": "{creativeId}",
"name": "Updated Creative Name"
}]
}
Media
List Media
GET /v1/adaccounts/{adAccountId}/media
GET /v1/adaccounts/{adAccountId}/media?limit=50&sort=created_at-desc
Get Media
GET /v1/media/{mediaId}
Pixels
List Pixels
GET /v1/adaccounts/{adAccountId}/pixels
Get Pixel
GET /v1/pixels/{pixelId}
Audience Segments
List Segments
GET /v1/adaccounts/{adAccountId}/segments
Get Segment
GET /v1/segments/{segmentId}
Stats
Get Ad Account Stats
GET /v1/adaccounts/{adAccountId}/stats?granularity=DAY&start_time=2026-02-01&end_time=2026-02-14
Query Parameters:
granularity-HOUR,DAY,LIFETIMEstart_time- Start date (YYYY-MM-DD)end_time- End date (YYYY-MM-DD)
Get Campaign Stats
GET /v1/campaigns/{campaignId}/stats?granularity=DAY&start_time=2026-02-01&end_time=2026-02-14
Targeting
Get Countries
GET /v1/targeting/geo/country
Get Regions by Country
GET /v1/targeting/geo/{countryCode}/region
Example: GET /v1/targeting/geo/us/region
Get OS Types
GET /v1/targeting/device/os_type
Get Location Categories
GET /v1/targeting/location/categories_loi
Ads Gallery (Public Ads Library)
The Ads Gallery API provides access to Snapchat's public advertising transparency library. This API does not require authentication but can be accessed through the gateway.
List Sponsored Content
GET /v1/ads_library/sponsored_content
Response:
{
"request_status": "SUCCESS",
"request_id": "...",
"sponsored_content": [
{
"sub_request_status": "SUCCESS",
"sponsored_content": {
"id": "...",
"name": "Content Name",
"status": "ACTIVE"
}
}
]
}
Search Sponsored Content
POST /v1/ads_library/sponsored_content/search
Content-Type: application/json
{
"limit": 50
}
Search Ads
Search for ads in the public Ads Library by advertiser name and country.
POST /v1/ads_library/ads/search
Content-Type: application/json
{
"paying_advertiser_name": "Nike",
"countries": ["fr", "de"],
"limit": 50
}
Parameters:
paying_advertiser_name(required) - Advertiser name to search forcountries(required) - Array of lowercase 2-letter ISO country codes (e.g.,["fr", "de", "gb"])start_date- ISO 8601 timestamp for date range startend_date- ISO 8601 timestamp for date range endstatus- Filter by status (e.g.,"ACTIVE","PAUSED")limit- Number of results to return
Note: Not all countries are available in the Ads Library. EU countries (fr, de, gb, etc.) are supported. US ads may not be available due to regional restrictions.
Response:
{
"request_status": "SUCCESS",
"request_id": "...",
"paging": {
"next_link": "..."
},
"ad_previews": [
{
"sub_request_status": "SUCCESS",
"ad_preview": {
"id": "...",
"name": "Ad Name",
"ad_account_name": "Advertiser Name",
"status": "ACTIVE",
"creative_type": "WEB_VIEW",
"headline": "Ad Headline",
"call_to_action": "SHOP NOW"
}
}
]
}
Pagination
The Snapchat API uses cursor-based pagination with the limit parameter (50-1000) and returns a paging object with next_link.
GET /v1/adaccounts/{adAccountId}/campaigns?limit=50
Response:
{
"request_status": "SUCCESS",
"campaigns": [...],
"paging": {
"next_link": "https://adsapi.snapchat.com/v1/adaccounts/{id}/campaigns?cursor=..."
}
}
To get the next page, use the next_link URL (replace host with gateway):
GET /v1/adaccounts/{adAccountId}/campaigns?cursor=...
Sorting
Some endpoints support sorting with the sort parameter:
GET /v1/adaccounts/{adAccountId}/creatives?sort=updated_at-desc
GET /v1/adaccounts/{adAccountId}/media?sort=created_at-desc
Supported values: updated_at-desc, created_at-desc
Code Examples
JavaScript
// List organizations
const response = await fetch(
'https://gateway.maton.ai/snapchat/v1/me/organizations',
{
headers: {
'Authorization': `Bearer ${process.env.MATON_API_KEY}`
}
}
);
const data = await response.json();
console.log(data.organizations);
Python
import os
import requests
# List organizations
response = requests.get(
'https://gateway.maton.ai/snapchat/v1/me/organizations',
headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'}
)
data = response.json()
print(data['organizations'])
List All Campaigns Example
import os
import requests
org_id = "YOUR_ORG_ID"
headers = {'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'}
# Get ad accounts
response = requests.get(
f'https://gateway.maton.ai/snapchat/v1/organizations/{org_id}/adaccounts',
headers=headers
)
ad_accounts = response.json()['adaccounts']
# List campaigns for each ad account
for aa in ad_accounts:
ad_account_id = aa['adaccount']['id']
campaigns = requests.get(
f'https://gateway.maton.ai/snapchat/v1/adaccounts/{ad_account_id}/campaigns',
headers=headers
).json()
print(f"Ad Account: {aa['adaccount']['name']}")
print(f"Campaigns: {campaigns}")
Notes
- Monetary Values: All monetary values use micro-currency (1 USD = 1,000,000 micro)
- Bulk Operations: Create/update endpoints accept arrays for batch operations
- Response Format: All responses include
request_status,request_id, and entity arrays withsub_request_status - Timestamps: Use ISO 8601 format with timezone (e.g.,
2026-02-15T00:00:00.000-08:00) - Ads Gallery Countries: Not all countries are available in the Ads Library. EU countries (fr, de, gb, etc.) are supported.
- Conversions API: The Conversions API uses a different base URL (
tr.snapchat.com) and is not currently routed through this gateway. - Public Profile API: The Public Profile API may not be available or requires separate configuration.
- IMPORTANT: When piping curl output to
jqor other commands, environment variables like$MATON_API_KEYmay not expand correctly in some shell environments
Error Handling
| Status | Meaning |
|---|---|
| 400 | Bad request or invalid parameters |
| 401 | Invalid API key or expired token |
| 403 | Permission denied |
| 404 | Resource not found |
| 429 | Rate limited |
| 4xx/5xx | Passthrough error from Snapchat API |
Response Error Format
{
"request_status": "ERROR",
"request_id": "...",
"debug_message": "Error details",
"display_message": "User-friendly message"
}
Resources
- Snapchat Ads API Introduction
- API Patterns
- Campaign Management
- Creative Management
- Targeting
- Ads Gallery API
- Maton Community
- Maton Support
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。