Template&Sender ID
This document describes the RESTful API interfaces related to template configuration and signature configuration.
Basic Information
- Domain:
https://smsapi.engagelab.com - Authentication Method: Basic Authentication (Base64 encoding)
- Format:
Authorization: Basic base64(apikey:apisecret) - Example: Encode
apikey:apisecretin Base64, then addAuthorization: Basic <encoded string>to the request header.
- Format:
- Content-Type:
application/json
Response Format
Successful Response
Successful responses directly return a data object or array:
{
"template_id": "123456789",
"template_name": "Example Template",
...
}
Or a list response:
[
{
"template_id": "123456789",
"template_name": "Example Template",
...
}
]
Error Response
Error response format:
{
"code": 400,
"message": "Error description"
}
Template Configuration Interfaces
1. Get Template Configuration List
Interface Description: Retrieve the list of all template configurations under the current business.
Request Information:
- Method:
GET - Path:
/v1/template-configs - Authentication: Required
Request Parameters: None
Response Example:
[
{
"template_id": "123456789",
"template_name": "Order Notification Template",
"template_type": "utility",
"template_content": "Your order {order_no} has been shipped and is expected to arrive by {delivery_time}.",
"country_codes": "CN,US",
"status": 2,
"sign_id": "987654321",
"sign_name": "Company Name",
"sign_position": 2,
"sign_status": 2,
"audit_remark": "",
"created_time": 1699000000,
"updated_time": 1699000000
}
]
Response Field Description:
| Field Name | Type | Description |
|---|---|---|
| template_id | string | Template ID |
| template_name | string | Template Name |
| template_type | string | Template Type: utility (notification), marketing (marketing) |
| template_content | string | Template Content |
| country_codes | string | Main sending country codes, separated by commas |
| status | int | Status: 1-Pending Review, 2-Approved, 3-Rejected |
| sign_id | string | Signature ID (optional) |
| sign_name | string | Signature Name (optional) |
| sign_position | int | Signature Position: 0-None, 1-Prefix, 2-Suffix (optional) |
| sign_status | int | Signature Status (optional) |
| audit_remark | string | Audit Remarks |
| created_time | int64 | Creation Time (Unix timestamp) |
| updated_time | int64 | Update Time (Unix timestamp) |
2. Get Template Configuration Details
Interface Description: Retrieve detailed information of a template configuration by template ID.
Request Information:
- Method:
GET - Path:
/v1/template-configs/:templateId - Authentication: Required
Path Parameters:
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| templateId | string | Yes | Template ID |
Response Example:
{
"template_id": "123456789",
"template_name": "Order Notification Template",
"template_type": "utility",
"template_content": "Your order {order_no} has been shipped and is expected to arrive by {delivery_time}.",
"country_codes": "CN,US",
"status": 2,
"sign_id": "987654321",
"sign_name": "Company Name",
"sign_position": 2,
"sign_status": 2,
"audit_remark": "",
"created_time": 1699000000,
"updated_time": 1699000000
}
Error Responses:
400: Template ID format error or template does not exist500: Internal server error
3. Create Template Configuration
Interface Description: Create a new template configuration.
Request Information:
- Method:
POST - Path:
/v1/template-configs - Authentication: Required
Request Body:
{
"template_name": "Order Notification Template",
"template_type": "utility",
"template_content": "Your order {order_no} has been shipped and is expected to arrive by {delivery_time}.",
"country_codes": "CN,US",
"add_signature": true,
"sign_id": "987654321",
"sign_position": 2
}
Request Field Description:
| Field Name | Type | Required | Description |
|---|---|---|---|
| template_name | string | Yes | Template Name, up to 255 characters |
| template_type | string | Yes | Template Type: utility (notification), marketing (marketing) |
| template_content | string | Yes | Template Content, cannot contain: 【, 】, ,, 测试, test, [, ] |
| country_codes | string | Yes | Main sending country codes, separated by commas |
| add_signature | bool | No | Whether to add a signature, default is false |
| sign_id | string | Conditionally Required | Required if add_signature is true, Signature ID |
| sign_position | int | Conditionally Required | Required if add_signature is true, Signature Position: 1-Prefix, 2-Suffix |
Response Example:
{
"template_id": "123456789"
}
Response Field Description:
| Field Name | Type | Description |
|---|---|---|
| template_id | string | Created Template ID |
Error Responses:
400: Parameter format error, parameter validation failed, signature configuration does not exist, signature status not approved500: Internal server error
Business Rules:
- Templates are in "Pending Review" status (status=1) after creation.
- If a signature is added, the signature must be in an approved status.
4. Update Template Configuration
Interface Description: Update an existing template configuration.
Request Information:
- Method:
PUT - Path:
/v1/template-configs/:templateId - Authentication: Required
Path Parameters:
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| templateId | string | Yes | Template ID |
Request Body: Same as the creation interface, all fields are required.
Response Example:
{
"code": 0,
"message": "success"
}
Error Responses:
400: Parameter format error, template does not exist, template in pending review status cannot be updated, plans in pending or running status cannot be updated, signature configuration does not exist, signature status not approved500: Internal server error
Business Rules:
- Templates in pending review status cannot be updated.
- If there are pending or running message plans using the template, it cannot be updated.
- After updating, the template status will revert to "Pending Review" (status=1).
5. Delete Template Configuration
Interface Description: Delete a specified template configuration.
Request Information:
- Method:
DELETE - Path:
/v1/template-configs/:templateId - Authentication: Required
Path Parameters:
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| templateId | string | Yes | Template ID |
Response Example:
{
"code": 0,
"message": "success"
}
Error Responses:
400: Template ID format error, template does not exist, plans in pending or running status cannot be deleted500: Internal server error
Business Rules:
- If there are pending or running message plans using the template, it cannot be deleted.
Signature Configuration Interface
1. Get Signature Configuration List
Interface Description: Retrieve the list of all signature configurations under the current business.
Request Information:
- Method:
GET - Path:
/v1/sign-configs - Authentication: Required
Request Parameters: None
Response Example:
[
{
"sign_id": "987654321",
"sign_name": "Company Name",
"status": 2,
"related_template_count": 5,
"audit_remark": "",
"created_time": 1699000000,
"updated_time": 1699000000
}
]
Response Field Description:
| Field Name | Type | Description |
|---|---|---|
| sign_id | string | Signature ID |
| sign_name | string | Signature Name |
| status | int | Status: 1-Pending Review, 2-Approved, 3-Rejected |
| related_template_count | int64 | Number of associated templates |
| audit_remark | string | Audit remarks |
| created_time | int64 | Creation time (Unix timestamp) |
| updated_time | int64 | Update time (Unix timestamp) |
2. Get Signature Configuration Details
Interface Description: Retrieve detailed information of a signature configuration by signature ID.
Request Information:
- Method:
GET - Path:
/v1/sign-configs/:signId - Authentication: Required
Path Parameters:
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| signId | string | Yes | Signature ID |
Response Example:
{
"sign_id": "987654321",
"sign_name": "Company Name",
"status": 2,
"related_template_count": 5,
"audit_remark": "",
"created_time": 1699000000,
"updated_time": 1699000000
}
Error Responses:
400: Invalid signature ID format, signature does not exist, or signature does not belong to the current business.500: Internal server error.
3. Create Signature Configuration
Interface Description: Create a new signature configuration.
Request Information:
- Method:
POST - Path:
/v1/sign-configs - Authentication: Required
Request Body:
{
"sign_name": "Company Name"
}
Request Field Description:
| Field Name | Type | Required | Description |
|---|---|---|---|
| sign_name | string | Yes | Signature name, 2-60 characters, cannot contain: 【, 】, [, ] |
Response Example:
{
"sign_id": "987654321"
}
Response Field Description:
| Field Name | Type | Description |
|---|---|---|
| sign_id | string | Created signature ID |
Error Responses:
400: Parameter format error, parameter validation failed, or signature name already exists.500: Internal server error.
Business Rules:
- The status of the signature after creation is "Pending Review" (status=1).
- Signature names cannot be duplicated within the same business.
4. Update Signature Configuration
Interface Description: Update an existing signature configuration.
Request Information:
- Method:
PUT - Path:
/v1/sign-configs/:signId - Authentication: Required
Path Parameters:
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| signId | string | Yes | Signature ID |
Request Body: Same as the create interface.
Response Example:
{
"code": 0,
"message": "success"
}
Error Responses:
400: Parameter format error, signature does not exist, signature does not belong to the current business, signature status is pending review and cannot be updated, signature name already exists, or there are pending or running plans that prevent updating.500: Internal server error.
Business Rules:
- Signatures in pending review status cannot be updated.
- If there are pending or running message plans using the signature, it cannot be updated.
- After updating, the signature status will revert to "Pending Review" (status=1).
5. Delete Signature Configuration
Interface Description: Delete a specified signature configuration.
Request Information:
- Method:
DELETE - Path:
/v1/sign-configs/:signId - Authentication: Required
Path Parameters:
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| signId | string | Yes | Signature ID |
Response Example:
{
"code": 0,
"message": "success"
}
Error Responses:
400: Invalid signature ID format, signature does not exist, signature does not belong to the current business, or there are pending or running plans that prevent deletion.500: Internal server error.
Business Rules:
- If there are pending or running message plans using the signature, it cannot be deleted.
Status Code Description
Template Configuration Status (status)
| Value | Description |
|---|---|
| 1 | Pending Review |
| 2 | Approved |
| 3 | Rejected |
Signature Configuration Status (status)
| Value | Description |
|---|---|
| 1 | Pending Review |
| 2 | Approved |
| 3 | Rejected |
Signature Position (sign_position)
| Value | Description |
|---|---|
| 0 | No Signature |
| 1 | Prefix |
| 2 | Suffix |
Template Type (template_type)
| Value | Description |
|---|---|
| utility | Notification |
| marketing | Marketing |
Error Code Description
| Error Code | HTTP Status Code | Description |
|---|---|---|
| 0 | 200 | Success |
| 400 | 400 | Parameter error or business logic error |
| 500 | 500 | Internal server error |
Common Error Messages:
invalid templateId: Invalid template ID format.template config not exist: Template configuration does not exist.invalid signId: Invalid signature ID format.sign config not exist: Signature configuration does not exist.sign_name already exist: Signature name already exists.can not update pending status template: Templates in pending review status cannot be updated.can not update pending status sign: Signatures in pending review status cannot be updated.there are pending or running plans using current template, can not update: There are pending or running plans using the template, cannot update.there are pending or running plans using current sign, can not update: There are pending or running plans using the signature, cannot update.sign status is not approved, can not use: Signature status is not approved, cannot be used.
Notes
- All interfaces require authentication middleware validation.
- All interfaces will automatically associate the authenticated user's business ID (businessId).
- The creation and update operations of templates and signatures will trigger the review process.
- If a template or signature is used by a message plan, it cannot be updated or deleted while the plan is in pending or running status.
- Template content cannot contain prohibited characters:
【,】,、,测试,test,[,]. - Signature names cannot contain prohibited characters:
【,】,[,]. - The IDs of templates and signatures are numeric strings.










