How to Create a Forward Shipment

Modified on Tue, 4 Feb at 5:38 PM

Creating a shipment for an order in OTO through the API is a simple process when you understand the required fields and the proper API calls. This guide will walk you through the steps necessary to create a shipment using OTO's REST API.


Instructions


Step 1: Obtain the Required Authentication

  • Before making any API request, ensure that you have a valid access Token. The token is necessary for authentication and must be included in the headers of all API requests.

    To obtain the token, log in to the OTO dashboard and navigate to the Sales Channel section under OTO API. Retrieve your refresh token and then use it to get an access token.


Step 2: Understand the Required API Endpoint

  • The endpoint for creating an order is as follows: https://api.tryoto.com/rest/v2/createShipment

    This endpoint requires certain fields to be passed in the request body. This endpoint requires specific fields in the request body, including order details, delivery company selection, and other shipment-related metadata.


Step 3: Prepare the Request Body

  • The request body must be in JSON format and should include the following fields:



NameRequiredTypeDescription
deliveryOptionIdyesnumberThe Id of the shipping company we wish to create the shipment with
orderIdyestextOrder ID for transactions of a single Order


Step 4: Make the API Call

  • Use the following cURL command to send the request:

    curl --location 'https://api.tryoto.com/rest/v2/createShipment' \

    --data '{

        "orderId": "1232464",

        "deliveryOptionId":"12345"

    }'


Step 5: Handle the Response

  • A successful response will look like this:

    {

      "success": true,

      "otoId": 540789

    }


Note:


To create shipments, you need a valid delivery option ID, which refers to a delivery company. There are two ways to obtain valid delivery options:

A. OTO-Provided Delivery Options

  • You do not need contracts with delivery companies.
  • OTO provides pre-integrated delivery company options.
  • Use the Check OTO Delivery Fee endpoint to view available options.

B. Integrated Delivery Options (Your Own Accounts)

  • If you have contracts with one or more delivery companies, you can integrate them with OTO.
  • You provide OTO with your delivery company credentials.
  • Each delivery company you integrate is assigned a Delivery Option ID.
  • Use the Get Delivery Options endpoint to retrieve these IDs.




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