> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stateset.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Publishes a partner's guide+map to the shared library as a reusable template

> (relationship IDs and credentials stripped). Usually triggered automatically on a certification pass; this is the explicit path.

(relationship IDs and credentials stripped). Usually triggered automatically
on a certification pass; this is the explicit path.

### Path parameters

<ParamField path="id" type="string" required>
  Partner ID
</ParamField>

### Response

`PartnerTemplate`

<ResponseField name="certification_pack" type="string">
  The certification pack the source partner passed, when known.
</ResponseField>

<ResponseField name="certified" type="boolean" required>
  Whether this template was published from a partner that passed certification (vs. an ad-hoc publish).
</ResponseField>

<ResponseField name="created_at" type="string (date-time)" required />

<ResponseField name="delimiters" type="Delimiters">
  <Expandable title="Delimiters">
    <ResponseField name="component" type="string" required />

    <ResponseField name="element" type="string" required />

    <ResponseField name="repetition" type="string" />

    <ResponseField name="segment" type="string" required />
  </Expandable>
</ResponseField>

<ResponseField name="id" type="string" required>
  Stable id, derived from the partner name + version so re-certifying the same retailer updates rather than duplicates.
</ResponseField>

<ResponseField name="label" type="object">
  <Expandable title="label">
    <ResponseField name="darkness" type="integer (int32)">
      Print darkness (ZPL `^MD`, 0–30); `None` leaves the printer default.
    </ResponseField>

    <ResponseField name="height_dots" type="integer (int32)">
      Label length in dots (ZPL `^LL`). 1218 = 6' at 203 dpi.
    </ResponseField>

    <ResponseField name="partner_mark" type="string">
      A partner-required mark printed at the label's top edge (e.g. a routing or department code the retailer mandates).
    </ResponseField>

    <ResponseField name="width_dots" type="integer (int32)">
      Print width in dots (ZPL `^PW`). 812 = 4' at 203 dpi.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="name" type="string" required />

<ResponseField name="overlay" type="object">
  <Expandable title="overlay">
    <ResponseField name="element_overrides" type="ElementOverride[]">
      Force an element's value on the first matching segment of an outbound transaction (optionally scoped to a set) — e.g. a fixed qualifier.

      <Expandable title="ElementOverride">
        <ResponseField name="element" type="integer" required>
          1-based element position (element 1 is the first after the segment tag).
        </ResponseField>

        <ResponseField name="segment" type="string" required />

        <ResponseField name="transaction_set" type="string" />

        <ResponseField name="value" type="string" required />
      </Expandable>
    </ResponseField>

    <ResponseField name="extra_segments" type="OverlaySegment[]">
      Extra segments appended to outbound transactions (optionally scoped to a transaction set) — e.g. a partner-required `REF`/`N9`/`DTM`.

      <Expandable title="OverlaySegment">
        <ResponseField name="elements" type="string[]" />

        <ResponseField name="tag" type="string" required />

        <ResponseField name="transaction_set" type="string">
          Restrict to one transaction set (e.g. `856`); `None` applies to all.
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="packing_slip" type="object">
  <Expandable title="packing_slip">
    <ResponseField name="footer_note" type="string">
      Optional footer note (return policy, compliance marks, partner-required statements).
    </ResponseField>

    <ResponseField name="logo_text" type="string">
      Optional logo / brand line printed above the seller name.
    </ResponseField>

    <ResponseField name="seller_name" type="string" required>
      Seller / shipper name printed in the header (the 'from' identity).
    </ResponseField>

    <ResponseField name="show_sscc" type="boolean">
      When true, render each carton's SSCC alongside its contents — required by retailers that scan the slip against the carton label.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="partner_isa_qualifier" type="string" required>
  The retailer's ISA interchange ID qualifier (theirs, not the tenant's).
</ResponseField>

<ResponseField name="reuse_count" type="integer (int32)" required>
  How many times another tenant has inherited this template — the flywheel metric. A high reuse count means the Nth tenant onboards instantly.
</ResponseField>

<ResponseField name="updated_at" type="string (date-time)" required />

<ResponseField name="validation" type="PartnerValidation" required>
  <Expandable title="PartnerValidation">
    <ResponseField name="accepted_inbound" type="string[]">
      If non-empty, inbound transaction sets not in this list are rejected (e.g. `['850', '860']` for a partner that only sends orders).
    </ResponseField>

    <ResponseField name="conditional_rules" type="ConditionalRule[]">
      If-then rules, e.g. 'when BEG02 is SA, a DTM segment is required'.

      <Expandable title="ConditionalRule">
        <ResponseField name="equals" type="string[]">
          Trigger values. Empty means 'when the element is present (non-empty)'.
        </ResponseField>

        <ResponseField name="require_element" type="object" />

        <ResponseField name="require_segment" type="string">
          Then this segment must be present somewhere in the transaction.
        </ResponseField>

        <ResponseField name="when_element" type="integer" required />

        <ResponseField name="when_segment" type="string" required>
          Trigger: segment tag + 1-based element position.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="count_checks" type="object">
      Count-balancing rules per inbound transaction set — `CTT01` must equal the number of `PO1` segments and friends. Checked only when the counter segment is present (pair with `required_segments` to mandate it).
    </ResponseField>

    <ResponseField name="element_constraints" type="ElementConstraint[]">
      Element-level constraints applied to matching segments anywhere in an inbound document — e.g. pin PO1-03 (unit of measure) to an allowed set.

      <Expandable title="ElementConstraint">
        <ResponseField name="allowed" type="string[]">
          If non-empty, the element must be one of these values.
        </ResponseField>

        <ResponseField name="element" type="integer" required>
          1-based element position, e.g. `3` for the PO1 unit of measure.
        </ResponseField>

        <ResponseField name="format" type="object" />

        <ResponseField name="max_len" type="integer">
          Maximum length (in characters) when the element is present.
        </ResponseField>

        <ResponseField name="min_len" type="integer">
          Minimum length (in characters) when the element is present.
        </ResponseField>

        <ResponseField name="required" type="boolean">
          If true, the element must be present (non-empty).
        </ResponseField>

        <ResponseField name="segment" type="string" required>
          Segment tag, e.g. `PO1`.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="required_qualified" type="object">
      Qualified-segment requirements per inbound transaction set — the guide staple `required_references` can't reach beyond REF: 'a DTM\*002 (delivery date) must be present', 'an N1 loop with N101=ST'. The `'*'` key applies to every set.
    </ResponseField>

    <ResponseField name="required_references" type="object">
      REF qualifiers that must be present per inbound transaction set, e.g. `&#123;'850': ['DP']&#125;` to require a department-number reference on every PO.
    </ResponseField>

    <ResponseField name="required_segments" type="object">
      Segment tags that must be present per inbound transaction set, e.g. `&#123;'850': ['DTM', 'REF']&#125;` to require a date and reference on every PO. The `'*'` key applies to every inbound set.
    </ResponseField>

    <ResponseField name="segment_cardinality" type="object">
      Occurrence bounds per inbound transaction set, e.g. `&#123;'850': [&#123;'segment': 'BEG', 'min': 1, 'max': 1&#125;]&#125;` for 'exactly one BEG' or a guide's 'max 200 PO1 lines'. The `'*'` key applies to every set; a set-specific rule for the same segment takes precedence.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="version" type="string" required />

### Status codes

| Code  | Meaning            |
| ----- | ------------------ |
| `200` | Published template |
| `404` | Unknown partner    |

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://edi.stateset.com/v1/partners/{id}/publish-template' \
    --header 'Authorization: Bearer YOUR_API_KEY'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "certification_pack": "string",
    "certified": true,
    "created_at": "2026-08-31T14:22:05Z",
    "delimiters": {
      "component": ">",
      "element": "*",
      "repetition": "string",
      "segment": "~"
    },
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "label": {
      "darkness": 1,
      "height_dots": 1,
      "partner_mark": "string",
      "width_dots": 1
    },
    "name": "Two-Person Tent",
    "overlay": {
      "element_overrides": [
        {
          "element": null,
          "segment": null,
          "transaction_set": null,
          "value": null
        }
      ],
      "extra_segments": [
        {
          "elements": null,
          "tag": null,
          "transaction_set": null
        }
      ]
    },
    "packing_slip": {
      "footer_note": "string",
      "logo_text": "https://cdn.example.com/products/tent-2p.jpg",
      "seller_name": "string",
      "show_sscc": true
    },
    "partner_isa_qualifier": "string",
    "reuse_count": 1,
    "updated_at": "2026-08-31T14:22:05Z",
    "validation": {
      "accepted_inbound": [
        "string"
      ],
      "conditional_rules": [
        {
          "equals": null,
          "require_element": null,
          "require_segment": null,
          "when_element": null,
          "when_segment": null
        }
      ],
      "count_checks": {},
      "element_constraints": [
        {
          "allowed": null,
          "element": null,
          "format": null,
          "max_len": null,
          "min_len": null,
          "required": null,
          "segment": null
        }
      ],
      "required_qualified": {},
      "required_references": {},
      "required_segments": {},
      "segment_cardinality": {}
    },
    "version": "2026-08-01"
  }
  ```
</ResponseExample>
