Skip to content

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 ​

POST/channel/api/v1/outbound/attachment/list

Auth: 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 ​

FieldTypeRequiredDescription
request_idintegeryesOutbound request ID (alias id accepted)

Response ​

json
{
  "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 ​

codeMeaning
909Unauthenticated, invalid token, or not a channel partner
606Insufficient capability (outbound_attachment_upload required)
400Missing request_id
404Outbound request not found or not owned by this partner
500Failed to load attachments

cURL ​

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 ​

POST/channel/api/v1/outbound/attachment/upload

Auth: 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 ​

FieldTypeRequiredDescription
request_idintegeryesOutbound request ID
scope_typestringnooutbound / package / product; default outbound
scope_idintegernoPackage ID or outbound item ID; required for package / product and must belong to the outbound order
namestringyesFile name; the extension determines the file type
file_urlstringyes*Already-uploaded file URL
base64stringyes*Base64 payload; a data:*;base64, prefix is accepted
file_sizeintegernoFile size in bytes; the decoded size is used for base64
document_codestringnoDocument type, default other; values longer than 32 characters are silently truncated to 32
paper_typestringnoPaper type, default A4; values longer than 32 characters are silently truncated to 32
paper_width_mmnumbernoPaper width (mm), default 0; clamped to 0–2000
paper_height_mmnumbernoPaper height (mm), default 0; clamped to 0–2000
print_enabledbooleannoJoin the print queue, default false
print_copiesintegernoPrint copies, default 1
print_scalestringnoportrait / landscape, default portrait
print_typesstring[]noprint, e_sign, return_required; default []
sort_orderintegernoSort 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.

json
{
  "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 ​

codeMeaning
909Unauthenticated, invalid token, or not a channel partner
606Insufficient capability (outbound_attachment_upload required)
400Locked 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
500File upload or persistence failed

cURL ​

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 ​

POST/channel/api/v1/outbound/attachment/update

Auth: 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 ​

FieldTypeRequiredDescription
request_idintegeryesOutbound request ID
attachment_idintegeryesAttachment ID (alias id accepted)
document_codestringnoDocument type; values longer than 32 characters are silently truncated to 32
paper_typestringnoPaper type; values longer than 32 characters are silently truncated to 32
paper_width_mmnumbernoPaper width (mm); clamped to 0–2000
paper_height_mmnumbernoPaper height (mm); clamped to 0–2000
print_enabledbooleannoJoin the print queue
print_copiesintegernoPrint copies, 1–99
print_scalestringnoportrait / landscape
print_typesstring[]noprint, 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.

json
{
  "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 ​

codeMeaning
909Unauthenticated, invalid token, or not a channel partner
606Insufficient capability (outbound_attachment_upload required)
400Locked status, or attempting to modify an attachment uploaded by another party
404Attachment not found or not part of this outbound order
500Update failed

cURL ​

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 ​

POST/channel/api/v1/outbound/attachment/delete

Auth: 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 ​

FieldTypeRequiredDescription
request_idintegeryesOutbound request ID
attachment_idintegeryesAttachment ID (alias id accepted)

Response ​

json
{
  "code": 200,
  "msg": "success",
  "data": null
}

Error Codes ​

codeMeaning
909Unauthenticated, invalid token, or not a channel partner
606Insufficient capability (outbound_attachment_upload required)
400Attempting to delete an attachment uploaded by another party
404Attachment not found or not part of this outbound order
500Delete failed

cURL ​

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 ​

POST/channel/api/v1/outbound/attachment/batch-update

Auth: 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 ​

FieldTypeRequiredDescription
request_idintegeryesOutbound request ID
attachment_idsinteger[]yesAttachment IDs; must not be empty
document_codestringnoDocument type; values longer than 32 characters are silently truncated to 32
paper_typestringnoPaper type; values longer than 32 characters are silently truncated to 32
paper_width_mmnumbernoPaper width (mm); clamped to 0–2000
paper_height_mmnumbernoPaper height (mm); clamped to 0–2000
print_enabledbooleannoJoin the print queue
print_copiesintegernoPrint copies, 1–99
print_scalestringnoportrait / landscape
print_typesstring[]noprint, e_sign, return_required

Response ​

json
{
  "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 ​

codeMeaning
909Unauthenticated, invalid token, or not a channel partner
606Insufficient capability (outbound_attachment_upload required)
400Missing request_id or attachment_ids, or locked status
404Outbound request not found or not owned by this partner
500Batch update failed

cURL ​

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 ​

POST/channel/api/v1/outbound/attachment/batch-delete

Auth: 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 ​

FieldTypeRequiredDescription
request_idintegeryesOutbound request ID
attachment_idsinteger[]yesAttachment IDs; must not be empty

Response ​

json
{
  "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 ​

codeMeaning
909Unauthenticated, invalid token, or not a channel partner
606Insufficient capability (outbound_attachment_upload required)
400Missing request_id or attachment_ids
500Batch delete failed

cURL ​

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
  ]
}'