Skip to content

orderRequestFulfillment ​

Sends the order to the warehouse for fulfillment. If the order is still in DRAFT state, this mutation also opens it first (equivalent to calling orderOpen then orderRequestFulfillment in a single step).

Ensure payment is confirmed before calling this mutation. Once production starts at the warehouse, cancellation requests may be rejected.

Required scope: edit_orders


Mutations ​

orderRequestFulfillment ​

Sends the entire order to the warehouse.

graphql
mutation OrderRequestFulfillment($id: String!) {
  orderRequestFulfillment(id: $id) {
    id
    type
    state
    message
  }
}

orderOpenLines ​

Opens only a subset of order lines. Useful for partial fulfillment when some items are available and others are on back-order.

graphql
mutation OrderOpenLines($input: OrderOpenLinesInput!) {
  orderOpenLines(input: $input) {
    id
    type
    state
    message
  }
}

orderRequestFulfillmentLines ​

Sends only a subset of order lines to the warehouse for fulfillment.

graphql
mutation OrderRequestFulfillmentLines($input: OrderOpenLinesInput!) {
  orderRequestFulfillmentLines(input: $input) {
    id
    type
    state
    message
  }
}

Return type: DispatchableRequest ​

All three mutations return a DispatchableRequest. The actual fulfillment is processed asynchronously — use webhooks to receive delivery_order/accepted or delivery_order/rejected events.

FieldDescription
idUnique identifier of this fulfillment request
typeRequest type — REQUEST_FULFILLMENT for these mutations
stateProcessing state of the request
messageHuman-readable status message

Input: OrderOpenLinesInput ​

Used by orderOpenLines and orderRequestFulfillmentLines for partial fulfillment:

FieldTypeRequiredDescription
orderIdString✅Internal UUID of the order
lineIds[String!]✅UUIDs of the specific order lines to open or fulfil

Arguments ​

orderRequestFulfillment ​

ArgumentTypeRequiredDescription
idString✅Internal UUID of the order to fulfil

Fulfillment flow ​


Example Variables ​

Full order fulfillment ​

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

Partial fulfillment ​

json
{
  "input": {
    "orderId": "550e8400-e29b-41d4-a716-446655440000",
    "lineIds": [
      "line-uuid-001",
      "line-uuid-002"
    ]
  }
}

Example Response ​

json
{
  "data": {
    "orderRequestFulfillment": {
      "id": "req-uuid-fulfillment-001",
      "type": "REQUEST_FULFILLMENT",
      "state": "PENDING",
      "message": "Fulfillment request submitted to warehouse"
    }
  }
}

Code Examples ​

bash
# Full order fulfillment
curl -X POST https://api-v3.happycolis.com/graphql \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
    "query": "mutation OrderRequestFulfillment($id: String!) { orderRequestFulfillment(id: $id) { id type state message } }",
    "variables": {
      "id": "550e8400-e29b-41d4-a716-446655440000"
    }
  }'

# Partial fulfillment
curl -X POST https://api-v3.happycolis.com/graphql \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
    "query": "mutation OrderRequestFulfillmentLines($input: OrderOpenLinesInput!) { orderRequestFulfillmentLines(input: $input) { id type state message } }",
    "variables": {
      "input": {
        "orderId": "550e8400-e29b-41d4-a716-446655440000",
        "lineIds": ["line-uuid-001", "line-uuid-002"]
      }
    }
  }'
js
// Full order fulfillment
const fullFulfillmentMutation = `
  mutation OrderRequestFulfillment($id: String!) {
    orderRequestFulfillment(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: fullFulfillmentMutation,
    variables: { id: '550e8400-e29b-41d4-a716-446655440000' },
  }),
});

const { data } = await response.json();
console.log(data.orderRequestFulfillment);

// Partial fulfillment
const partialFulfillmentMutation = `
  mutation OrderRequestFulfillmentLines($input: OrderOpenLinesInput!) {
    orderRequestFulfillmentLines(input: $input) {
      id
      type
      state
      message
    }
  }
`;

const partialResponse = 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: partialFulfillmentMutation,
    variables: {
      input: {
        orderId: '550e8400-e29b-41d4-a716-446655440000',
        lineIds: ['line-uuid-001', 'line-uuid-002'],
      },
    },
  }),
});

const { data: partialData } = await partialResponse.json();
console.log(partialData.orderRequestFulfillmentLines);
python
import os
import requests

# Full order fulfillment
mutation = """
mutation OrderRequestFulfillment($id: String!) {
  orderRequestFulfillment(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'},
    },
)
print(response.json()['data']['orderRequestFulfillment'])

# Partial fulfillment
partial_mutation = """
mutation OrderRequestFulfillmentLines($input: OrderOpenLinesInput!) {
  orderRequestFulfillmentLines(input: $input) {
    id
    type
    state
    message
  }
}
"""

partial_response = requests.post(
    'https://api-v3.happycolis.com/graphql',
    headers={'Authorization': f'Bearer {os.environ["ACCESS_TOKEN"]}'},
    json={
        'query': partial_mutation,
        'variables': {
            'input': {
                'orderId': '550e8400-e29b-41d4-a716-446655440000',
                'lineIds': ['line-uuid-001', 'line-uuid-002'],
            }
        },
    },
)
print(partial_response.json()['data']['orderRequestFulfillmentLines'])
php
<?php
// Full order fulfillment
$mutation = <<<'GQL'
mutation OrderRequestFulfillment($id: String!) {
  orderRequestFulfillment(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']['orderRequestFulfillment']);

// Partial fulfillment
$partialMutation = <<<'GQL'
mutation OrderRequestFulfillmentLines($input: OrderOpenLinesInput!) {
  orderRequestFulfillmentLines(input: $input) {
    id
    type
    state
    message
  }
}
GQL;

$ch2 = curl_init('https://api-v3.happycolis.com/graphql');
curl_setopt_array($ch2, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_POSTFIELDS     => json_encode([
        'query'     => $partialMutation,
        'variables' => [
            'input' => [
                'orderId' => '550e8400-e29b-41d4-a716-446655440000',
                'lineIds' => ['line-uuid-001', 'line-uuid-002'],
            ],
        ],
    ]),
    CURLOPT_HTTPHEADER     => [
        'Content-Type: application/json',
        'Authorization: Bearer ' . getenv('ACCESS_TOKEN'),
    ],
]);
$partialResult = json_decode(curl_exec($ch2), true);
curl_close($ch2);
print_r($partialResult['data']['orderRequestFulfillmentLines']);
go
package main

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

func requestFulfillment(id string) {
	mutation := `
		mutation OrderRequestFulfillment($id: String!) {
			orderRequestFulfillment(id: $id) {
				id
				type
				state
				message
			}
		}`

	body, _ := json.Marshal(map[string]any{
		"query":     mutation,
		"variables": map[string]any{"id": id},
	})

	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"])
}

func requestFulfillmentLines(orderId string, lineIds []string) {
	mutation := `
		mutation OrderRequestFulfillmentLines($input: OrderOpenLinesInput!) {
			orderRequestFulfillmentLines(input: $input) {
				id
				type
				state
				message
			}
		}`

	body, _ := json.Marshal(map[string]any{
		"query": mutation,
		"variables": map[string]any{
			"input": map[string]any{
				"orderId": orderId,
				"lineIds": lineIds,
			},
		},
	})

	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"])
}

func main() {
	// Full fulfillment
	requestFulfillment("550e8400-e29b-41d4-a716-446655440000")

	// Partial fulfillment
	requestFulfillmentLines(
		"550e8400-e29b-41d4-a716-446655440000",
		[]string{"line-uuid-001", "line-uuid-002"},
	)
}

HappyColis API Documentation