Skip to content

orderUpdate ​

Updates an existing order's fields.

  • DRAFT orders: updates are applied immediately and synchronously.
  • OPENED orders: updates are processed asynchronously. The request may be rejected if warehouse production has already started for one or more lines.

Required scope: edit_orders


Mutation ​

graphql
mutation OrderUpdate($input: OrderInput!) {
  orderUpdate(input: $input) {
    id
    type
    state
    message
  }
}

The return type is a DispatchableRequest. For DRAFT orders, the state will reflect the update result immediately. For OPENED orders, monitor webhooks for the asynchronous outcome.


Input: OrderInput ​

The same OrderInput type used in orderCreate. Provide the id field (or externalReference) to target the order to update, and set only the fields you want to change.

FieldTypeRequiredDescription
idString✅*Internal order UUID — required unless using externalReference
organizationIdString❌Organization UUID
externalReferenceString❌*Used as lookup key if id is not provided
invoiceNumberString❌Invoice number
typeOrderTypeEnum❌B2C or B2B
dispatchingTypeOrderDispatchingTypeEnum❌AUTOMATIC or MANUAL
priorityPriorityEnum❌LOW, NORMAL, or HIGH
inventoryPolicyInventoryPolicyEnum❌DENY, ALLOW, SKIP, or ADJUST
totalFloat❌Order total excluding tax
totalTaxInclusiveFloat❌Order total including tax
totalShippingFloat❌Shipping cost
currencyString❌ISO 4217 currency code
issuedAtDateTime❌Order issue date
deliveryDeliveryInput❌Updated delivery address and contact
lines[OrderLineInput!]❌Updated order lines
commentString❌Order comment

*You must provide either id or externalReference to identify the order.


Example Variables ​

json
{
  "input": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "priority": "HIGH",
    "comment": "Urgent — customer VIP",
    "delivery": {
      "type": "PERSON",
      "fullname": "Jane Doe",
      "email": "jane.doe@example.com",
      "address": "456 Rue de Rivoli",
      "zipcode": "75004",
      "city": "Paris",
      "country": "FR",
      "phone": "+33698765432"
    }
  }
}

Example Response ​

json
{
  "data": {
    "orderUpdate": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "type": "ORDER_UPDATE",
      "state": "ACCEPTED",
      "message": "Order updated successfully"
    }
  }
}

Code Examples ​

bash
curl -X POST https://api-v3.happycolis.com/graphql \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
    "query": "mutation OrderUpdate($input: OrderInput!) { orderUpdate(input: $input) { id type state message } }",
    "variables": {
      "input": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "priority": "HIGH",
        "comment": "Urgent — customer VIP"
      }
    }
  }'
js
const mutation = `
  mutation OrderUpdate($input: OrderInput!) {
    orderUpdate(input: $input) {
      id
      type
      state
      message
    }
  }
`;

const response = await fetch('https://api-v3.happycolis.com/graphql', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${process.env.ACCESS_TOKEN}`,
  },
  body: JSON.stringify({
    query: mutation,
    variables: {
      input: {
        id: '550e8400-e29b-41d4-a716-446655440000',
        priority: 'HIGH',
        comment: 'Urgent — customer VIP',
      },
    },
  }),
});

const { data } = await response.json();
console.log(data.orderUpdate);
python
import os
import requests

mutation = """
mutation OrderUpdate($input: OrderInput!) {
  orderUpdate(input: $input) {
    id
    type
    state
    message
  }
}
"""

response = requests.post(
    'https://api-v3.happycolis.com/graphql',
    headers={'Authorization': f'Bearer {os.environ["ACCESS_TOKEN"]}'},
    json={
        'query': mutation,
        'variables': {
            'input': {
                'id': '550e8400-e29b-41d4-a716-446655440000',
                'priority': 'HIGH',
                'comment': 'Urgent — customer VIP',
            }
        },
    },
)

data = response.json()['data']
print(data['orderUpdate'])
php
<?php
$mutation = <<<'GQL'
mutation OrderUpdate($input: OrderInput!) {
  orderUpdate(input: $input) {
    id
    type
    state
    message
  }
}
GQL;

$ch = curl_init('https://api-v3.happycolis.com/graphql');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_POSTFIELDS     => json_encode([
        'query'     => $mutation,
        'variables' => [
            'input' => [
                'id'       => '550e8400-e29b-41d4-a716-446655440000',
                'priority' => 'HIGH',
                'comment'  => 'Urgent — customer VIP',
            ],
        ],
    ]),
    CURLOPT_HTTPHEADER     => [
        'Content-Type: application/json',
        'Authorization: Bearer ' . getenv('ACCESS_TOKEN'),
    ],
]);

$result = json_decode(curl_exec($ch), true);
curl_close($ch);

print_r($result['data']['orderUpdate']);
go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"net/http"
	"os"
)

func main() {
	mutation := `
		mutation OrderUpdate($input: OrderInput!) {
			orderUpdate(input: $input) {
				id
				type
				state
				message
			}
		}`

	body, _ := json.Marshal(map[string]any{
		"query": mutation,
		"variables": map[string]any{
			"input": map[string]any{
				"id":       "550e8400-e29b-41d4-a716-446655440000",
				"priority": "HIGH",
				"comment":  "Urgent — customer VIP",
			},
		},
	})

	req, _ := http.NewRequest("POST", "https://api-v3.happycolis.com/graphql", bytes.NewBuffer(body))
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("Authorization", "Bearer "+os.Getenv("ACCESS_TOKEN"))

	resp, _ := http.DefaultClient.Do(req)
	defer resp.Body.Close()

	var result map[string]any
	json.NewDecoder(resp.Body).Decode(&result)
	fmt.Println(result["data"])
}

HappyColis API Documentation