Publer API Skill
This skill enables you to interact with all Publer API endpoints.
Business plan required. The Publer API is only available to Business plan users.
Setup
Base URL: INLINECODE0
Required headers on almost every request:
CODEBLOCK0
Note: Bearer-API (not Bearer) is the correct format.
If the user hasn't provided their API key, ask for it before making any calls. Never hardcode or expose API keys.
API key scopes: workspaces, accounts, posts, media, analytics
Quick Reference: All Endpoints
| Area | Method | Endpoint |
|---|
| Users | GET | INLINECODE8 |
| Workspaces |
GET |
/workspaces |
| Accounts | GET |
/accounts |
| Posts | GET |
/posts |
| Posts — Schedule/Draft | POST |
/posts/schedule |
| Posts — Publish Now | POST |
/posts/schedule/publish |
| Posts — Update | PUT |
/posts/{id} |
| Posts — Delete | DELETE |
/posts |
| Job Status | GET |
/job_status/{job_id} |
| Media — List | GET |
/media |
| Media — Direct Upload | POST |
/media |
| Media — URL Upload | POST |
/media/from-url |
| Media Options | GET |
/workspaces/{workspace_id}/media_options |
| Analytics — Charts List | GET |
/analytics/charts |
| Analytics — Chart Data | GET |
/analytics/:account_id/chart_data |
| Analytics — Post Insights | GET |
/analytics/:account_id/post_insights |
| Analytics — Hashtag Insights | GET |
/analytics/:account_id/hashtag_insights |
| Analytics — Hashtag Posts | GET |
/analytics/:account_id/hashtag_performing_posts |
| Analytics — Best Times | GET |
/analytics/:account_id/best_times |
| Analytics — Members | GET |
/analytics/members |
| Competitors — List | GET |
/competitors/:account_id |
| Competitors — Analytics | GET |
/competitors/:account_id/analytics |
For full request/response shapes, read references/api-reference.md.
Workflow
1. Identify the intent
Map the user's request to one or more API calls from the table above.
2. Gather required parameters
- - Workspace ID: Needed for most calls. If unknown, call
GET /workspaces first. - Account IDs: Needed for post creation. If unknown, call
GET /accounts. - Scheduled posts:
scheduled_at must be ISO 8601 with timezone, at least 1 minute in the future. - Analytics: Most endpoints need
from/to date range (YYYY-MM-DD). They are co-required. - Media: Must be uploaded first via
/media or /media/from-url, then referenced by ID in posts.
3. Make the API call
Use the correct HTTP method and headers. POST/PUT use
Content-Type: application/json. Media direct upload uses
multipart/form-data.
4. Handle async operations
Post creation and URL media uploads are
asynchronous:
- - Response returns INLINECODE40
- Poll
GET /job_status/{job_id} until status is "complete" or INLINECODE44 - Check
payload.failures even on "complete" — partial failures are possible
5. Interpret the response
- - 2xx — success. Parse and present relevant fields clearly.
- 401 — ask user to verify API key and confirm
Bearer-API format. - 403 — check required scope is enabled, and
Publer-Workspace-Id header is present. - 404 — resource ID is wrong; confirm with user.
- 422 — surface the
errors[] array to user and ask them to correct input. - 429 — rate limited (100 req/2 min); wait for
X-RateLimit-Reset, use exponential backoff. - 5xx — Publer server error; suggest retry.
Common Workflows
Schedule a post
- 1. If workspace/account IDs unknown:
GET /workspaces then INLINECODE52 - INLINECODE53 with
state: "scheduled", network content, and scheduled_at per account - Poll
GET /job_status/{job_id} until complete - Confirm back: platform(s), scheduled time, text preview
Publish immediately
Same as above but use
POST /posts/schedule/publish and omit
scheduled_at.
Cross-post with platform-specific content
Use multiple keys under
networks with per-platform text/type:
CODEBLOCK1
Upload and attach media
- 1.
POST /media (multipart) for direct upload, or POST /media/from-url for URL import - Check
validity object in response for network compatibility - Reference
media.id in the media[] array inside the network object when creating post
List and review scheduled posts
- 1. INLINECODE65
- Display as readable list: date, network, text preview
- Offer to edit (
PUT /posts/{id}) or delete (DELETE /posts?post_ids[]=...) on request
Fetch analytics
- 1. For account-level charts:
GET /analytics/charts to get available IDs, then INLINECODE69 - For per-post performance: INLINECODE70
- For hashtag performance: INLINECODE71
- For best posting times: INLINECODE72
Competitor analysis
- 1.
GET /competitors/:account_id to list competitors - INLINECODE74 for aggregate metrics
- Use
competitors=true&competitor_id=... on post insights and best times endpoints for deeper comparison
Key Notes & Edge Cases
- - Auth header format:
Bearer-API YOUR_KEY — not INLINECODE77 - Workspace in header vs path: Most endpoints use
Publer-Workspace-Id header. Exception: GET /workspaces/{workspace_id}/media_options uses workspace ID in the path. /users/me and /workspaces do not require the workspace header.- Pagination: 0-based
page param throughout. Post insights and hashtag insights return 10 per page. - Date format: ISO 8601 with timezone for timestamps; YYYY-MM-DD for analytics date ranges.
default network key: Use "default" as the network to apply same content to all accounts.- Threads: Cannot schedule for specific times via API.
- Analytics data freshness: Metrics auto-sync ~every 24h. Not real-time.
- Competitor
sort_type: Lowercase asc/desc — unlike post/hashtag insights which use ASC/DESC. reach field: May be omitted in members analytics and competitor analytics for unsupported networks — handle gracefully.
Reference Files
- -
references/api-reference.md — Full endpoint docs with all request/response shapes, field enums, media specs, daily post limits, and error handling. Read this when you need exact field names, response shapes, or need to handle a case not covered above.
Publer API 技能
此技能使您能够与所有 Publer API 端点进行交互。
需要商业计划。 Publer API 仅对商业计划用户可用。
设置
基础 URL: https://app.publer.com/api/v1
几乎所有请求都需要以下标头:
Authorization: Bearer-API YOURAPIKEY
Publer-Workspace-Id: YOURWORKSPACEID
Content-Type: application/json
注意:Bearer-API(而非 Bearer)是正确的格式。
如果用户未提供其 API 密钥,请在发起任何调用前询问。切勿硬编码或暴露 API 密钥。
API 密钥作用域: workspaces、accounts、posts、media、analytics
快速参考:所有端点
GET | /workspaces |
| 账户 | GET | /accounts |
| 帖子 | GET | /posts |
| 帖子 — 定时/草稿 | POST | /posts/schedule |
| 帖子 — 立即发布 | POST | /posts/schedule/publish |
| 帖子 — 更新 | PUT | /posts/{id} |
| 帖子 — 删除 | DELETE | /posts |
| 任务状态 | GET | /job
status/{jobid} |
| 媒体 — 列表 | GET | /media |
| 媒体 — 直接上传 | POST | /media |
| 媒体 — URL 上传 | POST | /media/from-url |
| 媒体选项 | GET | /workspaces/{workspace
id}/mediaoptions |
| 分析 — 图表列表 | GET | /analytics/charts |
| 分析 — 图表数据 | GET | /analytics/:account
id/chartdata |
| 分析 — 帖子洞察 | GET | /analytics/:account
id/postinsights |
| 分析 — 标签洞察 | GET | /analytics/:account
id/hashtaginsights |
| 分析 — 标签帖子 | GET | /analytics/:account
id/hashtagperforming_posts |
| 分析 — 最佳时间 | GET | /analytics/:account
id/besttimes |
| 分析 — 成员 | GET | /analytics/members |
| 竞争对手 — 列表 | GET | /competitors/:account_id |
| 竞争对手 — 分析 | GET | /competitors/:account_id/analytics |
如需完整的请求/响应结构,请阅读 references/api-reference.md。
工作流程
1. 识别意图
将用户的请求映射到上表中一个或多个 API 调用。
2. 收集所需参数
- - 工作区 ID: 大多数调用需要。如果未知,请先调用 GET /workspaces。
- 账户 ID: 创建帖子时需要。如果未知,请调用 GET /accounts。
- 定时帖子: scheduled_at 必须为带时区的 ISO 8601 格式,且至少在未来 1 分钟。
- 分析: 大多数端点需要 from/to 日期范围(YYYY-MM-DD)。它们必须同时提供。
- 媒体: 必须首先通过 /media 或 /media/from-url 上传,然后在帖子中通过 ID 引用。
3. 发起 API 调用
使用正确的 HTTP 方法和标头。POST/PUT 使用 Content-Type: application/json。媒体直接上传使用 multipart/form-data。
4. 处理异步操作
帖子创建和 URL 媒体上传是
异步的:
- - 响应返回 { success: true, data: { jobid: ... } }
- 轮询 GET /jobstatus/{job_id} 直到 status 为 complete 或 failed
- 即使在 complete 状态下也要检查 payload.failures — 可能发生部分失败
5. 解释响应
- - 2xx — 成功。解析并清晰呈现相关字段。
- 401 — 要求用户验证 API 密钥并确认 Bearer-API 格式。
- 403 — 检查是否启用了所需作用域,以及是否提供了 Publer-Workspace-Id 标头。
- 404 — 资源 ID 错误;与用户确认。
- 422 — 向用户展示 errors[] 数组并要求其更正输入。
- 429 — 速率限制(100 次请求/2 分钟);等待 X-RateLimit-Reset,使用指数退避。
- 5xx — Publer 服务器错误;建议重试。
常见工作流程
定时发布帖子
- 1. 如果工作区/账户 ID 未知:GET /workspaces 然后 GET /accounts
- POST /posts/schedule,包含 state: scheduled、网络内容和每个账户的 scheduledat
- 轮询 GET /jobstatus/{job_id} 直到完成
- 确认:平台、定时时间、文本预览
立即发布
与上述相同,但使用 POST /posts/schedule/publish 并省略 scheduled_at。
跨平台发布并指定平台内容
在 networks 下使用多个键,每个键包含平台特定的文本/类型:
json
networks: {
facebook: { type: status, text: 更长的 Facebook 文案... },
twitter: { type: status, text: 短推文 #标签 },
linkedin: { type: status, text: 专业的 LinkedIn 文案... }
}
上传并附加媒体
- 1. POST /media(multipart)用于直接上传,或 POST /media/from-url 用于 URL 导入
- 检查响应中的 validity 对象以了解网络兼容性
- 创建帖子时,在网络对象内的 media[] 数组中引用 media.id
列出并审查定时帖子
- 1. GET /posts?state=scheduled
- 以可读列表形式显示:日期、网络、文本预览
- 根据请求提供编辑(PUT /posts/{id})或删除(DELETE /posts?post_ids[]=...)选项
获取分析数据
- 1. 对于账户级图表:GET /analytics/charts 获取可用 ID,然后 GET /analytics/:accountid/chartdata?chartids[]=...&from=...&to=...
- 对于单帖表现:GET /analytics/:accountid/postinsights?from=...&to=...
- 对于标签表现:GET /analytics/:accountid/hashtaginsights
- 对于最佳发布时间:GET /analytics/:accountid/best_times?from=...&to=...
竞争对手分析
- 1. GET /competitors/:accountid 列出竞争对手
- GET /competitors/:accountid/analytics 获取聚合指标
- 在帖子洞察和最佳时间端点中使用 competitors=true&competitor_id=... 进行更深入的比较
关键说明与边界情况
- - 认证标头格式: Bearer-API YOURKEY — 而非 Bearer
- 标头中的工作区 vs 路径中的工作区: 大多数端点使用 Publer-Workspace-Id 标头。例外:GET /workspaces/{workspaceid}/mediaoptions 在路径中使用工作区 ID。
- /users/me 和 /workspaces 不需要工作区标头。
- 分页: 所有端点使用基于 0 的 page 参数。帖子洞察和标签洞察每页返回 10 条。
- 日期格式: 时间戳使用带时区的 ISO 8601 格式;分析日期范围使用 YYYY-MM-DD 格式。
- default 网络键: 使用 default 作为网络键,将相同内容应用于所有账户。
- Threads: 无法通过 API 定时到特定时间发布。
- 分析数据新鲜度: 指标约每 24 小时自动同步一次。非实时。
- 竞争对手 sorttype: 小写 asc/desc — 与帖子/标签洞察使用的 ASC/DESC 不同。
- reach 字段: 在不支持的网络中,成员分析和竞争对手分析可能省略该字段 — 请优雅处理。
参考文件
- - references/api-reference.md — 完整的端点文档,包含所有请求/响应结构、字段枚举、媒体规格、每日帖子限制和错误处理。当您需要确切的字段名称