Skip to content

Create Template

POST
/platform/v1/templates
curl --request POST \
--url https://example.com/platform/v1/templates \
--header 'Content-Type: application/json' \
--data '{ "body_text": "example", "category": "utility", "channel_id": 1, "components": [ { "example": { "header_handle": [ "example" ], "header_text": [ "example" ] }, "format": "TEXT", "text": "example", "type": "HEADER" } ], "language_code": "es", "name": "example", "parameter_format": "NAMED", "variables": [ "example" ] }'

Create a platform template and submit it to Meta.

The body accepts EITHER the legacy body_text + variables (body-only fast path, byte-identical to WF3 templates) OR the full Meta components array + optional parameter_format. The Pydantic validator enforces cross-component consistency; the service raises ValueError for component-shape errors / missing or non-owned channel / IG channel / inactive channel — all map to 422.

Media type application/json
PlatformTemplateCreate

Body for POST /platform/v1/templates.

Two valid shapes (exclusive):

  1. Legacy body-only (byte-identical to WF3 templates) — supply body_text and optionally variables; omit components.
  2. Full component surface (WF6) — supply components array and optional parameter_format. body_text is then ignored at submit time (the BODY component carries the text).

Authentication category REQUIRES the components path (the fixed body + OTP button cannot be expressed via body_text alone).

object
body_text
Any of:
string
category
Category
string
default: utility
channel_id
required
Channel Id
integer
components
Any of:
Array
One of: discriminator: type
PlatformTemplateHeaderComponent

HEADER — one per template/card. format drives the invariants.

TEXT requires text; IMAGE/VIDEO/DOCUMENT require example.header_handle; LOCATION carries neither. Enforced by build_template_components._build_header.

object
example
Any of:
PlatformTemplateHeaderExample

HEADER example — header_text (TEXT) XOR header_handle (media).

header_handle is the list-of-one Meta upload handle returned by POST /platform/v1/templates/header-media.

object
header_handle
Any of:
Array<string>
header_text
Any of:
Array<string>
format
required
Format
string
Allowed values: TEXT IMAGE VIDEO DOCUMENT LOCATION
text
Any of:
string
type
required
Type
string
Allowed value: HEADER
language_code
Language Code
string
default: es
name
required
Name
string
>= 1 characters <= 255 characters
parameter_format
Any of:
string
Allowed values: NAMED POSITIONAL
variables
Variables
Array<string>

Successful Response

Media type application/json
PlatformTemplateResponse

Response shape — exposes Meta status snapshot + WF6 component fields.

object
body_text
required
Body Text
string
category
required
Category
string
components
Any of:
Array
Any of:
PlatformTemplateHeaderComponent

HEADER — one per template/card. format drives the invariants.

TEXT requires text; IMAGE/VIDEO/DOCUMENT require example.header_handle; LOCATION carries neither. Enforced by build_template_components._build_header.

object
example
Any of:
PlatformTemplateHeaderExample

HEADER example — header_text (TEXT) XOR header_handle (media).

header_handle is the list-of-one Meta upload handle returned by POST /platform/v1/templates/header-media.

object
header_handle
Any of:
Array<string>
header_text
Any of:
Array<string>
format
required
Format
string
Allowed values: TEXT IMAGE VIDEO DOCUMENT LOCATION
text
Any of:
string
type
required
Type
string
Allowed value: HEADER
created_at
required
Created At
string format: date-time
header_format
Any of:
string
id
required
Id
integer
is_active
required
Is Active
boolean
language_code
required
Language Code
string
meta_category
Any of:
string
meta_rejection_reason
Any of:
string
meta_status
Any of:
string
meta_template_id
Any of:
string
name
required
Name
string
parameter_format
Any of:
string
platform_channel_id
Any of:
integer
variables
required
Variables
Array<string>
Example
{
"components": [
{
"format": "TEXT",
"type": "HEADER"
}
]
}

Validation Error

Media type application/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
ctx
Context
object
input
Input
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
Example generated
{
"detail": [
{
"ctx": {},
"input": "example",
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
]
}