Save column mappings as a roster upload template
POST/roster-upload/:templateId/column-mapping/template
Creates a new roster upload template from a set of confirmed column mappings, or updates an existing one.
When to use: call this after reviewing the analysis returned by POST /roster-upload/{templateId}/column-mapping; this endpoint persists the mappings the user confirmed.
Preconditions: supply the tenant-id header and the templateId the mappings belong to. In the request body, set updateExistingTemplate to true to update the template identified by templateId, or omit it (or set it to false) to create a new one; mappings carries the confirmed field list and jobType selects the field catalogue. A null mappings list is treated as an empty list rather than rejected. templateName and templateDescription are not enforced by this endpoint on either create or update. The tenant must have the column mapping feature enabled and the caller must hold the UPDATE_ROSTER_UPLOAD permission - both failures return 403, distinguished by the reason field of the error body (FEATURE_DISABLED identifies the feature-flag case).
Validation: the field mappings are validated before anything is written. If validation fails the request returns 400 carrying the individual field errors and no template state is changed.
What you get back: the resulting template record, including templateId, templateUrl, schemaUrl, the persisted fields, and status. Both creation and update return 200.
Side effects: on success the confirmed mappings are also written to a tenant-scoped column mapping cache, which later mapping analyses use to suggest matches for unmapped headers. That cache write is fail-open - if it fails the template is still saved and the request still succeeds. The operation is not idempotent: submitting the same mappings twice with updateExistingTemplate set to false creates two templates.
Request
Responses
- 200
- 400
- 401
- 403
- 500
The saved template, including its identifier, hosted URLs, and the persisted field mappings. Returned for both creation and update.
Returned when the submitted field mappings fail validation. The body lists the offending fields; no template or cache state is written. Correct the listed fields and resubmit.
Returned when the request carries no valid authentication.
Returned when the column mapping feature is disabled for the tenant (reason is FEATURE_DISABLED) or the caller lacks the UPDATE_ROSTER_UPLOAD permission. Ask an administrator to enable the feature or grant the permission.
Returned when saving the template fails unexpectedly. Retry; if the failure persists, contact support.