ms_create_document
Create a draft (unposted) order document in Moysklad for types: demand, supply, purchase order, invoice, or return. Requires confirm_write=true to proceed.
Instructions
Create ANY role document as a DRAFT (applicable=false — not posted, moves nothing). WRITE — requires confirm_write=true AND MOYSKLAD_ALLOW_WRITE=1. Posting is a separate destructive step (ms_post_document). One body shape fits every order-like document (live-verified 2026-06-26 on all 6 types).
Args: doc_type: one of demand | supply | purchaseorder | invoiceout | invoicein | salesreturn | purchasereturn. agent / organization / store / positions / moment / name / description: same as ms_build_document. confirm_write: required (write gate). Returns the created document envelope {"ok": true, "data": {... "id" ...}}, or the guard/gate/validation error (nothing sent).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | ||
| agent | Yes | ||
| store | No | ||
| moment | No | ||
| doc_type | Yes | ||
| positions | No | ||
| description | No | ||
| organization | No | ||
| confirm_write | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |