> For the complete documentation index, see [llms.txt](https://apidocs.akinon.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.akinon.com/flows/shipment-flows.md). Agents can also search and read this documentation through its [MCP server](https://apidocs.akinon.com/~gitbook/mcp).

# Shipment Flows

This part of the document contains the list of services that can be integrated in flows above. 2 configuration parameters will be shared during integration:

| username | Username for basic authentication |
| -------- | --------------------------------- |
| password | Password for basic authentication |

This parameter indicates which credentials should be used for multi-account management. It is an optional parameter, and even if not sent, a default set of credentials should be defined:

### generate-shipment (POST)

This service is used to start a new shipping process.

**URL**

```
^^/shipments
```

**Request Headers**

| x-akinon-request-id             | Unique ID for problem solving & tracing.                  | Mandatory |
| ------------------------------- | --------------------------------------------------------- | --------- |
| x-akinon-api-version            | Akinon Customer API version.                              | Mandatory |
| x-akinon-credentials-identifier | Unique id specifying the credentials for multiple account | Optional  |
| Authorization                   | Basic \[BASE64\_encoded(username:password)]               | Mandatory |

**Request Body raw (json)**

```json
{
   "shipmentId": "", - Akinon unique id
   "orderNumber": "", - Akinon unique order number
   "locale": "", – IETF BCP 47 language tag
   "deliveryNote":"",
   "type":"", -CUSTOMER, PICK_UP_LOCATION
   "destination": {
       "name": "",
       "surname": "",
       "tel": "",
       "country": {
           "id": 0, -Omnitron country id
           "code": "",-ISO code
           "name": ""
       },
       "city": {
           "id": 0, -Omnitron city id
           "name": ""
       },
       "district": {
           "id": 0, -Omnitron district id
           "name": ""
       },
       "township": {
           "id": 0, -Omnitron township id
           "name": ""
       },
       "zipcode": "",
       "addressLine": ""
   }
}
```

**Sender Address Information**

If your service requires a sender information ID with a predefined sender address, the following part is sent in addition to the above request. This originId must be the same as the addressId in the response of the generate address service.

```json
 …,
"originId":""
```

**Product List Information**

The `products` list is sent only when the cargo company configuration has `send_product_info: true`. Each item in the package is a separate element of the list. If a package contains 2 units of the same SKU, the list contains 2 separate elements with that SKU.

| Field        | Type    | Description                                                                                                                |
| ------------ | ------- | -------------------------------------------------------------------------------------------------------------------------- |
| `sku`        | string  | The product's SKU. Use this field to identify the product.                                                                 |
| `barcode`    | string  | The product's barcode. If the product has no barcode, this falls back to the SKU, so it is not guaranteed to be a barcode. |
| `name`       | string  | Product name.                                                                                                              |
| `item_count` | integer | Item quantity. Each element represents a single item, so the value is always `1`.                                          |

The following fields are populated from product attributes, depending on the cargo company configuration:

* **`product_attributes`**: Adds the listed attributes to the payload using their original names (e.g., `["category", "deci"]`).
* **`generate_shipment_product_attributes`**: Maps product attributes to different payload field names using a `{ "<payload field>": "<attribute name>" }` format (e.g., `{ "deci": "desi" }`).

If a product does not have the specified attribute, its value is sent as `null`.

```json
"products": [{
    "sku": "AB123-40",
    "barcode": "8681234567890",
    "name": "Sample Product",
    "item_count": 1,
    "category": "clothes",
    "deci": "1"
}]
```

`category` and `deci` in the example depend on configuration and are not present in every setup.

Shipment requests for transfer orders send the `products` list in the same shape.

**Payment Information**

If the payment type is **pay on delivery**, the following information will be sent in addition to the above request.

<pre class="language-json"><code class="lang-json">…,
"payment": {
    "paymentId": "", -Akinon id
    "paymentType": "", - This parameter is the type of pay on delivery. Card/Cash
    "amount": 0.00,
<strong>    "currency": "" -Three-letter ISO 4217 currency code
</strong>}
</code></pre>

**Statuses**

| CREATED             | Shipment information created at the cargo company.                                                                         |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| DELETED             | The package has not yet been received by the cargo company and the sender canceled and deleted previously created records. |
| SHIPPING            | From the receipt of the package to the first arrival at the customer.                                                      |
| ATTEMPTED\_DELIVERY | The package could not be delivered due to the customer.                                                                    |
| DELIVERED           | Delivered.                                                                                                                 |
| DELIVERY\_FAILED    | The package could not be delivered for any reason.                                                                         |
| READY\_FOR\_PICKUP  | The package has arrived at the pickup location.                                                                            |

**Response Body raw 200 (json)**

```json
{
    "waybillNumber": "", -unique shipment company id, if exist trackingNumber, else unique waybill id
    "trackingNumber":"", -if exists, optional at this step
    "trackingUrl":"", -if exists, optional at this step
    "status":"", CREATED
    "statusDetail":"",
    "labelData":"", - optional, if exists at this step base64 encoded label 
    "labelFormat":"" - optional, label file format. PNG, ZPL, HTML, PDF
}
```

### query-shipment (GET)

This service is used to query the latest status of previously initiated cargo transactions.

**URL**

```
^^/shipments/{id}?type={queryType}
```

**Request Headers**

| x-akinon-request-id             | Unique ID for problem solving & tracing.                  | Mandatory |
| ------------------------------- | --------------------------------------------------------- | --------- |
| x-akinon-api-version            | Akinon Customer API version.                              | Mandatory |
| x-akinon-credentials-identifier | Unique id specifying the credentials for multiple account | Optional  |
| Authorization                   | Basic \[BASE64\_encoded(username:password)]               | Mandatory |

**Request Parameters**

**queryType**: `SHIPMENT_ID`(default), `WAYBILL_NUMBER`, `TRACKING_NUMBER`

This parameter indicates which value is sent in the ID field. If there is no parameter, the default value should be used.

**Request Body**

```
none
```

**Response Body raw 200 (json)**

```json
{
    "waybillNumber": "", -shipmentCompanyId
    "trackingNumber":"", -optional if not yet created
    "trackingUrl":"", -optional if not yet created
    "status":"" -CREATED, LABEL_DELETED, SHIPPING, ATTEMPTED_DELIVERY, DELIVERED, DELIVERY_FAILED, READY_FOR_PICKUP
    "statusDetail":""
}
```

### query-shipment-history (GET)

This service is used to inquire in detail the latest status of the cargo transactions that have been initiated before.

**URL**

```json
^^/shipments/{id}/history?type={queryType}
```

**Request Headers**

| x-akinon-request-id             | Unique ID for problem solving & tracing.                  | Mandatory |
| ------------------------------- | --------------------------------------------------------- | --------- |
| x-akinon-api-version            | Akinon Customer API version.                              | Mandatory |
| x-akinon-credentials-identifier | Unique id specifying the credentials for multiple account | Optional  |
| Authorization                   | Basic \[BASE64\_encoded(username:password)]               | Mandatory |

**Request Parameters**

**queryType**: `SHIPMENT_ID`(default), `WAYBILL_NUMBER`, `TRACKING_NUMBER`

This parameter indicates which value is sent in the ID field. If there is no parameter, the default value should be used.

**Request Body**

```
none
```

**Response Body raw 200 (json)**

```json
{
    "waybillNumber": "", -shipmentCompanyId
    "trackingNumber":"", -optional if not yet created
    "trackingUrl":"", -optional if not yet created
    "status":"" -CREATED, LABEL_DELETED, SHIPPING, ATTEMPTED_DELIVERY, DELIVERED, DELIVERY_FAILED, READY_FOR_PICKUP
    "statusDetail":"",
    "history": [
        { 
          "status":"" -CREATED, LABEL_DELETED, SHIPPING, ATTEMPTED_DELIVERY, DELIVERED, DELIVERY_FAILED, READY_FOR_PICKUP
          "statusDetail":"",
          "timestamp": "" -ISO 8601
        }
   ]

}
```

### delete-shipment (DELETE)

This service is used to cancel the previously initiated cargo transactions before the carrier receives the package.

**URL**

```json
^^/shipments/{shipmentId}
```

**Request Headers**

| x-akinon-request-id             | Unique ID for problem solving & tracing.                  | Mandatory |
| ------------------------------- | --------------------------------------------------------- | --------- |
| x-akinon-api-version            | Akinon Customer API version.                              | Mandatory |
| x-akinon-credentials-identifier | Unique id specifying the credentials for multiple account | Optional  |
| Authorization                   | Basic \[BASE64\_encoded(username:password)]               | Mandatory |

**Request Body**

```
none
```

**Response Body raw 204**

```
none
```

### update-shipment (PATCH)

This service is used to update the address information of the previously created cargo request.

**URL**

```json
^^/shipments/{shipmentId}
```

**Request Headers**

| x-akinon-request-id             | Unique ID for problem solving & tracing.                  | Mandatory |
| ------------------------------- | --------------------------------------------------------- | --------- |
| x-akinon-api-version            | Akinon Customer API version.                              | Mandatory |
| x-akinon-credentials-identifier | Unique id specifying the credentials for multiple account | Optional  |
| Authorization                   | Basic \[BASE64\_encoded(username:password)]               | Mandatory |

**Request Body raw (json)**

```json
{
     "destination": {
       "name": "",
       "surname": "",
       "tel": "",
       "country": {
           "id": 0, -Akinon country id
           "code": "",-ISO code
           "name": ""
       },
       "city": {
           "id": 0, -Akinon city id
           "name": ""
       },
       "district": {
           "id": 0, -Akinon district id
           "name": ""
       },
       "township": {
           "id": 0, -Akinon township id
           "name": ""
       },
       "zipcode": "",
       "addressLine": ""
   }
}
```

**Response Body raw 200**

```
none
```

### query-shipment-label (GET)

This service is used to retrieve the label of the previously created cargo request.

**URL**

```json
^^/shipments/{shipmentId}/label?labelFormat
```

**Request Headers**

| x-akinon-request-id             | Unique ID for problem solving & tracing.                  | Mandatory |
| ------------------------------- | --------------------------------------------------------- | --------- |
| x-akinon-api-version            | Akinon Customer API version.                              | Mandatory |
| x-akinon-credentials-identifier | Unique id specifying the credentials for multiple account | Optional  |
| Authorization                   | Basic \[BASE64\_encoded(username:password)]               | Mandatory |

**Request Parameters**

```
labelFormats(optional): PNG, ZPL, HTML, PDF
```

**Request Body**

```
none
```

**Response Body raw 200 (json)**

```json
{
    "labelData":"", - base64 encoded label 
    "labelFormat":"", -label file format. PNG, ZPL, HTML, PDF
}
```

### generate-easy-return (POST)

This service is used to initiate the return process of the product that has been delivered.

**URL**

```json
^^/easy-returns
```

**Request Headers**

| x-akinon-request-id             | Unique ID for problem solving & tracing.                  | Mandatory |
| ------------------------------- | --------------------------------------------------------- | --------- |
| x-akinon-api-version            | Akinon Customer API version.                              | Mandatory |
| x-akinon-credentials-identifier | Unique id specifying the credentials for multiple account | Optional  |
| Authorization                   | Basic \[BASE64\_encoded(username:password)]               | Mandatory |

**Request Body raw (json)**

```json
{
 "returnId": "", -akinon unique id
 "orderNumber": "", -akinon unique order number
}  
```

If target location information and detailed information are required for easy return, the following part will be sent in addition to the above request:

```json
 "destination": { -seller address
       "name": "",
       "surname": "",
       "tel": "",
       "country": {
           "id": 0, -Akinon country id
           "code": "",-ISO code
           "name": ""
       },
       "city": {
           "id": 0, -Akinon city id
           "name": ""
       },
       "district": {
           "id": 0, -Akinon district id
           "name": ""
       },
       "township": {
           "id": 0, -Akinon township id
           "name": ""
       },
       "zipcode": "",
       "addressLine": ""
   },
```

If destination address has a predefined address Id it can be used instead of detailed open address above. This destinationId must be the same as the addressId in the response of the generate address service.

```json
 "destinationId":"",
```

If the package is to be picked up from the customer's address, the following part will be sent in addition to the above request.

```json
"origin": { -customer address for pick up
       "name": "",
       "surname": "",
       "tel": "",
       "country": {
           "id": 0, -Akinon country id
           "code": "",-ISO code
           "name": ""
       },
       "city": {
           "id": 0, -Akinon city id
           "name": ""
       },
       "district": {
           "id": 0, -Akinon district id
           "name": ""
       },
       "township": {
           "id": 0, -Akinon township id
           "name": ""
       },
       "zipcode": "",
       "addressLine": ""
   }
```

If your service needs pickup date, the following part will be sent in addition to the above request. Available pickup dates can be obtained from [search-appointment-dates](https://apidocs.akinon.com/flows/shipment-flows#search-appointment-dates-post) service.

```json
"pickupDate": {
    "date": "", -ISO 8601 Date, (yyyy-MM-dd)
    "hourRange": {
        "start": "", - HH:MM
        "end": ""    - HH:MM
    }
}
```

**Response Body raw 200 (json)**

```json
{
    "waybillNumber": "",
    "trackingNumber":"", -optional 
    "trackingUrl":"", -optional 
    "status":"", -CREATED
    "statusDetail":""
}
```

### query-easy-return (GET)

This service is used to query the latest status of the product whose return process has started.

**URL**

```json
^^/easy-returns/{easyReturnId}
```

**Request Headers**

| x-akinon-request-id             | Unique ID for problem solving & tracing.                  | Mandatory |
| ------------------------------- | --------------------------------------------------------- | --------- |
| x-akinon-api-version            | Akinon Customer API version.                              | Mandatory |
| x-akinon-credentials-identifier | Unique id specifying the credentials for multiple account | Optional  |
| Authorization                   | Basic \[BASE64\_encoded(username:password)]               | Mandatory |

**Request Body**

```
none
```

**Response Body raw 200 (json)**

```json
{
    "waybillNumber": "", -shipmentCompanyId
    "trackingNumber":"", -optional
    "trackingUrl":"", -optional
    "status":"" -CREATED, LABEL_DELETED, SHIPPING, ATTEMPTED_DELIVERY, DELIVERED, DELIVERY_FAILED, READY_FOR_PICKUP
    "statusDetail":""
}
```

### delete-easy-return (DELETE)

This service is used to cancel the initial return process.

**URL**

```json
^^/easy-returns/{easyReturnId}
```

**Request Headers**

| x-akinon-request-id             | Unique ID for problem solving & tracing.                  | Mandatory |
| ------------------------------- | --------------------------------------------------------- | --------- |
| x-akinon-api-version            | Akinon Customer API version.                              | Mandatory |
| x-akinon-credentials-identifier | Unique id specifying the credentials for multiple account | Optional  |
| Authorization                   | Basic \[BASE64\_encoded(username:password)]               | Mandatory |

**Request Body**

```
none
```

**Response Body raw 204**

```
none
```

### search-appointment-dates (POST)

This service is used to get available appointment dates. It can be used for expected date of delivery when ordering or pickup date for easy return.

**URL**

```json
^^/search-appointment-dates
```

**Request Headers**

| Authorization        | Basic \[BASE64\_encoded(username:password)] | Mandatory |
| -------------------- | ------------------------------------------- | --------- |
| x-akinon-request-id  | Unique ID for problem solving & tracing.    | Mandatory |
| x-akinon-api-version | Akinon Customer API version.                | Mandatory |

**Request Body**

```json
{
    "address": {
        "country": {
            "id": 0, -Omnitron country id
            "code": "", -ISO code
            "name": ""
        },
        "city": {
            "id": 0, -Omnitron city id
            "name": ""
        },
        "township": {
            "id": 0, -Omnitron township id
            "name": ""
        },
        "district": {
            "id": 0, -Omnitron district id
            "name": ""
        },
        "zipcode": "",
        "addressLine": "",
    },
    "startDate": "", -ISO 8601 Date for Beginning of the desired date range
    "endDate": "" -ISO 8601 Date for End of the desired date range
}
```

**Response Body raw 200 (json)**

```json
[
    {
        "date": "", -ISO 8601 Date, (yyyy-MM-dd)
        "hourRanges": [
            {
                "start": "", -HH:MM
                "end": "" -HH:MM
            },
            {
                "start": "", -HH:MM
                "end": "" -HH:MM
            },
            ...
        ]
    },
    ...
]
```

### generate-address (POST)

This service is used to generate a new predefined shipping address.

**URL**

```json
^^/addresses
```

**Request Headers**

| x-akinon-request-id             | Unique ID for problem solving & tracing.                  | Mandatory |
| ------------------------------- | --------------------------------------------------------- | --------- |
| x-akinon-api-version            | Akinon Customer API version.                              | Mandatory |
| x-akinon-credentials-identifier | Unique id specifying the credentials for multiple account | Optional  |
| Authorization                   | Basic \[BASE64\_encoded(username:password)]               | Mandatory |

**Request Body**

```json
{
    "id": "", - Akinon unique address id for all domains(omnitron, oms etc)
    "addressName": "",
    "addressDescription": "",
    "phone": "",
    "email": "",
    "address": {
        "country": {
            "id": 0, -Omnitron country id
            "code": "",-ISO code
            "name": ""
        },
        "city": {
            "id": 0, -Omnitron city id
            "name": ""
        },
        "district": {
            "id": 0, -Omnitron district id
            "name": ""
        },
        "township": {
            "id": 0, -Omnitron township id
            "name": ""
        },
        "zipcode": "",
        "addressLine": ""
    },
    "type": "" -optional address type; values: CUSTOMER, DISTRIBUTION_POINT(default), PICK_UP_LOCATION
}
```

If your service requires coordinates of address, the following part is sent in addition to the above request.

```json
{
    ...,
    "address": {
        ...,
        "coordinates": {
            "latitude": 0.000000, - Decimal degrees (DD) with 6 decimal places
            "longitude": 0.000000 - Decimal degrees (DD) with 6 decimal places
        }
    }
}
```

If your service requires hours the location is open, the following part is sent in addition to the above request.

```json
{
    ...,
    "workingHours": [
        {
            "day": "", -values: 1(Monday), 2(Tuesday), ..., 7(Sunday)
            "hourRanges": [
                {
                    "start": "", -HH:MM
                    "end": "" -HH:MM
                },
                {
                    "start": "", -HH:MM
                    "end": "" -HH:MM
                }
            ]
        }
    ]
}
```

**Response Body raw 201 (json)**

```json
{
    "addressId": "", -unique addressId for shipment company. This info will be logged in Akinon systems.
}
```

### get-addresses (POST)

This service is used to get predefined shipping addresses.

**URL**

```json
^^/addresses/info
```

**Request Headers**

| x-akinon-request-id  | Unique ID for problem solving & tracing.    | Mandatory |
| -------------------- | ------------------------------------------- | --------- |
| x-akinon-api-version | Akinon Customer API version.                | Mandatory |
| Authorization        | Basic \[BASE64\_encoded(username:password)] | Mandatory |

**Request Body**

```json
{
    "locale": "",
    "type": "", -CUSTOMER, DISTRIBUTION_POINT, PICK_UP_LOCATION
    "address": {
        "country": {
            "id": 0, -Omnitron country id
            "code": "", -ISO code
            "name": ""
        },
        "city": {
            "id": 0, -Omnitron city id
            "name": ""
        },
        "district": {
            "id": 0, -Omnitron district id
            "name": ""
        },
        "township": {
            "id": 0, -Omnitron township id
            "name": ""
        },
        "zipcode": ""
    }
}
```

**Response Body raw 200 (json)**

```json
[
    {
        "id": "",
        "addressName": "",
        "addressDescription": "",
        "type": "PICK_UP_LOCATION",
        "phone": "",
        "email": "",
        "address": {
            "country": {
                "id": 0,
                "code": "",
                "name": ""
            },
            "city": {
                "id": 0,
                "name": ""
            },
            "district": {
                "id": 0,
                "name": ""
            },
            "township": {
                "id": 0,
                "name": ""
            },
            "zipcode": "",
            "addressLine": "",
            "coordinates": { -optional if coordinates provided
                "latitude": 0.000000,
                "longitude": 0.000000
            }
        },
        "workingHours": [ -optional if working hours provided
            {
                "day": "", -values: 1(Monday), 2(Tuesday), ..., 7(Sunday)
                "hourRanges": [
                    {
                        "start": "", -HH:MM
                        "end": "" -HH:MM
                    },
                    {
                        "start": "", -HH:MM
                        "end": "" -HH:MM
                    }
                ]
            }
        ]
    },
    ...
]
```

### get-address-detail (GET)

This service is used to get details of predefined delivery addresses.

**URL**

```json
^^/addresses/{id}
```

**Request Headers**

| x-akinon-request-id  | Unique ID for problem solving & tracing.    | Mandatory |
| -------------------- | ------------------------------------------- | --------- |
| x-akinon-api-version | Akinon Customer API version.                | Mandatory |
| Authorization        | Basic \[BASE64\_encoded(username:password)] | Mandatory |

**Request Body**

```json
none
```

**Response Body raw 200 (json)**

```json
{
    "id": "",
    "addressName": "",
    "addressDescription": "",
    "type": "PICK_UP_LOCATION",
    "phone": "",
    "email": "",
    "address": {
        "country": {
            "id": 0,
            "code": "",
            "name": ""
        },
        "city": {
            "id": 0,
            "name": ""
        },
        "district": {
            "id": 0,
            "name": ""
        },
        "township": {
            "id": 0,
            "name": ""
        },
        "zipcode": "",
        "addressLine": "",
        "coordinates": { -optional if coordinates provided
            "latitude": 0.000000,
            "longitude": 0.000000
        }
    },
    "workingHours": [ -optional if working hours provided
        {
            "day": "", -values: 1(Monday), 2(Tuesday), ..., 7(Sunday)
            "hourRanges": [
                {
                    "start": "", -HH:MM
                    "end": "" -HH:MM
                },
                {
                    "start": "", -HH:MM
                    "end": "" -HH:MM
                }
            ]
        }
    ]
}
```

### Response Body For Errors (ALL)

If any errors are encountered in the services, these errors should be reported in the format below, and the list of error codes should be shared with Akinon.

**Response Body raw 4xx/5xx (json)**

```json
{
    "errors": [
       {
           "code": "",
           "field": "",
           "message": ""
       }
   ]
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://apidocs.akinon.com/flows/shipment-flows.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
