API reference
Orders
On this page
Read orders and move them along: change the status, add shipment details and add internal notes. The rules, the messages to the customer, the stock effects and the webhooks are exactly those of the admin. Every order says where it came from (the read-only source), and the full shape (?expand=full) also carries the read-only gift fields (gift, gift_message and packaging). Payment status, amounts, the source and the gift details can never be changed, and orders are never refunded or deleted through the API.
Order numbers and the order prefix#
An order number is text: the store's order prefix, the date as year, month and day (yymmdd), a dash and four letters or digits, for example GK-261008-7WNM. You put it in the address of the order calls, for example /api/v1/orders/GK-261008-7WNM, and you read it in the number field.
- The prefix is a store setting (Settings > Store settings > Company & invoicing, the Order numbers card): 2 to 6 letters or digits followed by a dash, for example
GK-orSHOP1-. Small letters are changed to capitals. A new store starts withGK-. Only a Super Admin can change it. - A new prefix applies to new orders only. Every order keeps the number it was given, and orders with an earlier prefix are still found by their number, in the API and in webhooks too.
- Always treat the order number as text. Do not assume it starts with
GK-, do not cut the prefix off, do not turn it into a number, and do not assume that all the orders of a store have the same prefix.
The order object#
The fields marked expand=full are only included when you add ?expand=full to the read calls. Answers to writes and webhooks always include them.
| Field | Type | Included | Meaning |
|---|---|---|---|
id | integer | Always | The order id. |
number | string | Always | The order number: the store's order prefix, the date as yymmdd, a dash and four letters or digits. It is text, and it is what you put in the address of an order call. |
status | string | Always | placed, packed, shipped, out_for_delivery, delivered or cancelled. |
payment_method | string | Always | How the order is paid, for example cod for cash on delivery. |
payment_status | string | Always | pending, awaiting, paid, failed, partially_refunded or refunded. It cannot be changed through the API. |
subtotal | integer | Always | Total of the item lines, in whole units of the store's currency. |
discount | integer | Always | Discount applied, in whole units of the store's currency. |
shipping | integer | Always | Shipping charge, in whole units of the store's currency. |
total | integer | Always | Amount to pay, in whole units of the store's currency. |
coupon | string or null | Always | The coupon code used, if any. |
customer | object | Always | The customer who placed the order. |
customer.name | string | Always | The customer's name. |
customer.email | string or null | Always | The customer's email address. |
customer.phone | string or null | Always | The customer's phone number. |
address | object | Always | The delivery address. |
address.line1 | string | Always | First address line. |
address.line2 | string or null | Always | Second address line. |
address.city | string or null | Always | City. |
address.state | string or null | Always | State. |
address.pincode | string | Always | Pincode. |
courier | string or null | Always | The courier, once shipment details are saved. |
awb | string or null | Always | The AWB (consignment) number. |
items | array | Always | The order lines. They cannot be changed through the API. |
items[].product_id | integer or null | Always | The product id. |
items[].name | string | Always | The product name when it was ordered. |
items[].variant | string | Always | The size label when it was ordered. |
items[].price | integer | Always | Price of one unit, in whole units of the store's currency. |
items[].qty | integer | Always | Units ordered. |
created_at | string | Always | When the order was placed (ISO 8601, with its UTC offset). |
source | string | Always | Where the order came from: website, phone, whatsapp, counter, marketplace or other. Read only: it cannot be changed through the API. An order placed at the online checkout is always website. |
tracking_url | string or null | expand=full | The tracking link. |
cancel_reason | string or null | expand=full | Why the order was cancelled. |
refund_status | string | expand=full | none when no refund is recorded. Other values describe the refund; order.refunded is sent when one is processed. |
refunded_amount | number | expand=full | Amount refunded, in the store's currency. 0 when nothing was refunded. |
updated_at | string | expand=full | When the order was last changed (ISO 8601, UTC). |
gift | boolean | expand=full | true when the shopper marked the order as a gift. Read only. |
gift_message | string or null | expand=full | The plain-text gift message the shopper wrote, or null. Read only. A webhook endpoint that is set not to include personal details always gets null here. |
packaging | object or null | expand=full | The gift packaging chosen, as it was when the order was placed. null when none was chosen. Read only. |
packaging.name | string | expand=full | The name of the packaging option. |
packaging.fee | integer | expand=full | The packaging fee, in whole units of the store's currency. It is already inside the order total. |
packaging.gst_rate | number or null | expand=full | The GST rate of the packaging fee, in percent. |
List orders#
GET/api/v1/ordersread:orders
Orders, newest first, with items, customer contact details and delivery address. Each order carries a read-only source (where it came from: website, phone, whatsapp, counter, marketplace or other). Otherwise the default answer is the one this API has always given; expand=full adds tracking_url, cancel_reason, refund_status, refunded_amount, updated_at, gift, gift_message and packaging.
Each order carries the read-only source: website, phone, whatsapp, counter, marketplace or other. An order that a staff member created for a customer is in the list like any other order. There is no filter by source: read the field.
The store may be set up to use any order prefix, so never rely on the first letters of number.
Query parameters
| Name | Type | Meaning |
|---|---|---|
status | string | placed, packed, shipped, out_for_delivery, delivered or cancelled. One of: placed, packed, shipped, out_for_delivery, delivered, cancelled |
payment_status | string | pending, awaiting, paid, failed, partially_refunded or refunded. |
after | string | Only orders placed at or after this date or time. |
expand | string | full: add tracking_url, cancel_reason, refund_status, refunded_amount, updated_at, gift, gift_message and packaging. One of: full |
limit | integer | Rows per page, 1 to 100 (default 25). per_page works too. |
page | integer | Page number, starting at 1. |
updated_since | string | Only rows changed at or after this time (ISO 8601, for example 2026-11-21T10:00:00Z, or a date). |
Example request
curl -s "https://yourstore.example.com/api/v1/orders?status=placed&limit=25" \
-H "Authorization: Bearer YOUR_API_KEY"<?php
$ch = curl_init('https://yourstore.example.com/api/v1/orders?status=placed&limit=25');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
],
]);
$response = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($status >= 400) {
// $response['error']['code'] and $response['error']['message'] say what to fix
}// Node.js 18 or newer (fetch is built in). Save as call.mjs and run: node call.mjs
const res = await fetch('https://yourstore.example.com/api/v1/orders?status=placed&limit=25', {
headers: {
Authorization: 'Bearer YOUR_API_KEY',
},
});
const json = await res.json();
if (!res.ok) {
// json.error.code and json.error.message say what to fix
}# Python 3 with the requests library (pip install requests)
import requests
res = requests.get(
"https://yourstore.example.com/api/v1/orders?status=placed&limit=25",
headers={"Authorization": "Bearer YOUR_API_KEY"},
timeout=30,
)
data = res.json()
if not res.ok:
# data["error"]["code"] and data["error"]["message"] say what to fix
print(data["error"])Example answer (200 OK)
{
"data": [
{
"id": 1024,
"number": "GK-261008-7WNM",
"status": "placed",
"payment_method": "cod",
"payment_status": "pending",
"subtotal": 1197,
"discount": 100,
"shipping": 60,
"total": 1217,
"coupon": "WELCOME10",
"customer": {
"name": "Sample Customer",
"email": "buyer@example.com",
"phone": "9000000000"
},
"address": {
"line1": "12 Sample Street",
"line2": null,
"city": "Sample City",
"state": "Sample State",
"pincode": "123456"
},
"courier": null,
"awb": null,
"items": [
{
"product_id": 7,
"name": "Sample Product",
"variant": "250 g",
"price": 399,
"qty": 3
}
],
"created_at": "2026-11-21T10:15:00+00:00",
"source": "website"
}
],
"meta": {
"page": 1,
"per_page": 25,
"total": 1,
"last_page": 1
},
"links": {
"first": "https://yourstore.example.com/api/v1/orders?page=1",
"last": "https://yourstore.example.com/api/v1/orders?page=1",
"prev": null,
"next": null
}
}Errors
| Status | Code | When |
|---|---|---|
| 401 | missing_api_key, invalid_api_key, revoked_api_key, expired_api_key | The key is missing, not valid, revoked or expired. |
| 403 | insufficient_scope | The key does not have the read:orders scope. error.required_scope names it. (api_key_disabled and ip_not_allowed also give 403.) |
| 422 | validation_failed | updated_since could not be read as a date or time. |
| 429 | rate_limited | More requests than the key's limit in a minute. Wait for Retry-After. |
Example error answer (403):
{
"error": {
"code": "insufficient_scope",
"message": "This API key does not have the \"read:orders\" scope. Add it to the key in the admin (API & webhooks > API keys), or use a key that has it.",
"required_scope": "read:orders"
}
}Get an order#
GET/api/v1/orders/{number}read:orders
One order by its order number (for example GK-261008-7WNM; it is text, a prefix, the date and four letters or digits). The order carries a read-only source (website, phone, whatsapp, counter, marketplace or other). Add expand=full for the extra fields, which include the read-only gift fields (gift, gift_message and packaging).
Put the order number in the address exactly as the store shows it. It is text.
Address parameters
| Name | Type | Meaning |
|---|---|---|
number | string | The order number, for example GK-261008-7WNM. The first letters are the store's order prefix (GK- by default). Use the number exactly as the store shows it. |
Query parameters
| Name | Type | Meaning |
|---|---|---|
expand | string | full: add tracking_url, cancel_reason, refund_status, refunded_amount, updated_at, gift, gift_message and packaging. One of: full |
Example request
curl -s "https://yourstore.example.com/api/v1/orders/GK-261008-7WNM?expand=full" \
-H "Authorization: Bearer YOUR_API_KEY"<?php
$ch = curl_init('https://yourstore.example.com/api/v1/orders/GK-261008-7WNM?expand=full');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
],
]);
$response = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($status >= 400) {
// $response['error']['code'] and $response['error']['message'] say what to fix
}// Node.js 18 or newer (fetch is built in). Save as call.mjs and run: node call.mjs
const res = await fetch('https://yourstore.example.com/api/v1/orders/GK-261008-7WNM?expand=full', {
headers: {
Authorization: 'Bearer YOUR_API_KEY',
},
});
const json = await res.json();
if (!res.ok) {
// json.error.code and json.error.message say what to fix
}# Python 3 with the requests library (pip install requests)
import requests
res = requests.get(
"https://yourstore.example.com/api/v1/orders/GK-261008-7WNM?expand=full",
headers={"Authorization": "Bearer YOUR_API_KEY"},
timeout=30,
)
data = res.json()
if not res.ok:
# data["error"]["code"] and data["error"]["message"] say what to fix
print(data["error"])Example answer (200 OK)
{
"data": {
"id": 1024,
"number": "GK-261008-7WNM",
"status": "placed",
"payment_method": "cod",
"payment_status": "pending",
"subtotal": 1197,
"discount": 100,
"shipping": 60,
"total": 1217,
"coupon": "WELCOME10",
"customer": {
"name": "Sample Customer",
"email": "buyer@example.com",
"phone": "9000000000"
},
"address": {
"line1": "12 Sample Street",
"line2": null,
"city": "Sample City",
"state": "Sample State",
"pincode": "123456"
},
"courier": null,
"awb": null,
"items": [
{
"product_id": 7,
"name": "Sample Product",
"variant": "250 g",
"price": 399,
"qty": 3
}
],
"created_at": "2026-11-21T10:15:00+00:00",
"source": "website"
},
"meta": {}
}Errors
| Status | Code | When |
|---|---|---|
| 401 | missing_api_key, invalid_api_key, revoked_api_key, expired_api_key | The key is missing, not valid, revoked or expired. |
| 403 | insufficient_scope | The key does not have the read:orders scope. error.required_scope names it. (api_key_disabled and ip_not_allowed also give 403.) |
| 404 | not_found | That order does not exist. |
| 429 | rate_limited | More requests than the key's limit in a minute. Wait for Retry-After. |
Example error answer (403):
{
"error": {
"code": "insufficient_scope",
"message": "This API key does not have the \"read:orders\" scope. Add it to the key in the admin (API & webhooks > API keys), or use a key that has it.",
"required_scope": "read:orders"
}
}Change an order's status#
PATCH/api/v1/orders/{number}write:orders
Moves the order to another status with the same rules as the admin: a cancelled order cannot move on, an online order must be paid before it is packed, shipped, out for delivery or delivered, and cancelling needs a reason (it gives the stock back). The customer messages (email, SMS / WhatsApp), the stock, the audit log and the webhooks are exactly those of the admin. Payment status and amounts cannot be changed.
Moving an order to cancelled needs a reason and gives the stock back. A cancelled order cannot move on.
Address parameters
| Name | Type | Meaning |
|---|---|---|
number | string | The order number, for example GK-261008-7WNM. The first letters are the store's order prefix (GK- by default). Use the number exactly as the store shows it. |
Request body (JSON)
| Field | Type | Required | Limits | Meaning |
|---|---|---|---|---|
status | string | Yes | The new status. One of: placed, packed, shipped, out_for_delivery, delivered, cancelledExample: packed | |
reason | string or null | No | at most 500 characters | Why the order is cancelled (required when status is cancelled). Example: Customer asked to cancel |
note | string or null | No | at most 2000 characters | An internal note saved with the change. Example: Packed by the warehouse system |
Any field not listed here is refused with 422. Send an Idempotency-Key header so a retry is safe (see Requests).
Example request
curl -s -X PATCH "https://yourstore.example.com/api/v1/orders/GK-261008-7WNM" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 6f1c0b3e-0d5a-4a52-9d5e-1f6c2a7b9e10" \
-d '{
"status": "packed",
"note": "Packed by the warehouse system"
}'<?php
$ch = curl_init('https://yourstore.example.com/api/v1/orders/GK-261008-7WNM');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json',
'Idempotency-Key: ' . bin2hex(random_bytes(16)),
],
CURLOPT_POSTFIELDS => json_encode([
'status' => 'packed',
'note' => 'Packed by the warehouse system',
]),
]);
$response = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($status >= 400) {
// $response['error']['code'] and $response['error']['message'] say what to fix
}// Node.js 18 or newer (fetch is built in). Save as call.mjs and run: node call.mjs
import { randomUUID } from 'node:crypto';
const res = await fetch('https://yourstore.example.com/api/v1/orders/GK-261008-7WNM', {
method: 'PATCH',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
'Idempotency-Key': randomUUID(),
},
body: JSON.stringify({
status: 'packed',
note: 'Packed by the warehouse system',
}),
});
const json = await res.json();
if (!res.ok) {
// json.error.code and json.error.message say what to fix
}# Python 3 with the requests library (pip install requests)
import uuid
import requests
res = requests.patch(
"https://yourstore.example.com/api/v1/orders/GK-261008-7WNM",
headers={"Authorization": "Bearer YOUR_API_KEY", "Idempotency-Key": str(uuid.uuid4())},
json={
"status": "packed",
"note": "Packed by the warehouse system",
},
timeout=30,
)
data = res.json()
if not res.ok:
# data["error"]["code"] and data["error"]["message"] say what to fix
print(data["error"])Example answer (200 OK)
{
"data": {
"id": 1024,
"number": "GK-261008-7WNM",
"status": "placed",
"payment_method": "cod",
"payment_status": "pending",
"subtotal": 1197,
"discount": 100,
"shipping": 60,
"total": 1217,
"coupon": "WELCOME10",
"customer": {
"name": "Sample Customer",
"email": "buyer@example.com",
"phone": "9000000000"
},
"address": {
"line1": "12 Sample Street",
"line2": null,
"city": "Sample City",
"state": "Sample State",
"pincode": "123456"
},
"courier": null,
"awb": null,
"items": [
{
"product_id": 7,
"name": "Sample Product",
"variant": "250 g",
"price": 399,
"qty": 3
}
],
"created_at": "2026-11-21T10:15:00+00:00",
"source": "website",
"tracking_url": null,
"cancel_reason": null,
"refund_status": "none",
"refunded_amount": 0,
"updated_at": "2026-11-21T10:15:00Z",
"gift": true,
"gift_message": "Happy celebrations! With best wishes.",
"packaging": {
"name": "Sample Packaging",
"fee": 60,
"gst_rate": 18
}
},
"meta": {}
}Errors
| Status | Code | When |
|---|---|---|
| 401 | missing_api_key, invalid_api_key, revoked_api_key, expired_api_key | The key is missing, not valid, revoked or expired. |
| 403 | insufficient_scope | The key does not have the write:orders scope. error.required_scope names it. (api_key_disabled and ip_not_allowed also give 403.) |
| 404 | not_found | That order does not exist. |
| 422 | validation_failed | A field is missing or wrong. error.fields says which and why. |
| 422 | transition_not_allowed | The order cannot move to that status (cancelled orders are final; online orders must be paid first). The message is the admin's. |
| 422 | order_not_cancellable | A delivered or already cancelled order cannot be cancelled. |
| 409 | idempotency_key_reuse, idempotency_in_progress | The Idempotency-Key was used for a different request, or the first request with it is still running. |
| 429 | rate_limited | More requests than the key's limit in a minute. Wait for Retry-After. |
Example error answer (422):
{
"error": {
"code": "validation_failed",
"message": "The request could not be accepted. See \"fields\" for what to fix.",
"fields": {
"status": [
"The status field is required."
]
}
}
}Add shipment details#
POST/api/v1/orders/{number}/shipmentwrite:orders
Saves the courier, AWB and tracking link, and moves a placed or packed order to shipped when that is allowed (an online order must be paid first). The "Shipped" message to the customer is sent as in the admin. If the tracking link is left out it is built from the courier and AWB when the courier is listed in Settings > Shipping. Calling it again on a shipped order only updates the details.
Moves a placed or packed order to shipped when that is allowed. Calling it again on a shipped order only updates the details.
Address parameters
| Name | Type | Meaning |
|---|---|---|
number | string | The order number, for example GK-261008-7WNM. The first letters are the store's order prefix (GK- by default). Use the number exactly as the store shows it. |
Request body (JSON)
| Field | Type | Required | Limits | Meaning |
|---|---|---|---|---|
courier | string | Yes | at most 100 characters | Courier name, for example Sample Courier. Example: Sample Courier |
awb | string | Yes | at most 100 characters | AWB / consignment number. Example: 38472910 |
tracking_url | string or null | No | at most 500 characters | Tracking link (an http or https address). Example: https://courier.example.com/track/38472910 |
Any field not listed here is refused with 422. Send an Idempotency-Key header so a retry is safe (see Requests).
Example request
curl -s -X POST "https://yourstore.example.com/api/v1/orders/GK-261008-7WNM/shipment" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 6f1c0b3e-0d5a-4a52-9d5e-1f6c2a7b9e10" \
-d '{
"courier": "Sample Courier",
"awb": "38472910"
}'<?php
$ch = curl_init('https://yourstore.example.com/api/v1/orders/GK-261008-7WNM/shipment');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json',
'Idempotency-Key: ' . bin2hex(random_bytes(16)),
],
CURLOPT_POSTFIELDS => json_encode([
'courier' => 'Sample Courier',
'awb' => '38472910',
]),
]);
$response = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($status >= 400) {
// $response['error']['code'] and $response['error']['message'] say what to fix
}// Node.js 18 or newer (fetch is built in). Save as call.mjs and run: node call.mjs
import { randomUUID } from 'node:crypto';
const res = await fetch('https://yourstore.example.com/api/v1/orders/GK-261008-7WNM/shipment', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
'Idempotency-Key': randomUUID(),
},
body: JSON.stringify({
courier: 'Sample Courier',
awb: '38472910',
}),
});
const json = await res.json();
if (!res.ok) {
// json.error.code and json.error.message say what to fix
}# Python 3 with the requests library (pip install requests)
import uuid
import requests
res = requests.post(
"https://yourstore.example.com/api/v1/orders/GK-261008-7WNM/shipment",
headers={"Authorization": "Bearer YOUR_API_KEY", "Idempotency-Key": str(uuid.uuid4())},
json={
"courier": "Sample Courier",
"awb": "38472910",
},
timeout=30,
)
data = res.json()
if not res.ok:
# data["error"]["code"] and data["error"]["message"] say what to fix
print(data["error"])Example answer (200 OK)
{
"data": {
"id": 1024,
"number": "GK-261008-7WNM",
"status": "placed",
"payment_method": "cod",
"payment_status": "pending",
"subtotal": 1197,
"discount": 100,
"shipping": 60,
"total": 1217,
"coupon": "WELCOME10",
"customer": {
"name": "Sample Customer",
"email": "buyer@example.com",
"phone": "9000000000"
},
"address": {
"line1": "12 Sample Street",
"line2": null,
"city": "Sample City",
"state": "Sample State",
"pincode": "123456"
},
"courier": null,
"awb": null,
"items": [
{
"product_id": 7,
"name": "Sample Product",
"variant": "250 g",
"price": 399,
"qty": 3
}
],
"created_at": "2026-11-21T10:15:00+00:00",
"source": "website",
"tracking_url": null,
"cancel_reason": null,
"refund_status": "none",
"refunded_amount": 0,
"updated_at": "2026-11-21T10:15:00Z",
"gift": true,
"gift_message": "Happy celebrations! With best wishes.",
"packaging": {
"name": "Sample Packaging",
"fee": 60,
"gst_rate": 18
}
},
"meta": {}
}Errors
| Status | Code | When |
|---|---|---|
| 401 | missing_api_key, invalid_api_key, revoked_api_key, expired_api_key | The key is missing, not valid, revoked or expired. |
| 403 | insufficient_scope | The key does not have the write:orders scope. error.required_scope names it. (api_key_disabled and ip_not_allowed also give 403.) |
| 404 | not_found | That order does not exist. |
| 422 | validation_failed | A field is missing or wrong. error.fields says which and why. |
| 422 | transition_not_allowed | The order cannot move to that status (cancelled orders are final; online orders must be paid first). The message is the admin's. |
| 409 | idempotency_key_reuse, idempotency_in_progress | The Idempotency-Key was used for a different request, or the first request with it is still running. |
| 429 | rate_limited | More requests than the key's limit in a minute. Wait for Retry-After. |
Example error answer (422):
{
"error": {
"code": "validation_failed",
"message": "The request could not be accepted. See \"fields\" for what to fix.",
"fields": {
"courier": [
"The courier field is required."
]
}
}
}Add an internal note#
POST/api/v1/orders/{number}/noteswrite:orders
Adds a note to the order history. Notes are internal: the customer never sees them.
Notes are internal. The customer never sees them.
Address parameters
| Name | Type | Meaning |
|---|---|---|
number | string | The order number, for example GK-261008-7WNM. The first letters are the store's order prefix (GK- by default). Use the number exactly as the store shows it. |
Request body (JSON)
| Field | Type | Required | Limits | Meaning |
|---|---|---|---|---|
note | string | Yes | at most 2000 characters | The note. Example: Customer called to confirm the address. |
Any field not listed here is refused with 422. Send an Idempotency-Key header so a retry is safe (see Requests).
Example request
curl -s -X POST "https://yourstore.example.com/api/v1/orders/GK-261008-7WNM/notes" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 6f1c0b3e-0d5a-4a52-9d5e-1f6c2a7b9e10" \
-d '{
"note": "Customer called to confirm the address."
}'<?php
$ch = curl_init('https://yourstore.example.com/api/v1/orders/GK-261008-7WNM/notes');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json',
'Idempotency-Key: ' . bin2hex(random_bytes(16)),
],
CURLOPT_POSTFIELDS => json_encode([
'note' => 'Customer called to confirm the address.',
]),
]);
$response = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($status >= 400) {
// $response['error']['code'] and $response['error']['message'] say what to fix
}// Node.js 18 or newer (fetch is built in). Save as call.mjs and run: node call.mjs
import { randomUUID } from 'node:crypto';
const res = await fetch('https://yourstore.example.com/api/v1/orders/GK-261008-7WNM/notes', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
'Idempotency-Key': randomUUID(),
},
body: JSON.stringify({
note: 'Customer called to confirm the address.',
}),
});
const json = await res.json();
if (!res.ok) {
// json.error.code and json.error.message say what to fix
}# Python 3 with the requests library (pip install requests)
import uuid
import requests
res = requests.post(
"https://yourstore.example.com/api/v1/orders/GK-261008-7WNM/notes",
headers={"Authorization": "Bearer YOUR_API_KEY", "Idempotency-Key": str(uuid.uuid4())},
json={
"note": "Customer called to confirm the address.",
},
timeout=30,
)
data = res.json()
if not res.ok:
# data["error"]["code"] and data["error"]["message"] say what to fix
print(data["error"])Example answer (201 Created)
{
"data": {
"id": 1024,
"number": "GK-261008-7WNM",
"status": "placed",
"payment_method": "cod",
"payment_status": "pending",
"subtotal": 1197,
"discount": 100,
"shipping": 60,
"total": 1217,
"coupon": "WELCOME10",
"customer": {
"name": "Sample Customer",
"email": "buyer@example.com",
"phone": "9000000000"
},
"address": {
"line1": "12 Sample Street",
"line2": null,
"city": "Sample City",
"state": "Sample State",
"pincode": "123456"
},
"courier": null,
"awb": null,
"items": [
{
"product_id": 7,
"name": "Sample Product",
"variant": "250 g",
"price": 399,
"qty": 3
}
],
"created_at": "2026-11-21T10:15:00+00:00",
"source": "website",
"tracking_url": null,
"cancel_reason": null,
"refund_status": "none",
"refunded_amount": 0,
"updated_at": "2026-11-21T10:15:00Z",
"gift": true,
"gift_message": "Happy celebrations! With best wishes.",
"packaging": {
"name": "Sample Packaging",
"fee": 60,
"gst_rate": 18
}
},
"meta": {}
}Errors
| Status | Code | When |
|---|---|---|
| 401 | missing_api_key, invalid_api_key, revoked_api_key, expired_api_key | The key is missing, not valid, revoked or expired. |
| 403 | insufficient_scope | The key does not have the write:orders scope. error.required_scope names it. (api_key_disabled and ip_not_allowed also give 403.) |
| 404 | not_found | That order does not exist. |
| 422 | validation_failed | A field is missing or wrong. error.fields says which and why. |
| 409 | idempotency_key_reuse, idempotency_in_progress | The Idempotency-Key was used for a different request, or the first request with it is still running. |
| 429 | rate_limited | More requests than the key's limit in a minute. Wait for Retry-After. |
Example error answer (422):
{
"error": {
"code": "validation_failed",
"message": "The request could not be accepted. See \"fields\" for what to fix.",
"fields": {
"note": [
"The note field is required."
]
}
}
}