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: Perform Base64 encoding on
apikey:apisecret, then addAuthorization: Basic <encoded string>to the request header.
- Format:
- Content-Type:
application/json
Response Format
Successful Response
Successful responses directly return data objects or arrays:
{
"template_id": "123456789",
"template_name": "Example Template",
...
}
or list responses:
[
{
"template_id": "123456789",
"template_name": "Example Template",
...
}
]
Error Response
Error response format:
{
"code": 400,
"message": "Error message description"
}
Template Configuration Interface
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 about 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 when add_signature is true, Signature ID |
| sign_position | int | Conditionally required | Required when add_signature is true, Signature position: 1-Prefix, 2-Suffix |
Response Example:
{
"code": 0,
"message": "success"
}
Error Responses:
400: Parameter format error, parameter validation failure, signature configuration does not exist, signature status not approved500: Internal server error
Business Rules:
- The status of the template after creation is "Pending review" (status=1).
- 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 create interface, all fields are required.
Response Example:
{
"code": 0,
"message": "success"
}
Error Responses:
400: Parameter format error, template does not exist, template status is pending review and cannot be updated, there are pending or running plans that 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 the update, 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, there are pending or running plans that 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 API
1. Get Signature Configuration List
API 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 related templates |
| audit_remark | string | Audit Remark |
| created_time | int64 | Creation Time (Unix Timestamp) |
| updated_time | int64 | Update Time (Unix Timestamp) |
2. Get Signature Configuration Details
API 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
API 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 in length, cannot contain: 【, 】, [, ] |
Response Example:
{
"code": 0,
"message": "success"
}
Error Responses:
400: Parameter format error, parameter validation failed, or signature name already exists.500: Internal server error.
Business Rules:
- The status of a newly created signature is "Pending Review" (status=1).
- Signature names under the same business cannot be duplicated.
4. Update Signature Configuration
API 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 API.
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 cannot be updated.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
API 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 cannot be deleted.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 use.
Notes
- All APIs require authentication middleware validation.
- All APIs will automatically associate the authenticated user's business ID (businessId).
- Creation and update operations for 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:
【,】,[,]. - Template and signature IDs are numeric strings.









