Skip to content

transferOrderCreate ​

Creates a new transfer order in DRAFT state. A transfer order represents an incoming stock replenishment from a supplier to a fulfillment location.

Required scope: create_transfer_orders


Mutation ​

graphql
mutation TransferOrderCreate($input: TransferOrderInput!) {
  transferOrderCreate(input: $input) {
    id
    reference
    orderNumber
    state
    externalReference
    expectedDate
    containerNumber
    containerType
    lines {
      id
      sku
      reference
      expectedQuantity
    }
    createdAt
  }
}

Input: TransferOrderInput ​

FieldTypeRequiredDescription
organizationIdString❌Organization UUID the transfer order belongs to
locationIdString✅Destination fulfillment location UUID
referenceString✅Internal reference for the transfer
supplierIdString❌Supplier UUID
externalReferenceString❌External system reference
containerNumberInt✅Number of containers
containerTypeTransferOrderContainerTypeEnum✅BOX, PALLET, or CONTAINER
expectedDateDateTime✅Expected delivery date at the warehouse
organizationAcronymString✅Organization short code used for order number generation
lines[TransferOrderLineInput!]✅Transfer order lines — at least one required
shippingDateDateTime❌Date the shipment leaves the supplier
carrierString❌Carrier name
trackingString❌Tracking number
commentString❌Free-text comment visible to warehouse operators
issuedAtDateTime❌Date the transfer order was issued in your system
emergencyBoolean❌Emergency flag — prioritises reception at the warehouse

TransferOrderLineInput ​

FieldTypeRequiredDescription
stockReferenceIdString❌Stock reference UUID
skuString✅Stock-Keeping Unit identifier
referenceString✅Product reference or label
limitUsageDateString❌Expiry or use-by date
batchNumberString❌Batch or lot number
expectedQuantityInt✅Expected quantity to receive
receivedQuantityInt❌Received quantity (typically omitted on creation)
restockedQuantityInt❌Restocked quantity (typically omitted on creation)
garbageQuantityInt❌Garbage or damaged quantity (typically omitted on creation)
metaJSON❌Additional metadata as a JSON object

Example Variables ​

json
{
  "input": {
    "organizationId": "org-uuid-001",
    "locationId": "loc-uuid-001",
    "reference": "TO-2024-001",
    "supplierId": "supplier-uuid-001",
    "externalReference": "ERP-TRANSFER-789",
    "containerNumber": 3,
    "containerType": "BOX",
    "expectedDate": "2024-02-15T08:00:00Z",
    "organizationAcronym": "ACME",
    "shippingDate": "2024-02-12T10:00:00Z",
    "carrier": "DHL Express",
    "tracking": "1Z999AA10123456784",
    "comment": "Fragile items — handle with care",
    "emergency": false,
    "lines": [
      {
        "sku": "WIDGET-A-100",
        "reference": "Widget Alpha",
        "expectedQuantity": 500,
        "batchNumber": "BATCH-2024-01"
      },
      {
        "sku": "GADGET-B-200",
        "reference": "Gadget Beta",
        "expectedQuantity": 250,
        "limitUsageDate": "2025-06-30"
      }
    ]
  }
}

Example Response ​

json
{
  "data": {
    "transferOrderCreate": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "reference": "TO-2024-001",
      "orderNumber": "ACME-TO-000042",
      "state": "DRAFT",
      "externalReference": "ERP-TRANSFER-789",
      "expectedDate": "2024-02-15T08:00:00.000Z",
      "containerNumber": "3",
      "containerType": "BOX",
      "lines": [
        {
          "id": "line-uuid-001",
          "sku": "WIDGET-A-100",
          "reference": "Widget Alpha",
          "expectedQuantity": 500
        },
        {
          "id": "line-uuid-002",
          "sku": "GADGET-B-200",
          "reference": "Gadget Beta",
          "expectedQuantity": 250
        }
      ],
      "createdAt": "2024-02-10T09:00:00.000Z"
    }
  }
}

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 TransferOrderCreate($input: TransferOrderInput!) { transferOrderCreate(input: $input) { id reference orderNumber state externalReference expectedDate containerType lines { id sku reference expectedQuantity } createdAt } }",
    "variables": {
      "input": {
        "organizationId": "org-uuid-001",
        "locationId": "loc-uuid-001",
        "reference": "TO-2024-001",
        "containerNumber": 3,
        "containerType": "BOX",
        "expectedDate": "2024-02-15T08:00:00Z",
        "organizationAcronym": "ACME",
        "lines": [
          {
            "sku": "WIDGET-A-100",
            "reference": "Widget Alpha",
            "expectedQuantity": 500,
            "batchNumber": "BATCH-2024-01"
          }
        ]
      }
    }
  }'
js
const mutation = `
  mutation TransferOrderCreate($input: TransferOrderInput!) {
    transferOrderCreate(input: $input) {
      id
      reference
      orderNumber
      state
      externalReference
      expectedDate
      containerType
      lines {
        id
        sku
        reference
        expectedQuantity
      }
      createdAt
    }
  }
`;

const variables = {
  input: {
    organizationId: 'org-uuid-001',
    locationId: 'loc-uuid-001',
    reference: 'TO-2024-001',
    supplierId: 'supplier-uuid-001',
    externalReference: 'ERP-TRANSFER-789',
    containerNumber: 3,
    containerType: 'BOX',
    expectedDate: '2024-02-15T08:00:00Z',
    organizationAcronym: 'ACME',
    shippingDate: '2024-02-12T10:00:00Z',
    carrier: 'DHL Express',
    tracking: '1Z999AA10123456784',
    comment: 'Fragile items — handle with care',
    emergency: false,
    lines: [
      {
        sku: 'WIDGET-A-100',
        reference: 'Widget Alpha',
        expectedQuantity: 500,
        batchNumber: 'BATCH-2024-01',
      },
      {
        sku: 'GADGET-B-200',
        reference: 'Gadget Beta',
        expectedQuantity: 250,
        limitUsageDate: '2025-06-30',
      },
    ],
  },
};

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 }),
});

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

mutation = """
mutation TransferOrderCreate($input: TransferOrderInput!) {
  transferOrderCreate(input: $input) {
    id
    reference
    orderNumber
    state
    externalReference
    expectedDate
    containerType
    lines {
      id
      sku
      reference
      expectedQuantity
    }
    createdAt
  }
}
"""

variables = {
    "input": {
        "organizationId": "org-uuid-001",
        "locationId": "loc-uuid-001",
        "reference": "TO-2024-001",
        "supplierId": "supplier-uuid-001",
        "externalReference": "ERP-TRANSFER-789",
        "containerNumber": 3,
        "containerType": "BOX",
        "expectedDate": "2024-02-15T08:00:00Z",
        "organizationAcronym": "ACME",
        "shippingDate": "2024-02-12T10:00:00Z",
        "carrier": "DHL Express",
        "tracking": "1Z999AA10123456784",
        "comment": "Fragile items — handle with care",
        "emergency": False,
        "lines": [
            {
                "sku": "WIDGET-A-100",
                "reference": "Widget Alpha",
                "expectedQuantity": 500,
                "batchNumber": "BATCH-2024-01",
            },
            {
                "sku": "GADGET-B-200",
                "reference": "Gadget Beta",
                "expectedQuantity": 250,
                "limitUsageDate": "2025-06-30",
            },
        ],
    }
}

response = requests.post(
    'https://api-v3.happycolis.com/graphql',
    headers={'Authorization': f'Bearer {os.environ["ACCESS_TOKEN"]}'},
    json={'query': mutation, 'variables': variables},
)

data = response.json()['data']
print(data['transferOrderCreate'])
php
<?php
$mutation = <<<'GQL'
mutation TransferOrderCreate($input: TransferOrderInput!) {
  transferOrderCreate(input: $input) {
    id
    reference
    orderNumber
    state
    externalReference
    expectedDate
    containerType
    lines {
      id
      sku
      reference
      expectedQuantity
    }
    createdAt
  }
}
GQL;

$variables = [
    'input' => [
        'organizationId'      => 'org-uuid-001',
        'locationId'          => 'loc-uuid-001',
        'reference'           => 'TO-2024-001',
        'supplierId'          => 'supplier-uuid-001',
        'externalReference'   => 'ERP-TRANSFER-789',
        'containerNumber'     => 3,
        'containerType'       => 'BOX',
        'expectedDate'        => '2024-02-15T08:00:00Z',
        'organizationAcronym' => 'ACME',
        'shippingDate'        => '2024-02-12T10:00:00Z',
        'carrier'             => 'DHL Express',
        'tracking'            => '1Z999AA10123456784',
        'comment'             => 'Fragile items — handle with care',
        'emergency'           => false,
        'lines' => [
            [
                'sku'              => 'WIDGET-A-100',
                'reference'        => 'Widget Alpha',
                'expectedQuantity' => 500,
                'batchNumber'      => 'BATCH-2024-01',
            ],
            [
                'sku'              => 'GADGET-B-200',
                'reference'        => 'Gadget Beta',
                'expectedQuantity' => 250,
                'limitUsageDate'   => '2025-06-30',
            ],
        ],
    ],
];

$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' => $variables]),
    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']['transferOrderCreate']);
go
package main

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

func main() {
	mutation := `
		mutation TransferOrderCreate($input: TransferOrderInput!) {
			transferOrderCreate(input: $input) {
				id
				reference
				orderNumber
				state
				externalReference
				expectedDate
				containerType
				lines {
					id
					sku
					reference
					expectedQuantity
				}
				createdAt
			}
		}`

	variables := map[string]any{
		"input": map[string]any{
			"organizationId":      "org-uuid-001",
			"locationId":          "loc-uuid-001",
			"reference":           "TO-2024-001",
			"supplierId":          "supplier-uuid-001",
			"externalReference":   "ERP-TRANSFER-789",
			"containerNumber":     3,
			"containerType":       "BOX",
			"expectedDate":        "2024-02-15T08:00:00Z",
			"organizationAcronym": "ACME",
			"shippingDate":        "2024-02-12T10:00:00Z",
			"carrier":             "DHL Express",
			"tracking":            "1Z999AA10123456784",
			"comment":             "Fragile items — handle with care",
			"emergency":           false,
			"lines": []map[string]any{
				{
					"sku":              "WIDGET-A-100",
					"reference":        "Widget Alpha",
					"expectedQuantity": 500,
					"batchNumber":      "BATCH-2024-01",
				},
				{
					"sku":              "GADGET-B-200",
					"reference":        "Gadget Beta",
					"expectedQuantity": 250,
					"limitUsageDate":   "2025-06-30",
				},
			},
		},
	}

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

	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