Publish an exact template commit

Publish an exact template commit. View request and response details for this Samva email API endpoint.

POST
/v1/templates/{id}/publications

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.

Authorization

apiKey
headerx-api-key<token>

Path Parameters

id*string
Match^tmpl_[0-9a-hjkmnp-tv-z]{16,24}$

Request Body

application/json
  1. body
projectId*TemplateProjectId
Match^tproj_[0-9a-hjkmnp-tv-z]{16,24}$
commitSha*string
Match^[a-f0-9]{40}$
entryPath*string
Match^(?!\/)(?!.*\\)(?!.*(?:^|\/)\.{1,2}(?:\/|$))(?!.*(?:^|\/)\.git(?:\/|$))(?:templates|emails)\/.+\.tsx$
Lengthlength <= 1024
expectedWorkspaceRevision*string
Length1 <= length
ifCurrentPublicationId?|null

Response Body

Success

application/json
  1. response
id*TemplatePublicationId
Match^tpub_[0-9a-hjkmnp-tv-z]{16,24}$
organizationId*OrganizationId
Match^org_[0-9a-hjkmnp-tv-z]{16,24}$
projectId*TemplateProjectId
Match^tproj_[0-9a-hjkmnp-tv-z]{16,24}$
templateId*TemplateId
Match^tmpl_[0-9a-hjkmnp-tv-z]{16,24}$
inputContractId*TemplateInputContractId
Match^tcon_[0-9a-hjkmnp-tv-z]{16,24}$
commitSha*string
Match^[a-f0-9]{40}$
treeSha*string
Match^[a-f0-9]{40}$
entryPath*string
Match^(?!\/)(?!.*\\)(?!.*(?:^|\/)\.{1,2}(?:\/|$))(?!.*(?:^|\/)\.git(?:\/|$))(?:templates|emails)\/.+\.tsx$
Lengthlength <= 1024
buildIdentity*string
Match^[a-f0-9]{64}$
manifest*
compiled*
assets*array<>
warnings*array<>
incompatibilities*array<>
status*string
publishedAt*string
publishedBy*string|null
createdAt*string
Example Request
import { 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"});
Example Response
{  "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