Skip to content

transferOrderUpdate

Updates an existing transfer order. The transfer order must be in DRAFT state to be updated.

Provide the id field in the input to identify the transfer order, and set only the fields you want to change.

Required scope: edit_transfer_orders


Mutation

graphql
mutation TransferOrderUpdate($input: TransferOrderInput!) {
  transferOrderUpdate(input: $input) {
    id
    fulfillmentOrderId
    type
    state
    date
  }
}

Return type: FulfillmentActionType

FieldDescription
idUnique identifier of this update action
fulfillmentOrderIdThe transfer order UUID
typeAction type — UPDATE for this mutation
stateProcessing state of the action (ACCEPTED, REJECTED)
dateTimestamp of the action

Input: TransferOrderInput

The same TransferOrderInput type used in transferOrderCreate. Provide the id field to target the transfer order to update, and set only the fields you want to change.

FieldTypeRequiredDescription
idStringInternal transfer order UUID to update
organizationIdStringOrganization UUID
locationIdStringDestination fulfillment location UUID
referenceStringInternal reference for the transfer
supplierIdStringSupplier UUID
externalReferenceStringExternal system reference
containerNumberIntNumber of containers
containerTypeTransferOrderContainerTypeEnumBOX, PALLET, or CONTAINER
expectedDateDateTimeExpected delivery date at the warehouse
organizationAcronymStringOrganization short code
lines[TransferOrderLineInput!]Updated transfer order lines
shippingDateDateTimeShipping date
carrierStringCarrier name
trackingStringTracking number
commentStringFree-text comment
issuedAtDateTimeIssue date
emergencyBooleanEmergency flag

TransferOrderLineInput

FieldTypeRequiredDescription
idStringLine ID — required when updating an existing line
stockReferenceIdStringStock reference UUID
skuStringSKU identifier
referenceStringProduct reference or label
limitUsageDateStringExpiry or use-by date
batchNumberStringBatch or lot number
expectedQuantityIntExpected quantity to receive
receivedQuantityIntReceived quantity
restockedQuantityIntRestocked quantity
garbageQuantityIntGarbage or damaged quantity
metaJSONAdditional metadata

Example Variables

json
{
  "input": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "expectedDate": "2024-02-20T08:00:00Z",
    "containerNumber": 5,
    "carrier": "FedEx",
    "tracking": "794644790100",
    "comment": "Updated delivery — new carrier",
    "lines": [
      {
        "id": "line-uuid-001",
        "sku": "WIDGET-A-100",
        "reference": "Widget Alpha",
        "expectedQuantity": 750
      },
      {
        "sku": "GADGET-C-300",
        "reference": "Gadget Gamma",
        "expectedQuantity": 100
      }
    ]
  }
}

Example Response

json
{
  "data": {
    "transferOrderUpdate": {
      "id": "action-uuid-001",
      "fulfillmentOrderId": "550e8400-e29b-41d4-a716-446655440000",
      "type": "UPDATE",
      "state": "ACCEPTED",
      "date": "2024-02-11T10: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 TransferOrderUpdate($input: TransferOrderInput!) { transferOrderUpdate(input: $input) { id fulfillmentOrderId type state date } }",
    "variables": {
      "input": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "expectedDate": "2024-02-20T08:00:00Z",
        "containerNumber": 5,
        "comment": "Updated delivery — new carrier"
      }
    }
  }'
js
const mutation = `
  mutation TransferOrderUpdate($input: TransferOrderInput!) {
    transferOrderUpdate(input: $input) {
      id
      fulfillmentOrderId
      type
      state
      date
    }
  }
`;

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',
        expectedDate: '2024-02-20T08:00:00Z',
        containerNumber: 5,
        comment: 'Updated delivery — new carrier',
      },
    },
  }),
});

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

mutation = """
mutation TransferOrderUpdate($input: TransferOrderInput!) {
  transferOrderUpdate(input: $input) {
    id
    fulfillmentOrderId
    type
    state
    date
  }
}
"""

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',
                'expectedDate': '2024-02-20T08:00:00Z',
                'containerNumber': 5,
                'comment': 'Updated delivery — new carrier',
            }
        },
    },
)

data = response.json()['data']
print(data['transferOrderUpdate'])
php
<?php
$mutation = <<<'GQL'
mutation TransferOrderUpdate($input: TransferOrderInput!) {
  transferOrderUpdate(input: $input) {
    id
    fulfillmentOrderId
    type
    state
    date
  }
}
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',
                'expectedDate'    => '2024-02-20T08:00:00Z',
                'containerNumber' => 5,
                'comment'         => 'Updated delivery — new carrier',
            ],
        ],
    ]),
    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']['transferOrderUpdate']);
go
package main

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

func main() {
	mutation := `
		mutation TransferOrderUpdate($input: TransferOrderInput!) {
			transferOrderUpdate(input: $input) {
				id
				fulfillmentOrderId
				type
				state
				date
			}
		}`

	body, _ := json.Marshal(map[string]any{
		"query": mutation,
		"variables": map[string]any{
			"input": map[string]any{
				"id":              "550e8400-e29b-41d4-a716-446655440000",
				"expectedDate":    "2024-02-20T08:00:00Z",
				"containerNumber": 5,
				"comment":         "Updated delivery — new carrier",
			},
		},
	})

	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