cargopanel logocargopanel for developers

Upload File

POSThttps://api.cargopanel.co/v1/files/upload
POSThttps://sandbox-api.cargopanel.co/v1/files/upload

Uploads files (Invoice, MSDS, FDA forms, etc.) associated with shipments. This endpoint requires requests formatted as multipart/form-data. The file is always saved under the user of the API token; a userId sent in the body is ignored. The returned fileName is signed and cannot be guessed, so store the url or fileName from the response to access the file later.

Request Fields

filerequiredFile

The binary file content to upload.

documentTyperequiredstring

The classification of the document (e.g., invoice, packing_list, label, identity).

shipmentIdrequiredstring

The shipment identifier associated with the document.

Example Response

200
{
  "status": "success",
  "message": "Dosya başarıyla yüklendi ve kaydedildi.",
  "file": {
    "originalName": "invoice.pdf",
    "fileName": "48213907Xk3fP9qLmZ2vQa",
    "url": "https://api.cargopanel.co/v1/files/48213907Xk3fP9qLmZ2vQa",
    "path": "/files/48213907Xk3fP9qLmZ2vQa",
    "id": "48213907",
    "userId": "usr_xyz789",
    "shipmentId": "12345678",
    "documentType": "E-Arşiv Fatura"
  },
  "fileUrl": "https://api.cargopanel.co/v1/files/48213907Xk3fP9qLmZ2vQa",
  "fileId": "48213907"
}

Response Fields

statusstring

Status label indicating success or failure.

messagestring

User friendly status message.

fileobject

The uploaded file's metadata record.

idstring

Unique numeric identifier of the file.

fileNamestring

Signed, non-guessable file name. Use it with GET /files/:filename to download the file.

urlstring

Public gateway proxy API URL to view or download the file.

Responses

200File uploaded and saved successfully
400Bad request (e.g. missing file or parameters)
401Unauthorized (invalid or missing API key)