{
  "schemaVersion": 1,
  "snapshotDate": "2026-10-23",
  "slug": "reference-xero-invoicedraft-encode",
  "title": "Encode Xero Draft Invoice Write",
  "section": "Library asset reference",
  "description": "Xero Draft Invoice Write is a versioned Xero data block. Core fields are typed and provider-owned additional fields are preserved. Example: JSON Schema is enforced at sockets. Optional fields stay absent; they are not filled from schema def",
  "kind": "node",
  "url": "/wiki/reference-xero-invoicedraft-encode/",
  "markdown": "/wiki/reference-xero-invoicedraft-encode/index.md",
  "json": "/wiki/reference-xero-invoicedraft-encode/index.json",
  "headings": [
    {
      "id": "audited-socket-contract-21-october-2026",
      "title": "Audited socket contract (21 October 2026)",
      "depth": 2
    },
    {
      "id": "catalog-identity",
      "title": "Catalog identity",
      "depth": 2
    },
    {
      "id": "inputs",
      "title": "Inputs",
      "depth": 2
    },
    {
      "id": "outputs",
      "title": "Outputs",
      "depth": 2
    },
    {
      "id": "configuration-schema",
      "title": "Configuration schema",
      "depth": 2
    },
    {
      "id": "source-and-installed-versions",
      "title": "Source and installed versions",
      "depth": 2
    }
  ],
  "sources": [
    "../OpenNodeFlow-Library/work/catalog-all.mjs",
    "../OpenNodeFlow-Library/work/azure-pack-consolidation-20261022/catalog-policy.mjs",
    "../OpenNodeFlow-Library/work/developer-packs-20261022/catalog.mjs",
    "shared/seed.ts",
    "shared/storage-library.ts",
    "shared/variable-library.ts",
    "shared/control-flow.ts",
    "shared/remote-routes.ts",
    "server/runtime-library.ts",
    "shared/error-library.ts",
    "shared/storage-model.ts",
    "shared/builtin-documentation.ts"
  ],
  "family": "xero",
  "contract": {
    "key": "xero.invoiceDraft.encode",
    "slug": "xero-invoicedraft-encode",
    "name": "Encode Xero Draft Invoice Write",
    "kind": "node",
    "family": "xero",
    "packId": null,
    "category": "Xero",
    "description": "",
    "inputs": [
      {
        "id": "exec",
        "name": "Execute",
        "type": "control",
        "typeName": "Control",
        "required": false
      },
      {
        "id": "InvoiceID",
        "name": "InvoiceID",
        "type": "string",
        "typeName": "Text",
        "required": false
      },
      {
        "id": "Type",
        "name": "Type",
        "type": "string",
        "typeName": "Text",
        "required": true
      },
      {
        "id": "Contact",
        "name": "Contact",
        "type": "@xero.contactRef",
        "typeName": "Xero Contact Reference",
        "typeKey": "xero.contactRef",
        "typeVersion": 1,
        "required": true
      },
      {
        "id": "Date",
        "name": "Date",
        "type": "string",
        "typeName": "Text",
        "required": false
      },
      {
        "id": "DueDate",
        "name": "DueDate",
        "type": "string",
        "typeName": "Text",
        "required": false
      },
      {
        "id": "InvoiceNumber",
        "name": "InvoiceNumber",
        "type": "string",
        "typeName": "Text",
        "required": false
      },
      {
        "id": "Reference",
        "name": "Reference",
        "type": "string",
        "typeName": "Text",
        "required": false
      },
      {
        "id": "CurrencyCode",
        "name": "CurrencyCode",
        "type": "string",
        "typeName": "Text",
        "required": false
      },
      {
        "id": "LineAmountTypes",
        "name": "LineAmountTypes",
        "type": "string",
        "typeName": "Text",
        "required": false
      },
      {
        "id": "LineItems",
        "name": "LineItems",
        "type": "@xero.lines",
        "typeName": "Xero Invoice Lines",
        "typeKey": "xero.lines",
        "typeVersion": 1,
        "required": true
      },
      {
        "id": "Status",
        "name": "Status",
        "type": "string",
        "typeName": "Text",
        "required": false
      }
    ],
    "outputs": [
      {
        "id": "next",
        "name": "Next",
        "type": "control",
        "typeName": "Control",
        "required": false
      },
      {
        "id": "value",
        "name": "value",
        "type": "@xero.invoiceDraft",
        "typeName": "Xero Draft Invoice Write",
        "typeKey": "xero.invoiceDraft",
        "typeVersion": 1,
        "required": true
      },
      {
        "id": "error",
        "name": "On error",
        "type": "control",
        "typeName": "Control",
        "required": false
      }
    ],
    "configSchema": {},
    "documentation": "Xero Draft Invoice Write is a versioned Xero data block. Core fields are typed and provider-owned additional fields are preserved. Example: \n\n```json\n{\n  \"Type\": \"ACCREC\",\n  \"Contact\": {\n    \"ContactID\": \"11111111-1111-4111-8111-111111111111\"\n  },\n  \"Date\": \"2026-10-20\",\n  \"LineItems\": [\n    {\n      \"Description\": \"Synthetic service\",\n      \"Quantity\": 2,\n      \"UnitAmount\": 10,\n      \"AccountCode\": \"200\"\n    }\n  ],\n  \"Status\": \"DRAFT\"\n}\n```\n\nJSON Schema is enforced at sockets. Optional fields stay absent; they are not filled from schema defaults. [Xero accounting requests](https://developer.xero.com/documentation/api/accounting/requests-and-responses/), [OAuth tokens](https://developer.xero.com/documentation/guides/oauth2/token-types/), [tenant connections](https://developer.xero.com/documentation/guides/oauth2/tenants/), [idempotency](https://developer.xero.com/documentation/guides/idempotent-requests/idempotency/), [rate limits](https://developer.xero.com/documentation/best-practices/api-call-efficiencies/rate-limits/).\n\nEncode field sockets into `value`. Optional `remainder` preserves provider fields, then explicitly connected/literal fields override matching keys. No network effects.\n\n## Audited socket contract (21 October 2026)\n\nInputs:\n- `InvoiceID`: `string`; optional (absent stays absent).\n- `Type`: `string`; required.\n- `Contact`: `@xero.contactRef`; required.\n- `Date`: `string`; optional (absent stays absent).\n- `DueDate`: `string`; optional (absent stays absent).\n- `InvoiceNumber`: `string`; optional (absent stays absent).\n- `Reference`: `string`; optional (absent stays absent).\n- `CurrencyCode`: `string`; optional (absent stays absent).\n- `LineAmountTypes`: `string`; optional (absent stays absent).\n- `LineItems`: `@xero.lines`; required.\n- `Status`: `string`; optional (absent stays absent).\n\nOutputs:\n- `value`: `@xero.invoiceDraft`; required.\n\nConfiguration:\nNo asset-specific configuration.\n\nKnown provider records and list elements have structural schemas. Explicit dynamic payloads, selected query results and provider extensions retain the recursive JSON Value vocabulary; they do not imply a known provider entity. Null is distinct from omission. Runtime validates the exact selected immutable type version; reading newer documentation never repins existing graphs. This audit used synthetic fixtures/local mocks and does not establish live provider authorization or delivery.",
    "runtime": "javascript",
    "tags": [
      "codec",
      "library-expansion",
      "xero"
    ],
    "source": "baseline-catalog"
  }
}
