Skip to content

orderOpen

Submits a DRAFT order for fulfillment. The API transitions the order to OPENED state and, for AUTOMATIC dispatching, computes fulfillment locations and creates the necessary DeliveryOrders based on available stock.

Nothing is sent to the warehouse until orderRequestFulfillment is called. Use this two-step flow when you need to inspect DeliveryOrders (e.g. check split shipments or locations) before committing to fulfillment.

Required scope: edit_orders


Mutation

graphql
mutation OrderOpen($id: String!) {
  orderOpen(id: $id) {
    id
    type
    state
    message
  }
}

Return type: DispatchableRequest

orderOpen is processed asynchronously. The returned DispatchableRequest represents the in-flight request, not the final order state. Use webhooks to receive delivery_order/created events once DeliveryOrders have been generated.

FieldDescription
idUnique identifier of this dispatching request
typeRequest type — OPEN for this mutation
stateProcessing state of the request (e.g. PENDING, ACCEPTED, REJECTED)
messageHuman-readable status message

Inventory policy behaviour at open time

The order's inventoryPolicy controls what happens when stock is insufficient:

PolicyBehaviour
DENYThe open request is rejected. The order stays in DRAFT.
ALLOWThe order opens regardless of stock levels.
SKIPLines without sufficient stock are skipped; the rest open normally.
ADJUSTLine quantities are reduced to match available stock before opening.

Arguments

ArgumentTypeRequiredDescription
idStringInternal UUID of the order to open

Example Variables

json
{
  "id": "550e8400-e29b-41d4-a716-446655440000"
}

Example Response

json
{
  "data": {
    "orderOpen": {
      "id": "req-uuid-open-001",
      "type": "OPEN",
      "state": "PENDING",
      "message": "Order open request accepted, processing asynchronously"
    }
  }
}

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 OrderOpen($id: String!) { orderOpen(id: $id) { id type state message } }",
    "variables": {
      "id": "550e8400-e29b-41d4-a716-446655440000"
    }
  }'
js
const mutation = `
  mutation OrderOpen($id: String!) {
    orderOpen(id: $id) {
      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: { id: '550e8400-e29b-41d4-a716-446655440000' },
  }),
});

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

mutation = """
mutation OrderOpen($id: String!) {
  orderOpen(id: $id) {
    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': {'id': '550e8400-e29b-41d4-a716-446655440000'},
    },
)

data = response.json()['data']
print(data['orderOpen'])
php
<?php
$mutation = <<<'GQL'
mutation OrderOpen($id: String!) {
  orderOpen(id: $id) {
    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' => ['id' => '550e8400-e29b-41d4-a716-446655440000'],
    ]),
    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']['orderOpen']);
go
package main

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

func main() {
	mutation := `
		mutation OrderOpen($id: String!) {
			orderOpen(id: $id) {
				id
				type
				state
				message
			}
		}`

	body, _ := json.Marshal(map[string]any{
		"query":     mutation,
		"variables": map[string]any{"id": "550e8400-e29b-41d4-a716-446655440000"},
	})

	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