[Migration map](../reference/tool-name-migration.md).
# sitemap_apply
Set desired indexing flags for existing public paths in one channel workflow.
Preserve any uncertain task's journal and original inputs; do not edit/copy journals or create a new request ID to bypass uncertainty.
## Inputs and planning
First use [sitemap_get](publ_sitemap_get.md). OWNER or DELEGATEE with `MANAGE_SEO_TOOLS`, the selected channel context and an observed `ACTIVATED` connected domain are required. Hosted account scope excludes both this tool and its recovery type.
| Field | Required here | Contract |
| --- | --- | --- |
| `changes` | Yes | array; min items 1; max items 100 |
| `changes[].path` | Yes | string; min length 1; max length 4096 |
| `changes[].indexingAllowed` | Yes | boolean; Desired indexing switch: true removes the disallowed path; false adds it. This is not a request to toggle the current value. |
| `confirmToken` | No | string; pattern `^ct[a-f\d]{32}$`; The confirmToken from this tool's preview result. Omit it to preview; repeat the same input with it to execute. |
Unknown properties and duplicate paths are rejected. Bounds of 100 changes and 4,096 path characters are bridge resource policy, not source UI limits. Runtime path, uniqueness and channel refinements are not fully represented in exported JSON Schema.
```json
{
"channelCode":"selected-channel-code",
"requestId":"sitemap-plan-001",
"expectedRevision":"0000000000000000000000000000000000000000000000000000000000000000",
"changes":[
{"path":"/pages/example-a","indexingAllowed":true},
{"path":"/pages/example-b","indexingAllowed":false}
],
"dryRun":true
}
```
Replace example paths, channel and zero-filled revision with a single fresh read's values. This is a schema example, not an authorized target or successful plan. An unverified/inactive domain blocks planning too. `SITEMAP_TARGET_UNAVAILABLE` rejects unknown or hidden paths; `SITEMAP_PAGE_NOT_PUBLIC` rejects private rows. The entire plan is validated before dispatch. It cannot create, publish, delete or rename a page.
`PLAN_READY` includes `steps` for changes that differ from stored values, `wouldWrite`, `writesPerformed:false`, task identity and `verification.confirmed:false`. Unchanged flags are omitted from steps. A plan's task identity is not evidence of a saved job. Even a matching existing task's dry run makes a fresh observation and checks the original revision; it does not resume that task.
## Implemented dispatch and result behavior
With `dryRun:false`, the implementation saves the original plan and runs sequential steps. `indexingAllowed:false` sends POST and true sends DELETE to the indexing-disallowed-paths endpoint; **both send JSON `{path}`**. The transport requires HTTP 200 with a data envelope. No bulk or conditional-write guarantee is established. Before each untouched step it checks the complete expected snapshot and context, durably marks the step sent, then dispatches. It compares the receipt and repeated fresh reads against all six fields of every expected row, including hidden and unrelated rows, and checks the domain again. Exact write-response compatibility remains unverified in actual service execution.
The batch is not atomic and has no automatic rollback. A later failure leaves completed changes in place. No-op application creates a task but dispatches no write; it still requires stable final state and an active domain.
| Output | Interpretation |
| --- | --- |
| `SITEMAP_INDEXING_COMPLETE` | Saved completion, projected final rows/domain and revision. Fresh completion has confirmation true; historical replay has confirmation false. |
| `SITEMAP_INDEXING_PAUSED` | Remaining work stopped; inspect `lastResult`, saved steps and the recovery limits below. |
| `steps`, `completedSteps`, `totalSteps` | Ordered saved plan and phase accounting. Steps have `prepared`, `sent` or `done` phase plus `acknowledged`. |
| `dispatchesRecorded` | Non-prepared journal entries, not proof each request reached the server. |
| `acknowledgedWrites` | Writes whose receipt and independent readback both passed. |
| `writesPerformed` | False for no recorded dispatch, true when all recorded dispatches are acknowledged, otherwise null. |
Task results use `taskType:"sitemap-indexing"`. One console destination opens the selected channel's `/seo-tools/sitemap` screen; demo omits a real link. Context/authentication failures return pending state without earlier target details. A storage failure can return `SITEMAP_JOURNAL_UNVERIFIED` and `journalPersistence.saved:false`.
New plans record the current verified context after stable readback; fresh completion revisions use that current context, while historical completion keeps its saved identity. Verified internal renewal is reconciled only within the originating port. Existing journals, fingerprints and input revisions are not silently rebound after an external replacement. The sitemap-indexing namespace follows the selected task backend; hosted database wiring is not actual hosted recovery evidence.
## Recovery identity and verification limits
Status, resume and an existing apply/dry run validate that the embedded journal ID equals the requested task ID before looking up target context. The same requested ID selects the journal file and held lock. A mismatch returns `error / TASK_STATE_UNVERIFIED` for the requested ID without returning saved target details, advancing either task or dispatching a write. The original input fingerprint, context and snapshot checks also remain in force. This correction does not repair an already inconsistent journal; preserve it for inspection.
The implemented journal protocol never resends a `sent` step, including explicit rejection, missing acknowledgement or a crash after checkpointing but before transport. Reconciliation compares the whole expected snapshot after that step. A match may mark it done without an acknowledgement and then execute untouched later steps. A mismatch produces `SITEMAP_OUTCOME_UNKNOWN` inside the paused result. Matching observed state cannot prove which actor made the change.
Status is historical and does not reread the sitemap; it does recheck connection/channel authority. Completed replay/resume returns historical completion. Fresh get is needed for present values. `storedCompletion:true` therefore does not imply `verification.confirmed:true`. The saved context binds connection, operator, credential version, permission and channel; the original domain is part of the snapshot comparison.
`TASK_INPUT_CONFLICT` rejects reused IDs with different original inputs. `SITEMAP_CONFLICT`, `SITEMAP_RECEIPT_MISMATCH` and `SITEMAP_READBACK_MISMATCH` stop progress; they do not authorize another request or blind retry. Preserve the original inputs and journal for investigation.
This tool changes stored indexing flags only. It does not change domain configuration, SEO metadata, publication, payment or access policy. Completion does not prove causal ownership, crawler indexing, visitor access, cache propagation or deployed client isolation.
[Indexing workflow](../guides/sitemap.md) · [Read current state](publ_sitemap_get.md)