# Import Shipment

## Import Shipment

<mark style="color:green;">`POST`</mark> `https://api-sandbox.shiplemon.com/v1/shipments/import`

#### Request Body

| Name                                            | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ----------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| related\_order\_id                              | string | <p>You can use this to store your internal reference id. </p><p>For example the related order to be matched for this shipment from the ecommerce platform</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| cash\_on\_delivery                              | number | <p><strong>Cash on Delivery (Αντικαταβολή) will be allowed only if you have provided your own credentials when using the rated carrier</strong></p><p></p><p>The amount for cash on delivery. If shipment does not use cash on delivery, set null</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| driver                                          | string | <p>This string is an optional string that you have to provide and indicates the carrier of the shipment<br></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| items<mark style="color:red;">\*</mark>         | array  | <p>This is an array that describes more details about the items that will be sent in the shipment and that you want to get rates for.<br><br>Each item in this array is an object in the following format (all the dimensions are in <em><strong>cm</strong></em> and the weight in <em><strong>grams</strong></em>)<br><br>The <strong>value</strong> and <strong>currency</strong> fields are optional<br><br><code>{</code></p><p>  <code>"weight":1000,</code></p><p>  <code>"height":20,</code></p><p>  <code>"width":20,</code></p><p>  <code>"length":20,</code></p><p>  <code>"notes":"nike air max",</code></p><p>  <code>"value":20,</code></p><p>  <code>"currency": "EUR",</code></p><p>  <code>"compartment\_size": 1</code><br><code>}</code></p>                                                                                                                                                                                                                                                                                             |
| address\_from<mark style="color:red;">\*</mark> | object | <p>This object describes where the pickup of the item will happen. This is the starting point (point A) of the shipment.<br><br><code>company</code>, <code>address2</code>, <code>notes</code> and <code>zip</code> are optional and can accept <strong>null</strong><br><br>This object looks like this:<br><br><code>{</code></p><p>  <code>"loacation\_id": "123",</code></p><p>  <code>"country":"GR",</code></p><p>  <code>"zip":"14451",</code></p><p>  <code>"name": "Kostas Papadopoulos",</code></p><p>  <code>"company": "Papadopoulou IKE",</code></p><p>  <code>"address": "Papadopoulou 23",</code></p><p>  <code>"address2": "Floor 2",</code></p><p>  <code>"city": "Athens",</code></p><p>  <code>"phone": "+306900000000",</code></p><p>  <code>"email":"<example@email.com>",</code></p><p>  <code>"country": "GR",</code></p><p>  <code>"notes": "call me"</code>            <br><code>}</code><br><br>In the country parameter we accept the ALPHA-2 code format. You can find more here:<br><https://www.iban.com/country-codes>)</p> |
| address\_to<mark style="color:red;">\*</mark>   | object | The same format as the address\_from in order to define the destination of the shipment (point B)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| incoming\_order\_id                             | string | Use this parameter to link this shipment as a child of an incoming order                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| tracking\_ref                                   | string | This is the tracking reference provided from the carrier                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| tracking\_url                                   | string | The tracking URL for the shipment                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| label\_url                                      | string | The URL for the shipment label                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| extras                                          | object | See request example for object properties                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## Example data for request

* *extras*:
  * *insurance\_amount*: the declared amount for the package to be insured
  * *is\_saturday\_delivery*: if the delivery is about to happen on Saturday (if the carrier support it)
  * *is\_customs\_invoice\_document*: boolean flag that indicates if the upload PDF is invoice document to be used for customs&#x20;

```
{
    "address_from":{
        "location_id":"12345",
        "country":"GR",
        "company":"",
        "name":"John Doe",
        "phone":"+306912345678",
        "email":"john@mail.com",
        "address":"Jane Street 1",
        "state":"I",
        "city":"Athens",
        "zip":"11111",
    },
    "address_to":{
        "location_id":"67890",
        "country":"GR",
        "country_code":"GR",
        "dial_code":"+30",
        "name":"Mary Doe",
        "zip":"11111",
        "city":"Athns",
        "address":"Jane Street 2",
        "phone":"+306912345678"
    },
    "items":[{
        "width":1,
        "height":1,
        "length":1,
        "weight":5000,
        "label":"Box",
        "notes":"Box",
        "invoice_lines":[],
        "compartment_size": 1,
    }],
    "rate_id": "boxnow_next-day_40b892de-02ea-47f7-85d9-f9dccef1144f",
    "cash_on_delivery":null,
    "related_order_id":null,
    "extras": {
        "insurance_amount": 100,
        "is_customs_invoice_document": false,
        "is_saturday_delivery": true
    }
}
```

#### Scheduling a pickup

You can also add the following if you want to schedule courier to PICKUP from address\_from, otherwise set it to `null` or don't provide this property in the JSON completely.\
\
Important! you can set pickup only for rates that support it `"has_pickup": true`

```
    "pickup": {
      "date": "YYYY-MM-DD"
    }
```

## Request

Example request body

{% tabs %}
{% tab title="cURL" %}

```erlang
curl -x POST https://api-sandbox.shiplemon.com/v1/shipments/  \
    -H "x-api-key: <YOUR_API_KEY>" \
    -H "Content-Type: application/json"  \
    -d '{
       "address_from": { 
            "location_id": "12345",
            "country":"GR", 
            "zip":"14451",
            "name": "Kostas Papadopoulos", 
            "company": "Papadopoulou IKE", 
            "address": "Papadopoulou 23",
            "address2": "Floor 2"
            "city": "Athens",
            "phone": "+306900000000",
            "email": "example@gmail.com"
            "country": "GR",
            "notes": "call me"            
        },
        "address_to": {
            "location_id": "67890",
            "name": "SG2",
            "country": "GR",
            "state": "I",
            "city": "Athens",
            "zip": "14451",
            "address": "Kolokotroni 2",
            "email": "example2@gmail.com",
            "phone": "+306900000000"
        },
        "items": [
            {
                "weight": 2000,
                "height": 10,
                "width": 10,
                "length": 10,
                "notes": "Clothes",
                "compartment_size": 1,
                "invoice_lines":[
                  {
                     "country_of_origin": "GR",
                     "description": "glasses-RETURN TO ORIGIN",
                     "commodity_code": "9004.90.10",
                     "quantity": "1",
                     "value": 10,
                     "weight": 500
                   }
                ],
            }
        ],
        "rate_id": "boxnow_next-day_40b892de-02ea-47f7-85d9-f9dccef1144f",
        "cash_on_delivery":10,
        "related_order_id":"23",
        "extras": {
            "insurance_amount": 100,
            "is_customs_invoice_document": false,
            "is_saturday_delivery": false
        }
    }'

```

{% endtab %}
{% endtabs %}

## Response

Returns the created shipment

```
{
  "invoice_id": null,
  "partner_credentials_used": true,
  "related_order_id": null,
  "incoming_order_id": null,
  "return_request_id": null,
  "payment_ref": "ownaccount",
  "payment_amount": 9.72,
  "state": "created",
  "driver": "boxnow",
  "pickup_ref": null,
  "pickup_list_ref": null,
  "tracking_ref": "2338891501",
  "tracking_url": null,
  "tracking_status": "PRE_TRANSIT",
  "tracking_history": [
    {
      "status": "DELIVERED",
      "status_date": "2023-11-20T00:00:01.992Z",
      "status_details": "ΠΑΡΑΔΟΣΗ ΑΠΟ ΔΙΑΝΟΜΕΑ"
    },
    {
      "status": "EXCEPTION",
      "status_date": "2023-11-20T00:00:02.195Z",
      "status_details": "ΑΚΥΡΩΣΗ ΑΠΟ ΔΙΑΝΟΜΕΑ"
    },
    {
      "status": "TRANSIT",
      "status_date": "2023-11-20T00:00:02.075Z",
      "status_details": "ΕΚΦΟΡΤΩΣΗ ΑΠΟ ΜΕΤΑΦΟΡΙΚΟ ΜΕΣΟ"
    },
    {
      "status": "PRE_TRANSIT",
      "status_date": "2023-11-20T00:00:02.064Z",
      "status_details": "ΔΗΜΙΟΥΡΓΙΑ ΣΥ.ΔΕ.ΤΑ. ΑΠΟ ΠΕΛΑΤΗ"
    }
  ],
  "tracking_history_last_updated_at": "2022-08-08T09:15:00.947Z", 
  "label_url": "https://static.shiplemon.com/sandbox/labels/boxnow/2338891501.pdf",
  "child_vouchers": [
    {
      "tracking_ref": "2338891501",
      "tracking_url": "",
      "label_url": "https://static.shiplemon.com/sandbox/labels/boxnow/2338891501.pdf"
    }
  ],
  "address_from": { 
    "country":"GR", 
    "zip":"14451",
    "name": "Kostas Papadopoulos", 
    "company": "Papadopoulou IKE", 
    "address": "Papadopoulou 23",
    "address2": "Floor 2"
    "city": "Athens",
    "phone": "+306900000000",
    "email": "example@gmail.com"
    "country": "GR",
    "notes": "call me"            
  },
  "address_to": {
    "name": "SG2",
    "country": "GR",
    "state": "I",
    "city": "Athens",
    "zip": "14451",
    "address": "Kolokotroni 2",
    "email": "example2@gmail.com",
    "phone": "+306900000000"
  },
  "items": [
    {
      "width": 20,
      "height": 20,
      "length": 20,
      "weight": 1600,
      "label": "Box",
      "notes": "Box",
      "invoice_lines": [
        {
          "country_of_origin": "GR",
          "description": "glasses-RETURN TO ORIGIN",
          "commodity_code": "9004.90.10",
          "quantity": "1",
          "value": 10,
          "weight": 500
        }
      ]
    }
  ],
  "pickup": { // if date not provided pickup is null
    "date": "2023-11-22",
    "time": "11:00-17:00"
  },
  "pickup_at": null,
  "delivered_at": null,
  "refunded_at": null,
  "rate": {
    "id": "boxnow_next-day_40b892de-02ea-47f7-85d9-f9dccef1144f",
    "friendly_name": "BoxNow",
    "driver": "boxnow",
    "provider": {
      "name": "BOXNOW",
      "image": "https://static.shiplemon.com/providers/boxnow.svg"
    },
    "service": {
       "code": "next-day",
       "name": "Next Day",
       "estimated_delivery_in_days": 2
    },
    "total_amount": 9.72,
    "total_without_tax_amount": 7.84,
    "tax_amount": 1.88,
    "currency": "EUR",
    "has_cash_on_delivery": false,
    "has_custom_credentials": false,
    "has_shipment_pickup_combined": false,
    "has_pickup": true,
    "transportation": "road",
    "has_mass_printing": false,
    "has_customs_invoice_upload": false,
    "has_insurance_ability": false,
    "has_saturday_delivery": false,
    "has_same_day_pickup": false,
    "pickup_slot_length_in_hours": 2,
    "pickup_same_day_latest_at": null,
    "pickup_earliest_at": null,
    "pickup_latest_at": null,
    "metadata": {
      "items": [
        {
          "width": 20,
          "height": 20,
          "length": 20,
          "weight": 1600,
          "label": "Box",
          "notes": "Box",
          "compartment_size": 1,
          "invoice_lines": [
            {
              "country_of_origin": "GR",
              "description": "glasses-RETURN TO ORIGIN",
              "commodity_code": "9004.90.10",
              "quantity": "1",
              "value": 10,
              "weight": 500
            }
          ]
        }
      ],
      "address_from": { 
        "country":"GR", 
        "zip":"14451",
        "name": "Kostas Papadopoulos", 
        "company": "Papadopoulou IKE", 
        "address": "Papadopoulou 23",
        "address2": "Floor 2"
        "city": "Athens",
        "phone": "+306900000000",
        "email": "example@gmail.com"
        "country": "GR",
        "notes": "call me"            
      },
      "address_to": {
        "name": "SG2",
        "country": "GR",
        "state": "I",
        "city": "Athens",
        "zip": "14451",
        "address": "Kolokotroni 2",
        "email": "example2@gmail.com",
        "phone": "+306900000000"
      },
    }
  },
  "cash_on_delivery": 0,
  "extras": {
    "insurance_amount": 100, // number or undefined
    "is_customs_invoice_document": false, // boolean or undefined
    "is_saturday_delivery": false // boolean or undefined
  },
  "created_at": "2023-11-21T12:51:51.422Z",
  "updated_at": "2023-11-21T12:51:51.422Z"
}
```
