Create a template from a website

Create a template from a website. View request and response details for this Samva email API endpoint.

POST
/v1/templates/from-website

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.

x-api-key<token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

url*string

The website whose look the template should match: a public https address, or a bare domain such as example.com.

Length1 <= length <= 2048
name?|null
namespaceId?|

The namespace the new template project belongs to. Omit for organization level. A namespace-scoped key always creates in its own namespace.

idempotencyKey*string

Repeating a request with the same key, address, name, and namespace returns the project the first one created, even if the site has since stopped answering. The same key with another address, name, or namespace is refused with a 409.

Length1 <= length <= 255

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/templates/from-website" \  -H "Content-Type: application/json" \  -d '{    "url": "string",    "idempotencyKey": "string"  }'
{  "template": {    "id": "string",    "slug": "string",    "name": "string",    "channel": "email",    "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"      }    },    "publicationId": "string",    "inputContractId": "string",    "inputSchema": {      "property1": "string",      "property2": "string"    }  },  "website": {    "url": "string",    "host": "string"  },  "ask": "string"}

Related documentation