Introduction¶
When running Sanlian Ads on Bilibili, creative workflows often get stuck at the asset side: cover images must be uploaded according to specific placement specifications, videos require pre-signed URLs before direct uploads to object storage, and drafts must wait for asynchronous processing. Additionally, multi-account advertising requires pushing assets and categorizing them with tags. Manually switching between Open Platform documentation and Postman often leads to missing request headers, treating pre-signed uploads as MAPI calls, or proceeding to create creatives while processing is still incomplete.
Here, we introduce Bilibili Sanlian Ads - Material Upload (package name bilibili-sanlian-ads-materials) available on SkillHub. It organizes the asset management interfaces of the Sanlian Ads MAPI into an Agent-executable SKILL.md and reference documentation. It also includes a unified mapi.sh client, allowing models to execute serial calls according to rules rather than improvising with curl.
What is this¶
Bilibili Sanlian Ads - Material Upload is an asset management Skill for Bilibili Sanlian Ads: image upload and deletion, video pre-signed upload and draft creation, processing progress queries, querying eligible uploader MIDs, asset tagging and binding, and cross-advertiser asset pushing.
- Maintainer: SkillHub community author Benjamin. MIT License; Skill ID is
@indiv-benjamin/sanlian-ads-materials, current version 3.0.5. - Distribution Channel: SkillHub Skill Page (The official entry is also available at api.skillhub.cn user page).
- Prerequisites: A valid Sanlian Ads
access_tokenand advertiseraccount_idare required; authorization is handled by thebilibili-sanlian-adsseries if credentials are missing. SkillHub metadata marksrequires_api_key: true. - Relationship with Delivery: Once assets are uploaded, their delivery status can be queried via
bilibili-sanlian-ads-metadata; attaching them to plans/creatives or Creative Drive 2.0 media is handled bybilibili-sanlian-ads-ad-managementandbilibili-sanlian-ads-delivery, respectively.
Trigger words available in Chinese conversations: Assets/Materials, Upload Image, Upload Video, Draft Upload, Material Tags, Asset Push, Creative Center, Cover Image, Video Processing Progress.
Core Functions¶
The following capabilities are derived from the Skill’s bundled SKILL.md and interface reference documentation (synced from the Bilibili Developer Center “Material Management” documentation).
Images¶
- Local file upload:
…/v3/creative/upload_pic - URL upload (preferred for hosted images to avoid multipart):
…/v3/creative/upload_pic_with_url - List existing images:
…/meta_data/launch/medias(Recommended to check before uploading to avoid duplicate assets) - Delete image:
…/v3/file/image/delete
Constraints regarding placements, dimensions, and formats must be verified item-by-item against the interface documentation; video specifications cannot be extrapolated from image specifications.
Videos and Drafts¶
The typical workflow is divided into two steps: MAPI and Non-MAPI. Mixing authentication methods is a common pitfall:
- Call MAPI to get a pre-signed URL:
…/meta_data/signed_urls(Bearer token required). - Use a standard HTTP client to PUT the video file to the pre-signed URL: Do not include a Bearer token, and do not include
X-Call-Source. - Call MAPI to create drafts in bulk:
…/meta_data/create/archives. - Poll processing progress: By processing ID (
…/archive/progress) or file MD5 (…/archive/v1/progress); processing is asynchronous, requiring backoff polling. Do not start the next MAPI sequence in parallel before the current one reaches a terminal state. - Query eligible uploader MIDs for the account:
…/meta_data/enterprise/mid(Authorization flow is inbilibili-sanlian-ads-assets).
It is recommended to keep the locally calculated file MD5: it can be used to query progress when no processing ID is available; cm_video.file_md5 is also required when registering media_id for local videos under Creative Drive 2.0.
Material Tags¶
Tag CRUD operations, binding to materials, and listing materials by tags are located under …/v3/resource/material_tag/ (e.g., list/page, batch_insert, bind, list_material). Deleting a tag unbinds it globally, so the Skill requires confirmation from the user first.
Material Push¶
…/meta_data/v3/file/material/bind pushes materials to other advertiser accounts to avoid duplicate uploads. Since this writes to another party’s account, the target account list must be explicitly confirmed.
Installation and Activation¶
1. Install SkillHub CLI (if not installed)¶
command -v skillhub && skillhub --version
If not installed, you can install just the CLI:
curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash -s -- --cli-only
See the SkillHub Installation Documentation for details.
2. Install this Skill to the current Agent’s skills directory¶
When installing, you must use --dir to point to the directory recognized by your current tool; otherwise, defaulting to ./skills/ may result in it not being loaded.
skillhub install sanlian-ads-materials --dir ~/.cursor/skills
Common paths for various clients (consistent with official documentation):
- Cursor:
~/.cursor/skills/ - Claude Code:
~/.claude/skills/ - Codex CLI:
~/.codex/skills/or.agents/skills/in the project
You can also download the Zip from the SkillHub Skill Page and extract it to the above directory. This Skill is not installed from GitHub via npx skills add; the Sanlian series is distributed on SkillHub.
3. Runtime Environment¶
- Python 3.8+: MAPI is executed via the Skill’s internal
scripts/mapi.sh(Linux/macOS) orpy -3 scripts/mapi_client.py(Windows); the interpreter can be specified via the environment variableSANLIAN_PYTHON. - Sanlian Credentials: The client reads tokens from the local credential store or configuration like
BILIBILI_MAPI_CREDENTIALS(details are defined by the main Skillbilibili-sanlian-ads);client_secretcan also be provided viaBILIBILI_MAPI_CLIENT_SECRET.
After installation or update, restart or refresh the Skill list according to the requirements of your Agent.
Typical Usage¶
Unified MAPI Entry Point¶
Except for pre-signed video PUTs, all MAPI requests should go through the client in the Skill directory. Do not hand-write curl/requests to connect directly to cm.bilibili.com, and do not parallelize requests across multiple accounts or objects.
In the Skill root directory, the invocation format is:
./scripts/mapi.sh call <METHOD> <path> [--query-file q.json] [--body-file body.json]
The client handles token refreshing, headers, and rate limiting/error classification as defined by the Sanlian Skill conventions. The MAPI base domain is https://cm.bilibili.com/takumi/api; JSON requests require Content-Type: application/json and must include Authorization: Bearer {access_token}, X-Call-Source: sanlian-skills, and X-Sanlian-Skills-Version: 3.0.4 (subject to the Skill documentation).
Business success is determined by the response body, not the HTTP status code; for batch interfaces, check individual results item by item.
Operation Sequence when Collaborating with Agents¶
- Confirm
access_tokenandaccount_id(if missing, proceed withbilibili-sanlian-adsfirst). - Open the corresponding
references/document based on the target (e.g.,1890_图片管理.md,1889_视频管理.md) and constructbody.json/query.jsonaccording to the documentation. - Images: Check for duplicates via
launch/mediasif necessary, thenupload_picorupload_pic_with_url. - Videos: signed_urls → external PUT → create/archives → poll progress; record MD5.
- Tags or Cross-account Push: Confirm deletion/target accounts with the user first, then call the corresponding interface.
Uploads are non-idempotent: Before retrying on failure, confirm whether the upload was already successful to avoid duplicate assets.
Use Cases and Notes¶
Who is it for
- Advertisers, operators, or integration developers using Agents with Skills (like Cursor, Claude Code, Codex) who need a stable connection to Sanlian asset MAPIs.
- Those already using the same series of Skills for creative editing or reporting who want to separate “Upload—Process—Tag—Push” from creative saving for independent maintenance.
Limitations and Notes
- Only covers asset management MAPIs; does not include the full OAuth flow (depends on
bilibili-sanlian-ads) or asset authorization (bilibili-sanlian-ads-assets). - Video pre-signed uploads have completely different authentication and error formats compared to MAPIs; expired pre-signed URLs require re-requesting, do not blindly retry old links.
- The Skill requires explicit confirmation before deleting images or tags, or pushing assets to other accounts, to avoid damaging active creatives.
- SkillHub security scans (Keen, San Du) currently show “Safe, No Risks”; however, tokens and
client_secretshould still only be stored in trusted environments.
Conclusion¶
Bilibili Sanlian Ads - Material Upload encapsulates high-frequency interfaces for Sanlian ad assets and the boundaries of “pre-signed direct upload vs. MAPI” into Skill rules. Combined with mapi.sh, it reduces incorrect interface calls by Agents. If you are building an automated Sanlian advertising pipeline, install this Skill first to handle assets, then connect with the metadata and creative editing Skills.
Official Entry: https://api.skillhub.cn/user_b0010d5c/sanlian-ads-materials (Browse Page: https://skillhub.cn/skills/user_b0010d5c/sanlian-ads-materials).