API - Shipment

Created by KloudShip Support, Modified on Fri, 8 Mar, 2024 at 7:04 PM by KloudShip Support

POST: Create Shipment


This documentation outlines the usage of the "Create Shipment" endpoint for the Kloudship API. The endpoint allows you to create a new shipment by sending a POST request with the required payload. Below are the details of the request and the response for the API.


Endpoint

POST /{{BaseURL}}/Shipment


Request Headers

  • `transactionId` (string, required): A unique identifier for the transaction.
  • `Content-Type` (string, required): Set to `application/json`.
  • `Authorization` (string, required): Bearer token obtained through authentication.


Request Body

The payload must be a JSON object containing the following parameters:

  1. `addressFrom` (object, required): Information about the sender's address.
  2. `addressShipTo` (object, required): Information about the recipient's address.
  3. `packages` (array of objects, required): Array of package details.
  4. `locationId` (string, required): ID of the location.
  5. `carrierAccountId` (string, required): ID of the carrier account.
  6. `service` (string, required): Service type for the shipment.
  7. `label` (object, required): Label specifications.
  8. `items` (array of objects, required): Array of items in the shipment.
  9. `valueAmount` (number, required): Shipment value amount.


Example request payload

{
    "addressFrom": { ... },
    "addressShipTo": { ... },
    "packages": [ ... ],
    "locationId": "647da3c9d40010c2318c59a9",
    "carrierAccountId": "64cc9ac67a2876f1b3244142",
    "service": "Surface",
    "label": { ... },
    "items": [ ... ],
    "valueAmount": 12
}


Response Body

Upon a successful request, you will receive a JSON response containing details about the created shipment:

  1. `id` (string): Shipment ID.
  2. `addressFrom` (object): Sender's address details.
  3. `addressShipTo` (object): Recipient's address details.
  4. `packages` (array): Array of package details.
  5. `rate` (object): Rate details.
  6. `label` (object): Label information.
  7. `trackingNumber` (string): Tracking number for the shipment.
  8. `trackingUrl` (string): Tracking URL for the shipment.
  9. `status` (string): Shipment status.
  10. `shipDate` (string): Shipment date and time.
  11. `errors` (array): Array of errors, if any.
  12. `createdDate` (string): Date and time of shipment creation.
  13. `transactionId` (string): Transaction ID.


Example response

{
    "id": "64ddfc982e3464d34bfc984c",
    "addressFrom": { ... },
    "addressShipTo": { ... },
    "packages": [ ... ],
    "rate": { ... },
    "label": { ... },
    "trackingNumber": "5871310010275",
    "trackingUrl": "https://www.delhivery.com/track/package/5871310010275",
    "status": "PreTransit",
    "shipDate": "2023-08-17T10:55:18.0025728Z",
    "errors": [],
    "createdDate": "2023-08-17T10:55:22.8163562Z",
    "transactionId": "ad2248e7-6d20-40e9-a608-91f2a8f97e24"
}



GET: Shipment


The Kloudship API endpoint for retrieving shipment information allows you to fetch detailed information about a specific shipment using its unique ID. The response provides comprehensive details about the shipment, including addresses, packages, rates, labels, and more. Use the provided request example and response format to integrate this API into your application for seamless shipment tracking and management.


Endpoint 

GET /{{BaseURL}}/Shipment/{shipment_id}


Example Response

{
    "id": "64ba579b691f3561551578d8",
    "addressFrom": { ... },  # Sender address details
    "addressShipTo": { ... },  # Recipient address details
    "addressBillTo": { ... },  # Billing address details
    "packages": [ ... ],  # Package information
    "rate": { ... },  # Shipping rate details
    "label": { ... },  # Label information
    "forms": [],  # Forms associated with the shipment
    "status": "PreTransit",  # Shipment status
    "refundStatus": "Refunded",  # Refund status
    "shipDate": "2023-07-21T10:02:00.91Z",  # Shipment date
    "errors": [],  # Any errors associated with the shipment
    "createdDate": "2023-07-21T10:02:05.238Z"  # Shipment creation date
}

Response Description

  1. `id`: Unique identifier of the shipment.
  2. `addressFrom`: Sender's address information.
  3. `addressShipTo`: Recipient's address information.
  4. `addressBillTo`: Billing address information.
  5. `packages`: Array of package details in the shipment.
  6. `rate`: Shipping rate and carrier details.
  7. `label`: Label information for the shipment.
  8. `forms`: Forms associated with the shipment.
  9. `status`: Current status of the shipment.
  10. `refundStatus`: Refund status of the shipment.
  11. `shipDate`: Shipment date and time.
  12. `errors`: Any errors associated with the shipment.
  13. `createdDate`: Date and time when the shipment was created.



PUT: Refund Shipment


The PUT Refund Shipment API allows you to initiate a refund for a specific shipment. This API is used to cancel a shipment and initiate the refund process. It requires the shipment ID and cancellation reason as input parameters.


Request

{
     "CancelationReason": "{cancellationReason}"
}


Request Headers

  • `transactionId` (required): A unique identifier for the API request.
  • `Content-Type` (required): Set to `application/json`.
  • `Authorization` (required): A bearer token for authentication.


Request Body

- `CancelationReason` (required): A string indicating the reason for canceling the shipment.


Response

{
    "id": "{shipmentId}",
    "addressFrom": {
        // Details of the sender's address
    },
    "addressShipTo": {
        // Details of the recipient's address
    },
    "addressBillTo": {
        // Details of the billing address
    },
    "rate": {
        // Shipping rate and fee details
    },
    "label": {
        // Label information
    },
    "forms": [],
    "status": "PreTransit",
    "refundStatus": "Refunded",
    "shipDate": "2023-08-17T10:55:18.002Z",
    "errors": [],
    "createdDate": "2023-08-17T10:55:22.816Z",
    "transactionId": "{transactionId}"
}


Response Fields

  1. `id`: The ID of the refunded shipment.
  2. `addressFrom`: Details of the sender's address.
  3. `addressShipTo`: Details of the recipient's address.
  4. `addressBillTo`: Details of the billing address.
  5. `rate`: Shipping rate and fee details.
  6. `label`: Label information including label URLs.
  7. `forms`: Array of forms associated with the shipment (if applicable).
  8. `status`: Current status of the shipment (e.g., "PreTransit").
  9. `refundStatus`: Refund status indicating whether the refund process was successful ("Refunded").
  10. `shipDate`: Date and time of shipment.
  11. `errors`: Array of error messages (if any).
  12. `createdDate`: Date and time when the shipment was created.
  13. `transactionId`: Unique identifier for the API transaction.



PUT: Shipment Tracking


The Shipment Tracking API allows you to retrieve tracking information for a specific shipment using its unique identifier. This API provides details about the current status, carrier information, tracking numbers, and other relevant information related to the shipment.


Endpoint

GET {{BaseUrl}}/Tracking/{shipment_Id}


Response

Upon a successful request, the API will respond with the tracking information for the specified shipment in the following JSON format:


{
    "id": "64ddfc9a2e3464d34bfc984d",
    "shipmentId": "64ddfc982e3464d34bfc984c",
    "carrierAccountName": "Delhivery",
    "carrier": "Delhivery",
    "trackingBarcodeNumber": "5871310010275",
    "trackingNumber": "5871310010275",
    "status": "Cancelled",
    "subStatus": "LabelGenerated",
    "trackingUrl": "https://www.delhivery.com/track/package/5871310010275",
    "trackingDetails": [],
    "errors": []
}


Response Fields

  1. `id`: The unique identifier for the tracking information.
  2. `shipmentId`: The unique identifier of the shipment being tracked.
  3. `carrierAccountName`: The name of the carrier account associated with the shipment.
  4. `carrier`: The name of the carrier responsible for shipping.
  5. `trackingBarcodeNumber`: The barcode number associated with the shipment's tracking.
  6. `trackingNumber`: The tracking number assigned to the shipment.
  7. `status`: The current status of the shipment (e.g., "Cancelled", "In Transit", etc.).
  8. `subStatus`: Additional status information or sub-status (e.g., "LabelGenerated").
  9. `trackingUrl`: URL to the carrier's tracking page for the shipment.
  10. `trackingDetails`: An array of tracking details (if available).
  11. `errors`: An array of errors (if any).

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article