Preview Communication Template
Communications · REST API reference
/v1/communication-templates/previewAuthentication
Bearer API key or Facily session, subject to permissions and facility scope.
Authentication and scopeRequest example
Replace bracketed path values with real IDs from your environment. The body, where shown, is generated from the schema and uses illustrative values.
curl --request POST \
--url 'https://api.staging.facily.ai/v1/communication-templates/preview' \
--header "Authorization: Bearer $FACILY_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"kind": "email",
"body": "string",
"context_mode": "sample",
"default_key": "string",
"facility_id": "00000000-0000-4000-8000-000000000001",
"subject": "string",
"template_id": "00000000-0000-4000-8000-000000000001",
"tenant_id": "00000000-0000-4000-8000-000000000001"
}'Request body
application/json · Required
bodystring | nullShow body schema
string | nullVariant 1: string
stringVariant 2: null
nullcontext_modestringDefault: "sample" · Values: "sample", "tenant"
default_keystring | nullShow default_key schema
string | nullVariant 1: string
stringVariant 2: null
nullfacility_idstring | nullFormat: uuid
Show facility_id schema
string | nullVariant 1: string
stringVariant 2: null
nullkindstringrequiredValues: "email", "sms", "document", "layout"
subjectstring | nullShow subject schema
string | nullVariant 1: string
stringVariant 2: null
nulltemplate_idstring | nullFormat: uuid
Show template_id schema
string | nullVariant 1: string
stringVariant 2: null
nulltenant_idstring | nullFormat: uuid
Show tenant_id schema
string | nullVariant 1: string
stringVariant 2: null
nullResponses
Expand a status to inspect its schema. Generated examples show structure and synthetic values.
200Successful Response
{
"data": {
"html": "string",
"pdf_base64": "string"
},
"meta": {
"request_id": "string"
}
}application/json
dataTemplatePreviewResponserequiredRendered preview output. `pdf_base64` is populated only for `kind == "document"` -- every other kind renders HTML only.
Show data schema
htmlstringrequiredpdf_base64string | nullShow pdf_base64 schema
string | nullVariant 1: string
stringVariant 2: null
nullmetaMetarequiredEnvelope metadata. Every response carries one.
Show meta schema
request_idstringrequired400Validation error
{
"error": {
"code": "string",
"message": "string",
"details": {}
},
"meta": {
"request_id": "string"
}
}application/json
errorErrorBodyrequiredThe shape of error.* in an error response.
Show error schema
codestringrequireddetailsobject | nullShow details schema
object | nullVariant 1: object
objectVariant 2: null
nullmessagestringrequiredmetaMetarequiredEnvelope metadata. Every response carries one.
Show meta schema
request_idstringrequired401Unauthenticated
{
"error": {
"code": "string",
"message": "string",
"details": {}
},
"meta": {
"request_id": "string"
}
}application/json
errorErrorBodyrequiredThe shape of error.* in an error response.
Show error schema
codestringrequireddetailsobject | nullShow details schema
object | nullVariant 1: object
objectVariant 2: null
nullmessagestringrequiredmetaMetarequiredEnvelope metadata. Every response carries one.
Show meta schema
request_idstringrequired403Permission denied
{
"error": {
"code": "string",
"message": "string",
"details": {}
},
"meta": {
"request_id": "string"
}
}application/json
errorErrorBodyrequiredThe shape of error.* in an error response.
Show error schema
codestringrequireddetailsobject | nullShow details schema
object | nullVariant 1: object
objectVariant 2: null
nullmessagestringrequiredmetaMetarequiredEnvelope metadata. Every response carries one.
Show meta schema
request_idstringrequired404Not found
{
"error": {
"code": "string",
"message": "string",
"details": {}
},
"meta": {
"request_id": "string"
}
}application/json
errorErrorBodyrequiredThe shape of error.* in an error response.
Show error schema
codestringrequireddetailsobject | nullShow details schema
object | nullVariant 1: object
objectVariant 2: null
nullmessagestringrequiredmetaMetarequiredEnvelope metadata. Every response carries one.
Show meta schema
request_idstringrequired409Business logic error
{
"error": {
"code": "string",
"message": "string",
"details": {}
},
"meta": {
"request_id": "string"
}
}application/json
errorErrorBodyrequiredThe shape of error.* in an error response.
Show error schema
codestringrequireddetailsobject | nullShow details schema
object | nullVariant 1: object
objectVariant 2: null
nullmessagestringrequiredmetaMetarequiredEnvelope metadata. Every response carries one.
Show meta schema
request_idstringrequired503Temporary failure
{
"error": {
"code": "string",
"message": "string",
"details": {}
},
"meta": {
"request_id": "string"
}
}application/json
errorErrorBodyrequiredThe shape of error.* in an error response.
Show error schema
codestringrequireddetailsobject | nullShow details schema
object | nullVariant 1: object
objectVariant 2: null
nullmessagestringrequiredmetaMetarequiredEnvelope metadata. Every response carries one.
Show meta schema
request_idstringrequired