Publish an exact template commit
Publish an exact template commit. View request and response details for this Samva email API endpoint.
Builds an exact Git commit and entry path, stores the immutable compiled template and its assets, records the input contract it validates against, and makes that publication current. A commit that compiles to the same build as an existing publication makes that publication current again instead of recording another.
apiKeyx-api-key<token>id*string^tmpl_[0-9a-hjkmnp-tv-z]{16,24}$application/json- body
projectId*TemplateProjectId^tproj_[0-9a-hjkmnp-tv-z]{16,24}$commitSha*string^[a-f0-9]{40}$entryPath*string^(?!\/)(?!.*\\)(?!.*(?:^|\/)\.{1,2}(?:\/|$))(?!.*(?:^|\/)\.git(?:\/|$))(?:templates|emails)\/.+\.tsx$length <= 1024expectedWorkspaceRevision*string1 <= lengthifCurrentPublicationId?|nullSuccess
application/json- response
id*TemplatePublicationId^tpub_[0-9a-hjkmnp-tv-z]{16,24}$organizationId*OrganizationId^org_[0-9a-hjkmnp-tv-z]{16,24}$projectId*TemplateProjectId^tproj_[0-9a-hjkmnp-tv-z]{16,24}$templateId*TemplateId^tmpl_[0-9a-hjkmnp-tv-z]{16,24}$inputContractId*TemplateInputContractId^tcon_[0-9a-hjkmnp-tv-z]{16,24}$commitSha*string^[a-f0-9]{40}$treeSha*string^[a-f0-9]{40}$entryPath*string^(?!\/)(?!.*\\)(?!.*(?:^|\/)\.{1,2}(?:\/|$))(?!.*(?:^|\/)\.git(?:\/|$))(?:templates|emails)\/.+\.tsx$length <= 1024buildIdentity*string^[a-f0-9]{64}$manifest*compiled*assets*array<>warnings*array<>incompatibilities*array<>status*stringpublishedAt*stringpublishedBy*string|nullcreatedAt*stringimport { createClient } from "samva";const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });const result = await samva.templates.publish({ "id": "example", "projectId": "example", "commitSha": "example", "entryPath": "example", "expectedWorkspaceRevision": "example"});{ "id": "string", "organizationId": "string", "projectId": "string", "templateId": "string", "inputContractId": "string", "commitSha": "string", "treeSha": "string", "entryPath": "string", "buildIdentity": "string", "manifest": { "templateKey": "string", "compiled": { "version": 1, "digest": "string", "bytes": 0 }, "compiler": "string", "input": { "schemaDigest": "string", "contractDigest": "string" }, "assets": { "base": "string", "entries": [ { "path": "string", "fileName": "string", "digest": "string", "bytes": 0, "contentType": "string", "url": "string" } ] }, "source": { "commitSha": "string", "treeSha": "string", "entryPath": "string", "treeDigest": "string" }, "brand": { "slug": "string", "css": "string", "assets": { "logoUrl": "string", "logoDarkUrl": "string", "iconUrl": "string" }, "footer": { "companyName": "string", "websiteUrl": "string", "address": { "street1": "string", "street2": "string", "city": "string", "region": "string", "postalCode": "string", "country": "string" }, "socialLinks": [ { "label": "string", "url": "string" } ] }, "renderedFooter": { "html": "string", "text": "string", "headCss": "string" }, "digest": "string", "rendersFooter": "every" } }, "compiled": { "key": "string", "digest": "string" }, "assets": [ { "path": "string", "fileName": "string", "digest": "string", "bytes": 0, "contentType": "string", "url": "string" } ], "warnings": [ { "code": "string", "severity": "error", "message": "string", "origins": [ { "fileName": "string", "lineNumber": 1, "columnNumber": 1 } ], "clients": [ "string" ], "notes": "string", "provenance": "string", "fixtures": [ "string" ], "occurrences": [ [ { "fileName": "string", "lineNumber": 1, "columnNumber": 1 } ] ], "compatibility": { "assessment": "risk", "title": "string" } } ], "incompatibilities": [ { "code": "string", "severity": "error", "message": "string", "origins": [ { "fileName": "string", "lineNumber": 1, "columnNumber": 1 } ], "clients": [ "string" ], "notes": "string", "provenance": "string", "fixtures": [ "string" ], "occurrences": [ [ { "fileName": "string", "lineNumber": 1, "columnNumber": 1 } ] ], "compatibility": { "assessment": "risk", "title": "string" } } ], "status": "string", "publishedAt": "string", "publishedBy": "string", "createdAt": "string"}Related documentation
Patch template project files
Applies revision-checked file patches to the shared project workspace overlay. Use this endpoint to patch template project files through the Samva email API.
Put a template project asset
Writes one image or font (png, jpg, jpeg, gif, webp, or woff2) into the shared project workspace as an unsaved file; Save commits it.