Finalize a template by generating its validation schema
PUT/templates/:id/approve
Completes the legacy three-step template flow: generates the JSON validation schema from the submitted field mappings (honoring the tenant-specific schema, when one is configured), uploads it to GCS as schema.json, and moves the template record to status success with its template/schema object paths recorded.
When to use: Call this as step 3 of the legacy flow, after PUT /templates/{id} has confirmed the column mappings. Templates created via POST /templates/single-step or the scratch builder are already approved and must not go through this endpoint.
How: Supply {id} and the required tenant-id header. The body is required and is not merely re-validated: the submitted fields are the direct input to schema generation, so send the same mappings confirmed in step 2. The same validation rules as PUT /templates/{id} apply - every stored CSV column must be mapped and every non-skipped mappedKey must be a known system field (400 otherwise), and a GROUP jobType requires the tenant's supportGroupRosters configuration.
Returns: An ApproveTemplateResponse with the fields the schema was generated from and the final status: success on completion, or failure when schema generation or upload failed with an I/O error - in that case the template record is left unchanged (it remains in-progress) and the call can be retried.
Request
Responses
- 200
- 400
- 401
- 403
- 500
The mappings the schema was generated from and the final approval status. Note that failure is reported with HTTP 200 - check the body's status, not just the status code.
A column of the stored template.csv is missing from fields, a mappedKey is not a known system field, or the requested GROUP type is not enabled for the tenant. Each entry in errors names the offending column in title and the cause in reason; fix the payload and retry.
Authentication required - supply a valid bearer token.
The authenticated user lacks the UPDATE_TEMPLATE permission.
Unexpected server-side failure (for example a data-layer outage). Safe to retry once the underlying issue clears.