Preface¶
When running ad placements for Bilibili’s “Sanlian” (Triple) ads, reports are viewable in the backend. However, when performing batch verification by account, campaign, unit, or creative, or when integrating daily/hourly data into your own scripts and Agent workflows, manual export often falls short. While the Marketing API (MAPI) offers a custom report interface, dimension names, metric names, the legacy structure, and the Creative Driven 2.0 structure represent two separate sets of data that cannot be mixed; date ranges also require looping requests by day. This article introduces the Bilibili Sanlian Ads - Reporting Skill on SkillHub, which encodes the usage, constraints, and error handling of POST /open_api/report/v3/custom/query into an Agent-executable SKILL specification, linking with the authorization main flow Skill in the same series.
What is this¶
Bilibili Sanlian Ads - Reporting (package ID bilibili-sanlian-ads-reporting) targets reporting scenarios for Bilibili Sanlian Ads MAPI. It queries placement metrics such as consumption (spend), impressions, clicks, and conversions via a custom report endpoint. It supports aggregation by account, campaign, unit, creative (legacy structure), or project, and media (Creative Driven 2.0) dimensions, with selectable granularity of date or hour.
The Skill is hosted on SkillHub (user user_b0010d5c) under the data-analysis category. The public page shows a rating of 93,403 and approximately 2,492 downloads (data sourced from Skill clues; refer to the SkillHub page for the latest). The current resource snapshot version is 3.0.4, containing about 7 files and 107.4 KB, updated on 2026-10-12.
In the same series, creative creation and listing interfaces do not return spend, impressions, or clicks; placement performance data should be retrieved via the report endpoint described in this Skill. Account balance, budget, and fund flows belong to bilibili-sanlian-ads-account-finance, which is not the same dataset as report consumption and cannot be reconciled field-by-field.
Core Features¶
Verified against the Skill documentation, capabilities are concentrated on a single reporting endpoint and its query rules.
Custom Report Query¶
The core request is:
POST https://cm.bilibili.com/takumi/api/open_api/report/v3/custom/query
Authorization: Bearer {access_token}
Content-Type: application/json
X-Call-Source: sanlian-skills
X-Sanlian-Skills-Version: 3.0.4
The request body selects dimensions (dimensions), metrics (metrics), start and end times, and can include filters. The complete list of dimensions and metrics follows the Skill’s references/807_自定义报表.md (corresponding to the developer documentation “Placement Reports / Custom Reports”, doc_id 807). Names must be exact strings from the documentation; unknown metrics will be rejected directly.
Account-level vs. Object-level Calibers¶
- Account Summary: Pass only
account_idwithout appending campaign/unit/creative/project/media dimensions or filters. A single account-level query can cover the summary of both legacy placements and Creative Driven 2.0 placements. - Object-level: When object IDs appear in
dimensionsorfilters[].field, the system enters either “Legacy Mode” or “Creative Driven 2.0 Mode”. The metric tables for these two modes are different.
| Legacy Mode | Creative Driven 2.0 Mode | |
|---|---|---|
| Trigger Condition | campaign_id, unit_id, or creative_id appears in dimensions or filter fields |
promotion_id or media_id appears in dimensions or filter fields |
| Metric Set | Legacy Metric Set | 116 Basic Metrics |
| Derived Metrics | Supported | Not Supported (No cost_per_*, *_rate, *_roi, etc.; calculate using absolute values) |
The two sets of dimensions cannot be queried together; mixing them returns “System Busy” (系统繁忙). Requests should be split into two separate calls. If a metric is not in the current mode’s list, it returns “Metric [xxx] does not exist” (指标 [xxx] 不存在), which is a parameter error and should not be retried as a transient fault.
Time, Filtering, and Return Row Meaning¶
- Single Day Request:
start_timeandend_timemust be the same day, formatYYYY-MM-DD. For multi-day ranges, the Agent or script must loop sequentially by day. Do not fan out in parallel; send the next day only after the previous day is complete and validated. - Filtering: Each filter’s
valuescan contain up to 100 IDs. If a filter exists,valuescannot be empty. Larger ID sets must be split into multiple requests. - Granularity: Can be selected by day or hour; hourly granularity significantly increases row counts and requires a pagination strategy.
- No Spend, No Row: The interface only returns rows with consumption. Missing rows indicate no consumption for that object on that day; this is not missing data and does not require retry.
Amount Fields¶
- Fields without a suffix are in Yuan (for display).
- Fields with the
_millisuffix represent the raw value in milli-cents (1 Yuan = 100,000). For reconciliation and billing verification, it is recommended to use integer arithmetic for_millifields.
Agent-side Calling Conventions¶
The Skill requires all MAPI calls to be executed via wrapped scripts rather than hand-written curl / requests / fetch, and parallel requests across accounts or objects are forbidden:
# Unix / macOS / Linux
scripts/mapi.sh call [--query-file q.json] [--body-file body.json]
# Windows
py -3 scripts/mapi_client.py call [--query-file q.json] [--body-file body.json]
The script handles loading and refreshing tokens, attaching headers, rate limiting (Rule 1), and unified error classification. Business success or failure is determined by the response body, not just the HTTP status code.
Chinese trigger words include: Report (报表), Data (数据), Consumption (消耗), Spend (花费), Impression (曝光), Click (点击), Conversion (转化), Placement Data (投放数据), Custom Report (自定义报表), View Data (看数据), Running Status (跑量情况). When expressions like “Yesterday”, “Recently”, or “Running well” appear in a conversation, the Skill requires parsing them into explicit timezones, dates, metrics, and object scopes before initiating a request.
Installation and Activation¶
SkillHub Official Address:
https://api.skillhub.cn/user_b0010d5c/sanlian-ads-reporting
Page scraping for this URL failed in the current environment (HTTP 405). Please refer to SkillHub site instructions for specific “Install” buttons or CLI commands. The Skill follows the standard SKILL.md format and is loaded by clients supporting Skills (e.g., Cursor, Claude Code) after installation. If the activation path differs from SkillHub documentation, follow your specific client and the current SkillHub guidance.
Prerequisites (Hard requirements within the Skill):
- A valid MAPI
access_tokenand advertiseraccount_id. If either is missing, use the same seriesbilibili-sanlian-ads(Bilibili Sanlian Ads - Authorization & Main Flow) to complete OAuth, refresh the token, and confirm the account scope first. - Read
references/807_自定义报表.mdbefore calling reports to construct the request body. - Follow the sequential calling and “stop-on-error” principles of the main Skill; estimate a “per-day / per-page” calling plan for long ranges before execution.
The Skill page notes that third-party services or models may be involved; configure corresponding API Keys as introduced (if your deployment path requires them).
Typical Usage¶
Below is a reproducible flow consistent with the official Skill description. It does not substitute for a real token and account_id.
Check Yesterday’s Total Account Consumption¶
- Confirm
access_tokenandaccount_idviabilibili-sanlian-ads. - Set up the account-level query in
body.json: onlyaccount_id, withstart_timeandend_timeboth set to the target natural day (e.g.,2026-10-19). Select consumption, impression, click, and conversion metric names from the documentation. - Execute:
scripts/mapi.sh call --body-file body.json
- Parse the business status and data rows in the response body. If multiple days are needed, change the date to the next day and wait for the previous day’s response validation to complete before sending the next.
View Performance by Campaign (Legacy Structure)¶
- Use
campaign_id(orunit_id/creative_id) indimensionsorfiltersto enter the legacy metric set. - Select metric names only from the legacy list. If derived metrics like CTR or CPA are needed, use the derived fields provided by the interface in legacy mode (calculate manually using basic metrics in 2.0 mode).
- Query sequentially, one day at a time, one page at a time. If campaign IDs in filters exceed 100, split into batches.
Creative Driven 2.0 (Project / Media)¶
- Use
promotion_idormedia_idin dimensions or filters. Do not include legacy fields likecampaign_idin the same request. - Request only the 116 basic metrics; ROI and rate metrics must be calculated locally.
- When comparing with legacy campaign data, pull two separate sets of reports; do not expect to merge them in a single request.
Distinguishing from Financial Issues¶
User asks “How much was spent / How are the results?” → This Skill. User asks “Account balance, budget, fund flow” → Switch to bilibili-sanlian-ads-account-finance.
Use Cases and Notes¶
Suitable for:
- Teams that have integrated or plan to integrate Bilibili Sanlian MAPI and need to pull custom reports via natural language in Agent conversations.
- Automation script maintainers who need to verify consumption, impressions, clicks, and conversions by day or hour, and are willing to adhere to the discipline of “sequential by day, no parallel fan-out”.
- Users utilizing both Legacy (Campaign/Unit/Creative) and Creative Driven 2.0, requiring the Skill to clearly delineate the boundaries of the two dimension and metric sets.
Notes:
- MAPI authorization and App credentials are required first. The platform has commercial and permission thresholds for MAPI access; you must apply to Bilibili for Appkey / Appsecret and report pull permissions.
- Do not guess English metric names or directly translate metric names from other advertising platforms.
- When a query fails, check first: whether start and end dates are the same day and in the correct format, whether metrics belong to the current mode, and whether dimensions are mixed. Do not try to “guess the API” by repeatedly swapping dimensions/metrics.
- Report consumption and financial account data are from different systems; distinguish data sources during reconciliation.
Conclusion¶
Bilibili Sanlian Ads - Reporting encodes the endpoint, dual placement structures, daily looping, and currency precision of the Sanlian MAPI custom reports into executable Skill rules. It has a clear division of labor with the authorization main flow and the finance Skill, making it a dedicated capability worth loading when delegating “viewing data, viewing spend, and viewing placement status” to an Agent.
Official Address: https://api.skillhub.cn/user_b0010d5c/sanlian-ads-reporting