Create a template from a website
Create a template from a website. View request and response details for this Samva email API endpoint.
Checks that the website is a public page Samva can read, creates an email template project from Samva's canonical TSX starter, and returns the template with status 201 and the request that makes the template assistant match the site. The assistant runs when the request is sent in the editor; it rebuilds the project's theme and blocks from the site and proposes a brand that applies only after the customer approves it. A 422 names why the site cannot be matched: not a web address, not public, no answer, a missing page, refused automated visits, or not a web page.
apiKeyx-api-key<token>idempotency-key*string1 <= length <= 255application/json- body
url*stringThe website whose look the template should match: a public https address, or a bare domain such as example.com.
1 <= length <= 2048name?|nullnamespaceId?|The namespace the new template project belongs to. Omit for organization level. A namespace-scoped key always creates in its own namespace.
Success
application/json- response
template*website*ask*stringThe request to send the template assistant in the editor. The assistant reads the site, rebuilds the project's theme and blocks to match it, and proposes a brand that changes nothing until the customer applies it.
import { createClient } from "samva";const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });const result = await samva.templates.createFromWebsite({ "url": "example"});{ "template": { "id": "string", "slug": "string", "name": "string", "channel": "sms", "projectId": "string", "namespaceId": "string", "shared": true, "entryPath": "string", "status": "draft", "isActive": true, "publishedAt": "string", "brand": { "slug": "string", "digest": "string", "stale": true }, "fromDefault": { "email": "string", "name": "string" }, "usageCount": 0, "lastUsedAt": "string", "createdAt": "string", "updatedAt": "string", "familyId": "string", "description": "string", "category": "transactional", "replyToDefault": [ "string" ], "trackingDefault": { "opens": true, "clicks": true }, "email": { "subject": "string", "preheader": "string", "headers": { "property1": "string", "property2": "string" } }, "sms": { "body": "string", "encoding": "string", "estimatedSegments": -9007199254740991, "category": "transactional" }, "whatsapp": { "name": "string", "language": "string", "category": "marketing", "components": [ { "type": "HEADER", "format": "TEXT", "text": "string", "example": { "header_text": [ "string" ] } } ] }, "publicationId": "string", "inputContractId": "string", "inputSchema": { "property1": "string", "property2": "string" } }, "website": { "url": "string", "host": "string" }, "ask": "string"}