/postman:syncapi — sync one API¶
The kernel. The most surgical command: it syncs exactly one API and touches nothing else. If pointing at one function and watching a complete request materialize feels like magic, everything else is just a different selector over the same engine.
Usage¶
Targeting¶
You can identify the route three ways:
- Function name —
createPayment - Route string —
"POST /payments/refund" - Pasted code — a snippet of the handler
If the target is ambiguous, the command lists candidates and asks — it never guesses silently.
Flags¶
| Flag | Effect |
|---|---|
--into <path> |
Folder inside the collection where the request lands (e.g. payments, auth/oauth). Missing folders are auto-created. Omitted → config.defaultInto. |
--confirm |
Required only when targeting a collection other than the configured default (a safety rail). |
Example¶
SYNC PREVIEW — POST /payments → collection / payments [NEW] [openapi]
+ Request POST {{base_url}}/payments
+ Auth Bearer {{token}} (from require_auth middleware)
+ Body { "amount": 4200, "currency": "USD", "method": "card" }
+ Responses 201 Created, 400, 401, 422, 500
+ Tests status(201) · schema(PaymentResponse) · business(amount > 0)
+ Examples 1 success, 4 error
Write? [y / n]
What happens, step by step¶
- Resolve target — the resolver finds
createPayment→ a normalized route model. - Parse — extract method, path, body type, auth middleware, response models, docstring.
- Build — the engine assembles the full request object.
- Read collection —
GETthe collection, scan its structure for an existingPOST /payments. Not found → it's new. Resolve--into paymentsto the folder (create if missing). - Diff — render the preview in Claude Code.
- Confirm — the diff is always shown; a non-default collection target needs
--confirm. - Write — merge into the collection JSON,
PUT /collections/{uid}. - Record — update
lastUpdateinpostman-mcp.json.
Updating an existing API is identical, except step 4 finds the request and step 7 merges in place. Its test scripts and manual examples are read from Postman and preserved — only structural fields change. See the merge engine.