Outbound Attachments
Manage outbound attachments: list, upload, update, delete, plus batch update and batch delete. Attachments are part of the generic warehouse outbound SOP: the partner uploads them in the portal and the warehouse prints them in ERP before marking stock ready.
All attachment endpoints authenticate with request-token and require the outbound_attachment_upload capability (the middleware matches the api/v1/outbound/attachment/ prefix, so listing and deleting require it too).
List Attachments
/channel/api/v1/outbound/attachment/listAuth: request-token (channel_partner)
List the active attachments of an outbound request. Only attachments of the current partner's request are returned. print_types is decoded into an array and the latest print job status is attached.
Required capability: outbound_attachment_upload
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
request_id | integer | yes | Outbound request ID (alias id accepted) |
Response
{
"code": 200,
"msg": "success",
"data": [
{
"id": 9001,
"outbound_id": 5001,
"scope_type": "outbound",
"scope_id": 5001,
"document_code": "packing_list",
"paper_type": "A4",
"paper_width_mm": 210,
"paper_height_mm": 297,
"name": "packing-list.pdf",
"file_url": "https://cdn.example.com/e2c/tmp/packing-list.pdf",
"file_type": "pdf",
"file_size": 204800,
"print_enabled": 1,
"print_copies": 2,
"print_scale": "portrait",
"print_types": ["print"],
"uploaded_by_type": "partner",
"uploaded_by_id": 42,
"sort_order": 0,
"status": 1,
"latest_print_status": "pending",
"created_at": "2026-11-11 10:10:00",
"updated_at": "2026-11-11 10:10:00"
}
]
}Error Codes
| code | Meaning |
|---|---|
| 909 | Unauthenticated, invalid token, or not a channel partner |
| 606 | Insufficient capability (outbound_attachment_upload required) |
| 400 | Missing request_id |
| 404 | Outbound request not found or not owned by this partner |
| 500 | Failed to load attachments |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/outbound/attachment/list' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"request_id": 1001
}'Upload Attachment
/channel/api/v1/outbound/attachment/uploadAuth: request-token (channel_partner)
Upload a PDF / JPG / JPEG / PNG attachment, max 10MB. Only draft / pending / pending_approval / approved allow upload; warehouse_confirmed onward, as well as rejected / cancelled, are not operable.
Required capability: outbound_attachment_upload
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
request_id | integer | yes | Outbound request ID |
scope_type | string | no | outbound / package / product; default outbound |
scope_id | integer | no | Package ID or outbound item ID; required for package / product and must belong to the outbound order |
name | string | yes | File name; the extension determines the file type |
file_url | string | yes* | Already-uploaded file URL |
base64 | string | yes* | Base64 payload; a data:*;base64, prefix is accepted |
file_size | integer | no | File size in bytes; the decoded size is used for base64 |
document_code | string | no | Document type, default other; values longer than 32 characters are silently truncated to 32 |
paper_type | string | no | Paper type, default A4; values longer than 32 characters are silently truncated to 32 |
paper_width_mm | number | no | Paper width (mm), default 0; clamped to 0–2000 |
paper_height_mm | number | no | Paper height (mm), default 0; clamped to 0–2000 |
print_enabled | boolean | no | Join the print queue, default false |
print_copies | integer | no | Print copies, default 1 |
print_scale | string | no | portrait / landscape, default portrait |
print_types | string[] | no | print, e_sign, return_required; default [] |
sort_order | integer | no | Sort value, default 0 |
* Provide exactly one of file_url or base64.
Response
Returns the created attachment row. Note that print_types is still a JSON string in the upload response; the list endpoint decodes it into an array.
{
"code": 200,
"msg": "success",
"data": {
"id": 9001,
"outbound_id": 5001,
"scope_type": "outbound",
"scope_id": 5001,
"document_code": "packing_list",
"paper_type": "A4",
"paper_width_mm": 210,
"paper_height_mm": 297,
"name": "packing-list.pdf",
"file_url": "https://cdn.example.com/e2c/tmp/packing-list.pdf",
"file_type": "pdf",
"file_size": 204800,
"print_enabled": 1,
"print_copies": 2,
"print_scale": "portrait",
"print_types": "[\"print\"]",
"uploaded_by_type": "partner",
"uploaded_by_id": 42,
"sort_order": 0,
"status": 1,
"created_at": "2026-11-11 10:10:00",
"updated_at": "2026-11-11 10:10:00"
}
}Error Codes
| code | Meaning |
|---|---|
| 909 | Unauthenticated, invalid token, or not a channel partner |
| 606 | Insufficient capability (outbound_attachment_upload required) |
| 400 | Locked status (warehouse_confirmed onward), missing name, disallowed extension, neither file_url nor base64, invalid Base64, over 10MB, invalid scope_type, missing or foreign scope_id |
| 500 | File upload or persistence failed |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/outbound/attachment/upload' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"request_id": 1001,
"scope_type": "outbound",
"name": "packing-list.pdf",
"base64": "JVBERi0xLjQK...",
"document_code": "packing_list",
"paper_type": "A4",
"print_enabled": true,
"print_copies": 2,
"print_scale": "portrait",
"print_types": [
"print"
]
}'Update Attachment
/channel/api/v1/outbound/attachment/updateAuth: request-token (channel_partner)
Update print parameters and paper metadata only; the file cannot be replaced. A partner may update only attachments it uploaded. Only draft / pending / pending_approval / approved allow update; warehouse_confirmed onward, as well as rejected / cancelled, are not operable.
Required capability: outbound_attachment_upload
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
request_id | integer | yes | Outbound request ID |
attachment_id | integer | yes | Attachment ID (alias id accepted) |
document_code | string | no | Document type; values longer than 32 characters are silently truncated to 32 |
paper_type | string | no | Paper type; values longer than 32 characters are silently truncated to 32 |
paper_width_mm | number | no | Paper width (mm); clamped to 0–2000 |
paper_height_mm | number | no | Paper height (mm); clamped to 0–2000 |
print_enabled | boolean | no | Join the print queue |
print_copies | integer | no | Print copies, 1–99 |
print_scale | string | no | portrait / landscape |
print_types | string[] | no | print, e_sign, return_required |
When no updatable field is provided, the current attachment is returned without error.
Response
Returns the updated attachment row; print_types is a JSON string.
{
"code": 200,
"msg": "success",
"data": {
"id": 9001,
"outbound_id": 5001,
"scope_type": "outbound",
"scope_id": 5001,
"document_code": "packing_list",
"paper_type": "A4",
"paper_width_mm": 210,
"paper_height_mm": 297,
"name": "packing-list.pdf",
"file_url": "https://cdn.example.com/e2c/tmp/packing-list.pdf",
"file_type": "pdf",
"file_size": 204800,
"print_enabled": 1,
"print_copies": 3,
"print_scale": "portrait",
"print_types": "[\"print\",\"e_sign\"]",
"uploaded_by_type": "partner",
"uploaded_by_id": 42,
"sort_order": 0,
"status": 1,
"created_at": "2026-11-11 10:10:00",
"updated_at": "2026-11-11 10:20:00"
}
}Error Codes
| code | Meaning |
|---|---|
| 909 | Unauthenticated, invalid token, or not a channel partner |
| 606 | Insufficient capability (outbound_attachment_upload required) |
| 400 | Locked status, or attempting to modify an attachment uploaded by another party |
| 404 | Attachment not found or not part of this outbound order |
| 500 | Update failed |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/outbound/attachment/update' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"request_id": 1001,
"attachment_id": 9001,
"print_enabled": true,
"print_copies": 3,
"print_types": [
"print",
"e_sign"
]
}'Delete Attachment
/channel/api/v1/outbound/attachment/deleteAuth: request-token (channel_partner)
Soft-delete a partner-uploaded attachment (status set to 0). This endpoint does not check the outbound order status; a partner may delete only attachments it uploaded.
Required capability: outbound_attachment_upload
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
request_id | integer | yes | Outbound request ID |
attachment_id | integer | yes | Attachment ID (alias id accepted) |
Response
{
"code": 200,
"msg": "success",
"data": null
}Error Codes
| code | Meaning |
|---|---|
| 909 | Unauthenticated, invalid token, or not a channel partner |
| 606 | Insufficient capability (outbound_attachment_upload required) |
| 400 | Attempting to delete an attachment uploaded by another party |
| 404 | Attachment not found or not part of this outbound order |
| 500 | Delete failed |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/outbound/attachment/delete' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"request_id": 1001,
"attachment_id": 9001
}'Batch Update Attachments
/channel/api/v1/outbound/attachment/batch-updateAuth: request-token (channel_partner)
Update print parameters for multiple attachments. The allowed status window is draft / pending / pending_approval / approved / warehouse_confirmed; rejected / cancelled are not operable. Only the partner's own attachments are updated; other rows are skipped.
Required capability: outbound_attachment_upload
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
request_id | integer | yes | Outbound request ID |
attachment_ids | integer[] | yes | Attachment IDs; must not be empty |
document_code | string | no | Document type; values longer than 32 characters are silently truncated to 32 |
paper_type | string | no | Paper type; values longer than 32 characters are silently truncated to 32 |
paper_width_mm | number | no | Paper width (mm); clamped to 0–2000 |
paper_height_mm | number | no | Paper height (mm); clamped to 0–2000 |
print_enabled | boolean | no | Join the print queue |
print_copies | integer | no | Print copies, 1–99 |
print_scale | string | no | portrait / landscape |
print_types | string[] | no | print, e_sign, return_required |
Response
{
"code": 200,
"msg": "success",
"data": {
"updated": 2
}
}updated is the number of attachments actually updated; IDs not owned by this partner or not part of this outbound order are not counted.
Error Codes
| code | Meaning |
|---|---|
| 909 | Unauthenticated, invalid token, or not a channel partner |
| 606 | Insufficient capability (outbound_attachment_upload required) |
| 400 | Missing request_id or attachment_ids, or locked status |
| 404 | Outbound request not found or not owned by this partner |
| 500 | Batch update failed |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/outbound/attachment/batch-update' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"request_id": 1001,
"attachment_ids": [
9001,
9002
],
"print_enabled": true,
"print_copies": 1,
"print_types": [
"print"
]
}'Batch Delete Attachments
/channel/api/v1/outbound/attachment/batch-deleteAuth: request-token (channel_partner)
Soft-delete multiple partner-uploaded attachments. This endpoint does not check the outbound order status; attachments not owned by this partner or no longer present are skipped.
Required capability: outbound_attachment_upload
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
request_id | integer | yes | Outbound request ID |
attachment_ids | integer[] | yes | Attachment IDs; must not be empty |
Response
{
"code": 200,
"msg": "success",
"data": {
"deleted": 2
}
}deleted is the number of attachments actually deleted; unauthorized or missing rows are silently skipped.
This endpoint only catches the final exception, so a request_id that does not exist or is not owned by this partner returns 500 (not 404).
Error Codes
| code | Meaning |
|---|---|
| 909 | Unauthenticated, invalid token, or not a channel partner |
| 606 | Insufficient capability (outbound_attachment_upload required) |
| 400 | Missing request_id or attachment_ids |
| 500 | Batch delete failed |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/outbound/attachment/batch-delete' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"request_id": 1001,
"attachment_ids": [
9001,
9002
]
}'