Skip to content

Patch Template

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

Edit an APPROVED/REJECTED template’s components and re-submit to Meta.

Status mapping: * not found / not owned → 404 (opaque). * PENDING template → 409 status_locked (Meta refuses to edit pending templates). * legacy row with no stored components AND no patch components → 422 legacy_row_supply_components (the dev must re-submit). * channel missing or missing credentials → 422. * invalid component shape → 422. * Meta rejection → returned row with meta_status='rejected' (managed parity — no raise).

template_id
required
Template Id
integer
Media type application/json
PlatformTemplateUpdate

Partial update — any subset of editable fields.

Per Meta’s edit endpoint (POST /{message_template_id}, DP-A verified), the editable surface is components + category + parameter_format. PENDING templates cannot be edited (the service raises status_locked → 409). The router accepts a partial body — exclude_none is applied in the handler.

object
body_text
Any of:
string
category
Any of:
string
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
parameter_format
Any of:
string
Allowed values: NAMED POSITIONAL
variables
Any of:
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"
}
]
}