Bilibili Sanlian Ads MAPI Batch Operations
Use this skill for Sanlian Ads MAPI batch campaign, unit, and creative updates, plus async batch task list and task detail queries.
High-Risk Operation Rules
Batch operations are high-risk write operations. Never submit a batch update unless the user has explicitly approved it.
Before any write request, you must:
- Confirm
access_token, account_id, object level, and object ID list. - Query current object details first, confirming the object exists, belongs to the account, and has clear current values.
- Build a dry-run summary from the relevant reference, including fields to change, before values, after values, object count, and object IDs.
- Wait for explicit user confirmation before submitting the first write request.
Do not treat vague requests such as "optimize these ads", "batch process them", or "just adjust them" as authorization. The user must confirm the exact change.
Batch Execution Rules
When the user specifies many target objects, execute in small batches. Do not submit a large batch in one shot.
- The first batch must contain only 1 object.
- After the first batch completes, call the batch task list and batch task detail APIs to confirm completion.
- Then query the object detail API again and confirm only the user-requested fields changed, with no unexpected changes.
- Show the verification result to the user. The user must manually confirm that the result is correct.
- Only after user confirmation may you continue. The second batch may contain at most 10 objects; after that batch is verified and confirmed by the user, later batches may use the API limit of at most 100 objects per batch.
- After every batch, repeat task status query, task detail query, object detail query, and manual user confirmation.
- After all batches finish, query the affected objects again to confirm the final values are effective.
If any batch fails, partially succeeds, or produces unexpected field values, stop immediately. Summarize failed objects, failure reasons, and already changed objects. Do not continue submitting more batches.
Ambiguous Concepts That Require Confirmation
User-provided terms may be imprecise. Always confirm the exact concept and field in these cases:
- "Budget" may mean current budget or next-day budget.
- "Bid coefficient" may mean price coefficient or first-position price coefficient.
- "Search word/keyword" may mean custom search words or negative search words.
- "Time" may mean launch date, date extension, or weekly delivery hours.
- "Material/cover/image" maps to creative image material in the current MAPI creative batch API.
- "Description" maps to creative material description in the creative batch API.
- "Brand" may mean brand space/name; do not confuse it with qualification supplement.
If the user's words do not uniquely determine operation type, field, and target value, ask for confirmation first. After confirmation, test on a single unit or creative, let the user confirm the result, then continue with batch execution.
Batch-Supported Fields
The batch campaign, unit, and creative APIs support batch updates for only some ad fields. Keep only this capability scope in memory; look up exact operation_type, request fields, enums, and limits in the matching reference before composing the request.
| Object | Batch-supported fields |
|---|
| --- | --- |
| Campaign | Status, current budget, next-day budget |
| Unit | Status, current budget, next-day budget, bid, delivery date, delivery hours, app store direct launch, custom search words, negative search words, price coefficient, first-position price coefficient, age targeting, gender targeting, region targeting, audience package targeting, converted user filter, cleanup task, linked product, audience bid coefficient, delivery speed mode |
| Creative | Status, brand space/name, qualification supplement, monitor URL, call-up URL, cover/image material, title, material description |
Unsupported Batch Changes
If the user asks to batch update a field that the batch APIs do not support, do not force it through a batch API and do not invent an operation_type.
Instead, use the ad-management skill (bilibili-sanlian-ads-ad-management) and update objects one by one through the normal save API:
- Load the ad-management skill and its save/detail references.
- Query the full detail of one target object.
- Replace only the user-requested field in the full detail payload.
- Reconstruct the full save request from the detail, because save APIs are full-save APIs.
- Submit the save request for that single object.
- Query the object again and ask the user to confirm the result.
- Continue object by object only after confirmation, following the same high-risk approval and verification rules.
This fallback is especially important for unit and creative fields that exist in normal ad management but are not listed in the batch-supported fields above.
Execution Flow
- Open the matching reference and confirm endpoint, fields, enums, and limits.
- Query current object details.
- Check whether the requested field is in the batch-supported field scope above, asking for confirmation when needed.
- Build a dry-run summary without submitting a write request.
- Obtain explicit user approval.
- If there is more than one object, submit only 1 object first.
- Record the returned
operation_id. - Call the task list API until the task is completed or failed.
- Call the task detail API and inspect each object's execution result.
- Query object details again and verify final field values.
- Ask the user to confirm the first object's result.
- After user confirmation, submit the second batch with at most 10 objects.
- After the second batch is verified and confirmed by the user, continue later batches with at most 100 objects each.
- After all batches complete, run final queries and summarize the result.
APIs and References
Business APIs use https://cm.bilibili.com/takumi/api as the root path and usually require Authorization: Bearer {access_token}. Add X-Call-Source: sanlian-skills to every MAPI request.
Prohibited Actions
- Do not submit batch updates without explicit user approval.
- Do not skip the single-object trial run.
- Do not continue batch execution before the user confirms the trial result.
- Do not mix multiple operation types in one request; each request can use only one
operation_type. - Do not guess object IDs, account, fields, or target values when they are unclear.
- Do not expose code enum values marked in the references as outside the public MAPI request scope as current public batch API capabilities.