Route
You can use the API to query, add, modify, and delete receiving routes. The route you configured needs to be recorded through MX configuration first. We can forward reply message to the mailbox you specify or push the message to the specified URL.
Query( batch)
URL
https://email.api.engagelab.cc/v1/routes
HTTP Request Method
GET
Header
Header | Type | Required | Description |
---|---|---|---|
Authorization | String | true | Basic base64(api_user:api_key) |
Parameter Description
parameter | type | required or not | description |
---|---|---|---|
offset | int | no | offset position, [0-], defaults to 0 |
limit | int | no | amount, [0-100],defaults to 100 |
Request Example
curl "https://email.api.engagelab.cc/v1/routes?offset=0&limit=200" --header "Authorization: Basic <<YOUR_API_KEY_HERE>>"
Returned Value Description
parameter | description |
---|---|
route_id | route ID |
expression | receiving route |
action | URL/Email |
api_user_route | When the action is set to "Email" this parameter is required. |
Returned Value Example:
Response-success HTTP Status: 200
{
"result": [
{
"route_id": 1,
"expression":"xjmfc",
"action":"test@engagelab.com"
"create_time": "2022-11-14T14:27:48+0800",
"update_time": "2022-11-14T14:27:48+0800",
"api_user_route":"test"
}
],
"total": 1,
"count": 1
}
Query
URL
https://email.api.engagelab.cc/v1/routes/{route_id}
HTTP Request Method
GET
Header
Header | Type | Required | Description |
---|---|---|---|
Authorization | String | true | Basic base64(api_user:api_key) |
Request Example
curl -X GET "https://email.api.engagelab.cc/v1/routes/112"
--header "Authorization: Basic <<YOUR_API_KEY_HERE>>"
--header "Content-Type: application/json"
Returned Value Description
parameter | description |
---|---|
route_id | route ID |
expression | receiving route |
action | URL/Email |
api_user_route | When the action is set to "Email" this parameter is required. |
Returned Value Example:
Response-success
HTTP Status: 200
{
"result": {
"route_id": 1,
"expression":"xjmfc",
"action":"test@engagelab.com",
"api_user_route": "sctest",
"create_time": "2022-11-14T14:27:48+0800",
"update_time": "2022-11-14T14:27:48+0800"
}
}
Add
A user can add up to 1000 receiving routes.
URL
https://email.api.engagelab.cc/v1/routes
HTTP Request Method
POST
Header
Header | Type | Required | Description |
---|---|---|---|
Authorization | String | true | Basic base64(api_user:api_key) |
Parameter Description
parameter | type | required or not | description |
---|---|---|---|
expression | string | yes | receiving route. Format is 'regular expression@domain'; it can also be a specific email address. The domain/email domain must be a verified or usable sending domain. |
action | string | yes | URL/Email |
api_user_route | string | * | When the action is set to "Email" this parameter is required. When forwarding to an email, this API-USER will be used for forwarding and sending. |
Request Example
curl -X POST "https://email.api.engagelab.cc/v1/routes"
--header "Authorization: Basic <<YOUR_API_KEY_HERE>>"
--header "Content-Type: application/json"
--data '{
"expression":"hongkong@aizl.net",
"action":"test@engagelab.com"
}'
Returned Value Description
parameter | description |
---|---|
route_id | route ID |
expression | receiving route |
action | URL /Email |
api_user_route | When the action is set to "Email" this parameter is required. |
Returned Value Example:
{
"result": {
"route_id": 598802,
"expression":".*@123.com",
"action":"test@engagelab.com"
"api_user_route":"test233"
"create_time": "2022-11-14T14:27:34+0800",
"update_time": "2022-11-14T14:27:34+0800"
}
}
Modify
URL
https://email.api.engagelab.cc/v1/routes/{route_id}
HTTP Request Method
PUT
Header
Header | Type | Required | Description |
---|---|---|---|
Authorization | String | true | Basic base64(api_user:api_key) |
Parameter Description
parameter | type | required or not | description |
---|---|---|---|
expression | string | * | receiving route |
action | string | * | URL/ Email |
api_user_route | string | * | When the action is set to "Email" this parameter is required. |
Request Example
curl -X PUT "https://email.api.engagelab.cc/v1/routes/12333"
--header "Authorization: Basic <<YOUR_API_KEY_HERE>>"
--header "Content-Type: application/json"
--data '{
"expression":"travel",
"action":"test@engagelab.com"
}'
Returned Value Description
parameter | description |
---|---|
count | count of modified receiving route |
Returned Value Example:
Response-success
HTTP Status: 200
{
"count": 1
}
Response-error
HTTP Status :401
{
"code": 30000,
"message": "Authentication failed."
}
Delete
URL
https://email.api.engagelab.cc/v1/routes/{route_id}
HTTP Request Method
DELETE
Header
Header | Type | Required | Description |
---|---|---|---|
Authorization | String | true | Basic base64(api_user:api_key) |
Request Example
curl -X DELETE "https://email.api.engagelab.cc/v1/routes/21122"
--header "Authorization: Basic <<YOUR_API_KEY_HERE>>"
Returned Value Description
parameter | description |
---|---|
count | count of deleted receiving route |
Returned Value Example:
{
"count": 1
}