transferOrderCancel
Cancels a transfer order.
- DRAFT transfer orders: cancelled immediately. The transfer order transitions to
CANCELED. - OPENED transfer orders: a cancellation request is sent to the fulfillment service. The transfer order remains
OPENEDuntil the warehouse confirms or rejects the cancellation.
If cancellation is rejected by the fulfillment service (e.g. stock has already been received), the transfer order remains
OPENED. You will receive atransfer-order/cancel-rejectedwebhook event.
Required scope: edit_transfer_orders
Mutation
graphql
mutation TransferOrderCancel($id: String!) {
transferOrderCancel(id: $id) {
id
fulfillmentOrderId
type
state
date
}
}Return type: FulfillmentActionType
| Field | Description |
|---|---|
id | Unique identifier of this cancellation action |
fulfillmentOrderId | The transfer order UUID |
type | Action type — CANCEL for this mutation |
state | Processing state of the action (ACCEPTED, REJECTED) |
date | Timestamp of the action |
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
id | String | ✅ | Internal UUID of the transfer order to cancel |
Cancellation behaviour by transfer order state
| Transfer Order State | Behaviour |
|---|---|
DRAFT | Immediately cancelled. Terminal. |
OPENED — no warehouse reception yet | Cancellation request sent to fulfillment service; typically accepted. |
OPENED — warehouse has started receiving | Cancellation request sent; may be rejected if stock reception has begun. |
COMPLETED | Cannot be cancelled — already in terminal state. |
CANCELED | Already cancelled — no action taken. |
Example Variables
json
{
"id": "550e8400-e29b-41d4-a716-446655440000"
}Example Response
json
{
"data": {
"transferOrderCancel": {
"id": "action-uuid-cancel-001",
"fulfillmentOrderId": "550e8400-e29b-41d4-a716-446655440000",
"type": "CANCEL",
"state": "ACCEPTED",
"date": "2024-02-11T16: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 TransferOrderCancel($id: String!) { transferOrderCancel(id: $id) { id fulfillmentOrderId type state date } }",
"variables": {
"id": "550e8400-e29b-41d4-a716-446655440000"
}
}'js
const mutation = `
mutation TransferOrderCancel($id: String!) {
transferOrderCancel(id: $id) {
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: { id: '550e8400-e29b-41d4-a716-446655440000' },
}),
});
const { data } = await response.json();
console.log(data.transferOrderCancel);python
import os
import requests
mutation = """
mutation TransferOrderCancel($id: String!) {
transferOrderCancel(id: $id) {
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': {'id': '550e8400-e29b-41d4-a716-446655440000'},
},
)
data = response.json()['data']
print(data['transferOrderCancel'])php
<?php
$mutation = <<<'GQL'
mutation TransferOrderCancel($id: String!) {
transferOrderCancel(id: $id) {
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' => ['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']['transferOrderCancel']);go
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
mutation := `
mutation TransferOrderCancel($id: String!) {
transferOrderCancel(id: $id) {
id
fulfillmentOrderId
type
state
date
}
}`
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"])
}