1. Orders
Treek-Public
  • Authentication
    • User login with email and password
      POST
  • Orders
    • Create Order
      POST
    • List Orders
      GET
    • Order Details
      GET
    • Update Order
      PUT
    • Cancel Order
      POST
    • Reset Order
      POST
    • Get Statuses
      GET
    • Verify Item
      POST
    • Verify Order
      POST
    • Order Price
      GET
  • Shipments
    • Create Shipment
      POST
    • Return Shipment
      POST
    • Print Invoice
      GET
  • Boxes
    • Create Box
      POST
    • Get Boxes
      GET
    • Box Details
      GET
    • Update Box
      PUT
  • Merchants
    • Merchants Details
      GET
  • Profile
    • User Details
      GET
    • Update User
      PUT
    • Change Password
      PUT
  • Utilities
    • Countries List
      GET
    • Cities List
      GET
    • Couriers List
      GET
  • Warehouses
    • Warehouses List
    • Create warehouse
    • warehouse Details
  • Price Calculator
    • Price Calculator
  • Packaging Type
    • Packaging Types List
    • Packaging Type Details
  • statistics
    • Statistics
  • Schemas
    • LoginRequest
    • CreateOrderRequest
    • UpdateOrderRequest
    • Price Calculator
    • VerifyItem
    • CreateWarehouseRequest
    • Shipment Package
    • Create Reverse Shipment
    • OrderPackages
    • OrderItem
    • Order
    • City
    • Country
    • User
    • OrderItem
    • CreateOrderItemRequest
    • CalculateRatesRequest
    • BoxDimensions
    • OrderShippingRate
    • RateCalculationParams
    • Warehouse
    • Box
    • CreateBoxRequest
    • UpdateBoxRequest
    • ValidationError
    • NotFoundError
    • UnauthorizedError
    • ForbiddenError
    • PaginationMeta
    • PaginationLinks
  1. Orders

Update Order

Developing
PUT
https://app.gotreek.com/api/orders/{id}/edit
Last modified:2026-01-05 09:29:04
💡
Authentication
Requires Bearer token authentication.
Only orders belonging to the authenticated user can be modified.
📌
Behaviour
Supports partial updates — the client sends only the fields that need to change.
Immutable fields such as id, order_number, and internal lifecycle fields cannot be updated.
📌
Order items & boxes synchronization
1.
Order Items
If order_item_id is provided and belongs to the current order → the existing item is updated.
If order_item_id is not provided → a new item is created and attached to the order.
If order_item_id is provided but does not belong to this order → the request fails with a validation error and no changes are applied to the order or its children.
2.
Order Boxes
If order_box_id is provided and belongs to the current order → the existing box is updated.
If order_box_id is not provided → a new box is created and attached to the order.
If order_box_id is provided but does not belong to this order → the request fails with a validation error and no changes are applied to the order or its children.
This guarantees “all‑or‑nothing” behaviour for the combined update of order, items, and boxes.

Request

Authorization
OAuth 2.0
Client Credentials
Add the parameter
Authorization
to Headers
,whose value is to concatenate the Token after the Bearer.
Example:
Authorization: Bearer ********************
Token URL: https://app.gotreek.com/api/auth/login
or
Path Params

Header Params

Body Params application/jsonRequired

Examples

Responses

🟢200Success
application/json
Body

🟠404Not Found
🟠422
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request PUT 'https://app.gotreek.com/api/orders//edit' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "receiver_first_name": "test",
  "receiver_last_name": "test",
  "receiver_phone": "+966501234567",
  "receiver_email": "test@example.com",
  "receiver_address_line": "testadress",
  "receiver_street_name": "teststreet",
  "receiver_postal_code": "test",
  "receiver_short_address": "RRRR2424",
  "receiver_block": "testblock",
  "receiver_country_id": 1,
  "receiver_city_id": 62,
  "receiver_latitude": 36.8065,
  "receiver_longitude": 10.1815,
  "status": "pending",
  "payment_method": "cod",
  "order_grand_total": 150.75,
  "shipment_company": "deliverist",
  "description": "testdescription",
  "items": [
    {
      "order_item_id": 12,
      "name": "accessory",
      "quantity": 1,
      "price": 120.50
    },
    {
      "name": "accessory",
      "quantity": 2,
      "price": 15.00
    }
  ],
  "boxes": [
    {
      "order_box_id": 3,
      "length": 40,
      "width": 30,
      "height": 20,
      "weight": 5,
      "packaging_type_id": 1
    },
    {
      "length": 25,
      "width": 25,
      "height": 15,
      "weight": 3,
      "packaging_type_id": 2
    }
  ]
}'
Response Response Example
200 - Success
{
    "success": true,
    "message": "Order updated successfully",
    "data": {
        "id": 43971,
        "order_number": "17668244951403",
        "status": "pending",
        "date": "2025-12-27 08:34:55",
        "order_grand_total": 150.75,
        "currency": "SAR",
        "description": "testdescription",
        "payment_method": "cod",
        "receiver_first_name": "test",
        "receiver_last_name": "test",
        "receiver_phone": "+966501234567",
        "receiver_email": "test@example.com",
        "receiver_short_address": "RRRR2424",
        "receiver_country_id": 1,
        "receiver_country": {
            "id": 1,
            "name": "Saudi Arabia",
            "name_zid": "السعودية",
            "name_ar": "السعودية",
            "code_country": "SA",
            "phone_code": "+966",
            "phone_number_length": 9,
            "created_at": "2024-12-22T18:23:12.000000Z",
            "updated_at": "2025-04-16T08:52:36.000000Z"
        },
        "receiver_country_code": null,
        "receiver_city": {
            "id": 62,
            "country_id": 1,
            "name": "Riyadh",
            "name_ar": "الرياض",
            "created_at": null,
            "updated_at": "2025-04-16T09:15:16.000000Z"
        },
        "receiver_address_line": "testadress",
        "receiver_street_name": "teststreet",
        "receiver_block": "testblock",
        "receiver_postal_code": "test",
        "receiver_latitude": "36.80650000",
        "receiver_longitude": "10.18150000",
        "shipper_name": "تست",
        "shipper_email": null,
        "shipper_phone": "+966533112592",
        "shipper_country_id": 1,
        "shipper_city": "جدة",
        "shipper_address_line": "الهنداوية شارع زهرة اللوتس مقابل تموينات التوفير ",
        "shipper_street_name": null,
        "shipper_block": null,
        "shipper_postal_code": null,
        "shipper_latitude": null,
        "shipper_longitude": null,
        "total_weight": 0,
        "merchant_id": null,
        "delivered_at": null,
        "tax": 0,
        "external_id": null,
        "webhook_id": null,
        "created_at": "2025-12-27T08:34:55.000000Z",
        "updated_at": "2025-12-29T12:40:18.000000Z",
        "warehouse_id": 207,
        "receiver_city_id": 62,
        "cod_wallet_id": null,
        "shipment_external_id": null,
        "selected_shipment_company": null,
        "source": "manual",
        "return_type": null,
        "volumetric_divisor": null,
        "merchant_shipment_id": null,
        "return_ordered_at": null,
        "merchant": null,
        "items": [
            {
                "id": 62492,
                "order_id": 43971,
                "name": "camarche",
                "sku": null,
                "quantity": 1,
                "weight": 0,
                "weight_unit": null,
                "price": 121,
                "total_price": null,
                "tax": null,
                "currency": "SAR",
                "created_at": "2025-12-27T08:34:55.000000Z",
                "updated_at": "2025-12-29T12:40:18.000000Z",
                "verification_status": "pending",
                "verified_at": null,
                "verified_by": null,
                "wrong_attempts": 0,
                "verification_note": null
            },
            {
                "id": 62493,
                "order_id": 43971,
                "name": "غطاء أيفون",
                "sku": null,
                "quantity": 2,
                "weight": 0,
                "weight_unit": null,
                "price": 7550,
                "total_price": null,
                "tax": null,
                "currency": "SAR",
                "created_at": "2025-12-27T08:34:55.000000Z",
                "updated_at": "2025-12-27T08:34:55.000000Z",
                "verification_status": "pending",
                "verified_at": null,
                "verified_by": null,
                "wrong_attempts": 0,
                "verification_note": null
            },
            {
                "id": 62494,
                "order_id": 43971,
                "name": "withoutid",
                "sku": null,
                "quantity": 2,
                "weight": null,
                "weight_unit": null,
                "price": 15,
                "total_price": null,
                "tax": null,
                "currency": "SAR",
                "created_at": "2025-12-29T10:37:50.000000Z",
                "updated_at": "2025-12-29T10:37:50.000000Z",
                "verification_status": "pending",
                "verified_at": null,
                "verified_by": null,
                "wrong_attempts": 0,
                "verification_note": null
            }
        ],
        "boxes": [
            {
                "id": 33025,
                "order_id": 43971,
                "box_id": null,
                "length": 40,
                "width": 30,
                "height": 20,
                "weight": 5,
                "packaging_type_id": 1,
                "created_at": "2025-12-27T08:34:55.000000Z",
                "updated_at": "2025-12-29T10:37:50.000000Z"
            },
            {
                "id": 33026,
                "order_id": 43971,
                "box_id": null,
                "length": 25,
                "width": 25,
                "height": 15,
                "weight": 3,
                "packaging_type_id": 1,
                "created_at": "2025-12-29T10:37:50.000000Z",
                "updated_at": "2025-12-29T10:37:50.000000Z"
            }
        ]
    }
}
Modified at 2026-01-05 09:29:04
Previous
Order Details
Next
Cancel Order
Built with