Path: [POST] /api/v1/shipping/create

Description: Creates a shipment with provided origin, destination, weight, service, and recipient details. Requires Bearer token authentication.

Authentication:

Request Body:

Parameter Type Required Description
origin String Required The origin address for the shipment.
destination String Required The destination address for the shipment.
weight Number Required The weight of the package in kilograms.
service String Required The shipping service selected (e.g., Standard, Express).
recipient Object Required Details about the recipient.
— name String Required Recipient's name.
— phone String Required Recipient's phone number.
— email String Required Recipient's email address.

Example Request:

curl --location 'localhost/api/v1/shipping/create' \\
--header 'Content-Type: application/json' \\
--header 'Authorization: Bearer your_token_here' \\
--data-raw '{
    "origin": "Jakarta",
    "destination": "Bandung",
    "weight": 2.5,
    "service": "instant",
    "recipient": {
        "name": "John Doe",
        "phone": "0809899999",
        "email": "[email protected]"
    }
}'

Response Parameters:

Name Type Demo Value Description
status String success Response status indicating success.
shipment_id String SH123456 Unique identifier for the shipment.
tracking_number String TRACK123456 Tracking number for the shipment.
message String Shipment created successfully. Confirmation message.

Success Response Example:

{
    "status": "success",
    "shipment_id": "SH123456",
    "tracking_number": "TRACK123456",
    "message": "Shipment created successfully."
}

Missing Required Fields:

{
    "status": "error",
    "message": "Missing required fields in the request body."
}