Replace a template's file
Swaps in a newly uploaded .docx as a template's file and returns a token identifying the version you just wrote. The old file is deleted. Requires the letter_templates:write permission.
Authorization
AuthorizationstringrequiredPath parameters
letterDocumentTemplateIdstringrequiredThe letter document template whose file is being replaced. A 64-bit number sent as a string.
Body
application/json
uploadSessionIdstringrequiredThe sessionId from Start a document file upload. A 64-bit number sent as a string.
ifMatchTokenstringThe token from the last time you wrote this template's file. Send it and the write is refused unless the stored file is still the one that token describes, which stops two editors overwriting each other. Leave it out and the write always goes through.
Response
200 · The file was replaced.
tokenstringrequiredIdentifies the version you have just written. Keep it and send it back as ifMatchToken on your next replace.
docxUrlstringrequiredA URL that serves the new .docx file. The same value the template's filePublicUrl now returns.
400 · `uploadSessionId` is missing or is not a valid id.
401 · The access token is missing, expired, or not a property-manager token.
403 · The token is valid but the caller does not hold the `letter_templates:write` permission.
404 · No template with that id belongs to the caller's company, or it has been deleted.
422 · `ifMatchToken` no longer matches the stored file — somebody else saved in the meantime, so reload and try again — or the upload session is unknown, expired, or already used.
The file this replaces is deleted once the new one is in place. There is no version history and no undo — keep your own copy if you need one.