Orders
Orders in their own currency, parcels with tracking, and invoices and credit notes as EN 16931 UBL.
| Operation | Method and path | Scope |
|---|---|---|
| List orders | GET /orders | orders:read |
| Get an order | GET /orders/{id} | orders:read |
| Send a parcel | POST /orders/{id}/fulfillments | orders:write |
| Get an invoice as UBL | GET /invoices/{id}/ubl | orders:read |
| Get a credit note as UBL | GET /credit-notes/{id}/ubl | orders:read |
| List an order's refunds | GET /orders/{id}/refunds | orders:read |
| Refund an order | POST /orders/{id}/refunds | orders:refund |
| Cancel an unpaid order | POST /orders/{id}/cancel | orders:refund |
| List an order's notes | GET /orders/{id}/notes | orders:read |
| Add a note to an order | POST /orders/{id}/notes | orders:manage |
| Tag an order | POST /orders/{id}/tags | orders:manage |
| Remove an order's tag | DELETE /orders/{id}/tags/{tag} | orders:manage |
List orders
GET https://kaizenaflow.com/api/admin/v1/orders
The store's orders, newest first, in each order's own currency. History copied from another store is left out.
Operation:
orders.listScope:
orders:read, ororders:write, which reads tooAnswers:
200, a page: the rows underdata, andnextfor the page after.Pages: at most 100 rows, 50 when
limitis left out; give an answer'snextas?after=for the page after.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
limit | integer, 1 to 100 | no | Rows a page holds, at most 100; 50 when left out. A larger number gives 100. |
after | string, at most 200 characters | no | The next cursor of the page before; the first page when left out. |
updated_after | string (date-time) | no | Only what was made or changed after this time (ISO 8601 with its offset), for incremental sync. |
status | one of pending_payment, authorized, paid, fulfilled, closed, cancelled | no | Only orders in this state. |
unfulfilled | one of true, false | no | true: only paid orders with something still to send. |
Answer
| Field | Type | Description |
|---|---|---|
data | list of objects | |
data[].id | string (uuid) | |
data[].number | string | The order's number, one sequence per store. |
data[].status | one of pending_payment, authorized, paid, fulfilled, closed, cancelled | |
data[].fulfilment | one of none, unsent, partly_sent, sent, withdrawn, closed | What is sent: none (nothing to send), unsent, partly_sent, sent, withdrawn or closed. |
data[].copied | boolean | History copied from another store: read-only. |
data[].placed_at | string (date-time) | |
data[].market | string | A market, by its code (the country's ISO 3166-1 code, such as NO). |
data[].currency | string, matching ^[A-Z]{3}$ | An ISO 4217 code, such as NOK or EUR. |
data[].email | string | |
data[].subtotal_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data[].shipping_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data[].tax_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data[].total_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data[].paid_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data[].refunded_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data[].shipping_address | object | |
data[].shipping_address.name | string | |
data[].shipping_address.line1 | string | |
data[].shipping_address.line2 | string | |
data[].shipping_address.postal_code | string | |
data[].shipping_address.city | string | |
data[].shipping_address.country | string | |
data[].shipping_address.phone | string | |
data[].billing_address | object | |
data[].billing_address.name | string | |
data[].billing_address.line1 | string | |
data[].billing_address.line2 | string | |
data[].billing_address.postal_code | string | |
data[].billing_address.city | string | |
data[].billing_address.country | string | |
data[].billing_address.phone | string | |
data[].lines | list of objects | |
data[].lines[].id | string (uuid) | |
data[].lines[].variant_id | string (uuid) or null | |
data[].lines[].sku | string | |
data[].lines[].title | string | |
data[].lines[].quantity | integer | |
data[].lines[].unit_price_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data[].lines[].total_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data[].lines[].delivery | one of physical, digital, service | |
data[].lines[].to_send | integer | Units still to send. |
data[].shipments | list of objects | |
data[].shipments[].id | string (uuid) | |
data[].shipments[].carrier | string | |
data[].shipments[].tracking_number | string | |
data[].shipments[].tracking_url | string or null | |
data[].shipments[].created_at | string (date-time) | |
data[].shipments[].lines | list of objects | |
data[].shipments[].lines[].line_id | string (uuid) | |
data[].shipments[].lines[].quantity | integer | |
data[].tags | list of string | Staff's tags on the order. |
data[].updated_at | string (date-time) | When it last changed: placed, paid, sent, refunded, edited or noted (its timeline's latest entry). |
next | string or null | The cursor of the next page, given as ?after=; null on the last page. |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
| 403 | forbidden | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
| 422 | invalid | Nothing was done: a body, query or cursor that is not as described, or a check of the screen it goes through; the message says what. |
| 429 | rate_limited | More calls than the budget allows; Retry-After says how many seconds to wait. |
| 500 | failed | Something went wrong on our side; nothing more was done. It is safe to try again. |
Example request
curl
curl 'https://kaizenaflow.com/api/admin/v1/orders' \
-H "Authorization: Bearer $KAIZENA_TOKEN"JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/orders", {
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
},
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/orders",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
},
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)Get an order
GET https://kaizenaflow.com/api/admin/v1/orders/{id}
One order with its lines, what is left to send, its parcels and tags.
Operation:
orders.getScope:
orders:read, ororders:write, which reads tooAnswers:
200, the answer underdata.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) | yes | The thing's id in this store. |
Answer
| Field | Type | Description |
|---|---|---|
data | object | |
data.id | string (uuid) | |
data.number | string | The order's number, one sequence per store. |
data.status | one of pending_payment, authorized, paid, fulfilled, closed, cancelled | |
data.fulfilment | one of none, unsent, partly_sent, sent, withdrawn, closed | What is sent: none (nothing to send), unsent, partly_sent, sent, withdrawn or closed. |
data.copied | boolean | History copied from another store: read-only. |
data.placed_at | string (date-time) | |
data.market | string | A market, by its code (the country's ISO 3166-1 code, such as NO). |
data.currency | string, matching ^[A-Z]{3}$ | An ISO 4217 code, such as NOK or EUR. |
data.email | string | |
data.subtotal_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data.shipping_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data.tax_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data.total_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data.paid_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data.refunded_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data.shipping_address | object | |
data.shipping_address.name | string | |
data.shipping_address.line1 | string | |
data.shipping_address.line2 | string | |
data.shipping_address.postal_code | string | |
data.shipping_address.city | string | |
data.shipping_address.country | string | |
data.shipping_address.phone | string | |
data.billing_address | object | |
data.billing_address.name | string | |
data.billing_address.line1 | string | |
data.billing_address.line2 | string | |
data.billing_address.postal_code | string | |
data.billing_address.city | string | |
data.billing_address.country | string | |
data.billing_address.phone | string | |
data.lines | list of objects | |
data.lines[].id | string (uuid) | |
data.lines[].variant_id | string (uuid) or null | |
data.lines[].sku | string | |
data.lines[].title | string | |
data.lines[].quantity | integer | |
data.lines[].unit_price_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data.lines[].total_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data.lines[].delivery | one of physical, digital, service | |
data.lines[].to_send | integer | Units still to send. |
data.shipments | list of objects | |
data.shipments[].id | string (uuid) | |
data.shipments[].carrier | string | |
data.shipments[].tracking_number | string | |
data.shipments[].tracking_url | string or null | |
data.shipments[].created_at | string (date-time) | |
data.shipments[].lines | list of objects | |
data.shipments[].lines[].line_id | string (uuid) | |
data.shipments[].lines[].quantity | integer | |
data.tags | list of string | Staff's tags on the order. |
data.updated_at | string (date-time) | When it last changed: placed, paid, sent, refunded, edited or noted (its timeline's latest entry). |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
| 403 | forbidden | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
| 404 | not_found | No such route, or nothing with that id in the token's store (another store's ids are simply not found). |
| 429 | rate_limited | More calls than the budget allows; Retry-After says how many seconds to wait. |
| 500 | failed | Something went wrong on our side; nothing more was done. It is safe to try again. |
Example request
curl
curl 'https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f' \
-H "Authorization: Bearer $KAIZENA_TOKEN"JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f", {
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
},
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
},
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)Send a parcel
POST https://kaizenaflow.com/api/admin/v1/orders/{id}/fulfillments
Records a parcel with its carrier and tracking, as the admin's Send does, and emails the customer unless notify is false. Answers the order as it is now.
Operation:
orders.fulfilScope:
orders:writeAnswers:
201, made: the answer underdata.Once only: with an
Idempotency-Keyheader.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) | yes | The thing's id in this store. |
Body
JSON, with Content-Type: application/json.
| Field | Type | Required | Description |
|---|---|---|---|
carrier | one of posten, bring, porterbuddy, helthjem, instabox, postnord, dhl, dhl_paket, ups, nshift, other | yes | |
tracking_number | string, at most 100 characters | no, default "" | |
tracking_url | "" or string (uri) | no, default "" | The parcel's tracking page; the carrier's own when left out. |
lines | list of objects, at most 500 items | no | What is in the parcel; everything still to send when left out. |
lines[].line_id | string (uuid) | yes | |
lines[].quantity | integer, 1 to 100,000 | yes | |
notify | boolean | no, default true | Email the customer about the parcel, as the admin's Send does. |
Answer
| Field | Type | Description |
|---|---|---|
data | object | |
data.id | string (uuid) | |
data.number | string | The order's number, one sequence per store. |
data.status | one of pending_payment, authorized, paid, fulfilled, closed, cancelled | |
data.fulfilment | one of none, unsent, partly_sent, sent, withdrawn, closed | What is sent: none (nothing to send), unsent, partly_sent, sent, withdrawn or closed. |
data.copied | boolean | History copied from another store: read-only. |
data.placed_at | string (date-time) | |
data.market | string | A market, by its code (the country's ISO 3166-1 code, such as NO). |
data.currency | string, matching ^[A-Z]{3}$ | An ISO 4217 code, such as NOK or EUR. |
data.email | string | |
data.subtotal_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data.shipping_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data.tax_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data.total_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data.paid_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data.refunded_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data.shipping_address | object | |
data.shipping_address.name | string | |
data.shipping_address.line1 | string | |
data.shipping_address.line2 | string | |
data.shipping_address.postal_code | string | |
data.shipping_address.city | string | |
data.shipping_address.country | string | |
data.shipping_address.phone | string | |
data.billing_address | object | |
data.billing_address.name | string | |
data.billing_address.line1 | string | |
data.billing_address.line2 | string | |
data.billing_address.postal_code | string | |
data.billing_address.city | string | |
data.billing_address.country | string | |
data.billing_address.phone | string | |
data.lines | list of objects | |
data.lines[].id | string (uuid) | |
data.lines[].variant_id | string (uuid) or null | |
data.lines[].sku | string | |
data.lines[].title | string | |
data.lines[].quantity | integer | |
data.lines[].unit_price_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data.lines[].total_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data.lines[].delivery | one of physical, digital, service | |
data.lines[].to_send | integer | Units still to send. |
data.shipments | list of objects | |
data.shipments[].id | string (uuid) | |
data.shipments[].carrier | string | |
data.shipments[].tracking_number | string | |
data.shipments[].tracking_url | string or null | |
data.shipments[].created_at | string (date-time) | |
data.shipments[].lines | list of objects | |
data.shipments[].lines[].line_id | string (uuid) | |
data.shipments[].lines[].quantity | integer | |
data.tags | list of string | Staff's tags on the order. |
data.updated_at | string (date-time) | When it last changed: placed, paid, sent, refunded, edited or noted (its timeline's latest entry). |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
| 403 | forbidden | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
| 403 | gated | The request needs a power beside the operation's scope (the message names it): changing a product, category or address on the site, an import that would, or a customer's email. A copied order is never changed. |
| 404 | not_found | No such route, or nothing with that id in the token's store (another store's ids are simply not found). |
| 409 | conflict | Nothing was done: it clashes with how things are now (nothing left to send), or an Idempotency-Key is in use or was used for another request. |
| 422 | invalid | Nothing was done: a body, query or cursor that is not as described, or a check of the screen it goes through; the message says what. |
| 429 | rate_limited | More calls than the budget allows; Retry-After says how many seconds to wait. |
| 500 | failed | Something went wrong on our side; nothing more was done. It is safe to try again. |
Example request
curl
curl -X POST 'https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/fulfillments' \
-H "Authorization: Bearer $KAIZENA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"carrier":"posten"}'JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/fulfillments", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"carrier": "posten"
}),
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/fulfillments",
method="POST",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
"Content-Type": "application/json",
},
data=json.dumps({
"carrier": "posten",
}).encode(),
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)Get an invoice as UBL
GET https://kaizenaflow.com/api/admin/v1/invoices/{id}/ubl
An invoice as an EN 16931 electronic invoice (UBL 2.1), for accounting systems.
Operation:
invoices.ublScope:
orders:read, ororders:write, which reads tooAnswers:
200, the answer underdata.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) | yes | The thing's id in this store. |
Answer
| Field | Type | Description |
|---|---|---|
data | object | |
data.file_name | string | |
data.content_type | "application/xml" | |
data.xml | string | The document as EN 16931 UBL 2.1. |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
| 403 | forbidden | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
| 404 | not_found | No such route, or nothing with that id in the token's store (another store's ids are simply not found). |
| 422 | invalid | Nothing was done: a body, query or cursor that is not as described, or a check of the screen it goes through; the message says what. |
| 429 | rate_limited | More calls than the budget allows; Retry-After says how many seconds to wait. |
| 500 | failed | Something went wrong on our side; nothing more was done. It is safe to try again. |
Example request
curl
curl 'https://kaizenaflow.com/api/admin/v1/invoices/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/ubl' \
-H "Authorization: Bearer $KAIZENA_TOKEN"JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/invoices/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/ubl", {
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
},
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/invoices/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/ubl",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
},
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)Get a credit note as UBL
GET https://kaizenaflow.com/api/admin/v1/credit-notes/{id}/ubl
A credit note as an EN 16931 electronic document (UBL 2.1).
Operation:
credit_notes.ublScope:
orders:read, ororders:write, which reads tooAnswers:
200, the answer underdata.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) | yes | The thing's id in this store. |
Answer
| Field | Type | Description |
|---|---|---|
data | object | |
data.file_name | string | |
data.content_type | "application/xml" | |
data.xml | string | The document as EN 16931 UBL 2.1. |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
| 403 | forbidden | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
| 404 | not_found | No such route, or nothing with that id in the token's store (another store's ids are simply not found). |
| 422 | invalid | Nothing was done: a body, query or cursor that is not as described, or a check of the screen it goes through; the message says what. |
| 429 | rate_limited | More calls than the budget allows; Retry-After says how many seconds to wait. |
| 500 | failed | Something went wrong on our side; nothing more was done. It is safe to try again. |
Example request
curl
curl 'https://kaizenaflow.com/api/admin/v1/credit-notes/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/ubl' \
-H "Authorization: Bearer $KAIZENA_TOKEN"JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/credit-notes/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/ubl", {
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
},
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/credit-notes/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/ubl",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
},
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)List an order's refunds
GET https://kaizenaflow.com/api/admin/v1/orders/{id}/refunds
Every refund of the order, newest first, in its own currency.
Operation:
orders.refundsScope:
orders:read, ororders:write, which reads tooAnswers:
200, the answer underdata.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) | yes | The thing's id in this store. |
Answer
| Field | Type | Description |
|---|---|---|
data | list of objects | |
data[].id | string (uuid) | |
data[].order_id | string (uuid) | |
data[].amount_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data[].currency | string, matching ^[A-Z]{3}$ | An ISO 4217 code, such as NOK or EUR. |
data[].status | string | pending (on its way), succeeded or failed. |
data[].kind | string | How the money went back: to the payment, or as store credit. |
data[].restocked | boolean | Units went back in stock with it. |
data[].created_at | string (date-time) |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
| 403 | forbidden | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
| 404 | not_found | No such route, or nothing with that id in the token's store (another store's ids are simply not found). |
| 429 | rate_limited | More calls than the budget allows; Retry-After says how many seconds to wait. |
| 500 | failed | Something went wrong on our side; nothing more was done. It is safe to try again. |
Example request
curl
curl 'https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/refunds' \
-H "Authorization: Bearer $KAIZENA_TOKEN"JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/refunds", {
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
},
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/refunds",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
},
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)Refund an order
POST https://kaizenaflow.com/api/admin/v1/orders/{id}/refunds
Refunds part or all of what is left through refundOrder(), the admin's own refund: through the payment it was taken by (Stripe, Mollie, or recorded for money taken outside), or as store credit; units put back in stock where they came from. Needs orders:refund.
Operation:
orders.refundScope:
orders:refundAnswers:
201, made: the answer underdata.Once only: with an
Idempotency-Keyheader.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) | yes | The thing's id in this store. |
Body
JSON, with Content-Type: application/json.
| Field | Type | Required | Description |
|---|---|---|---|
amount_minor | integer, at least 0 | yes | What goes back, in minor units of the order's currency; 0 to put units back in stock only. |
reason | string, 1 to 500 characters | no, default "Refund" | Why, for the order's history and the credit note. |
restock | list of objects, at most 500 items | no, default [] | Units put back in stock, per order line. |
restock[].line_id | string (uuid) | yes | |
restock[].quantity | integer, 1 to 100,000 | yes | |
restock[].location_id | string (uuid) or null | no | Where they go back; where they were taken from when left out. |
not_sent | boolean | no, default false | The units put back were never sent: they come off what is still to send. |
to_store_credit | boolean | no, default false | Give the amount as store credit (D364), emailed to the order's address, instead of to the payment. |
notify | boolean | no, default true | Email the customer about the refund, as the admin's Refund does (store credit is emailed either way). |
Answer
| Field | Type | Description |
|---|---|---|
data | object | |
data.refund_ids | list of string (uuid) | Every refund made: an amount split over the order's payments makes one each. |
data.amount_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data.status | string or null | |
data.closed_units | integer | Units taken off what was still to send (not_sent). |
data.store_credit | object or null | Store credit issued; its code goes only to the customer. |
data.store_credit.card_id | string (uuid) | |
data.store_credit.amount_minor | integer | An amount in minor units of the currency (øre, cents), VAT included where the store's prices are. |
data.store_credit.emailed | one of sent, failed |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
| 403 | forbidden | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
| 403 | gated | The request needs a power beside the operation's scope (the message names it): changing a product, category or address on the site, an import that would, or a customer's email. A copied order is never changed. |
| 404 | not_found | No such route, or nothing with that id in the token's store (another store's ids are simply not found). |
| 409 | conflict | Nothing was done: it clashes with how things are now (nothing left to send), or an Idempotency-Key is in use or was used for another request. |
| 422 | invalid | Nothing was done: a body, query or cursor that is not as described, or a check of the screen it goes through; the message says what. |
| 429 | rate_limited | More calls than the budget allows; Retry-After says how many seconds to wait. |
| 500 | failed | Something went wrong on our side; nothing more was done. It is safe to try again. |
Example request
curl
curl -X POST 'https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/refunds' \
-H "Authorization: Bearer $KAIZENA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"amount_minor":1}'JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/refunds", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"amount_minor": 1
}),
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/refunds",
method="POST",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
"Content-Type": "application/json",
},
data=json.dumps({
"amount_minor": 1,
}).encode(),
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)Cancel an unpaid order
POST https://kaizenaflow.com/api/admin/v1/orders/{id}/cancel
Cancels an order waiting for payment: its payment page is closed first (one found paid is refused), its stock goes back and its pay link dies. A paid order is refunded instead (orders:refund).
Operation:
orders.cancelScope:
orders:refundAnswers:
200, the answer underdata.Once only: with an
Idempotency-Keyheader.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) | yes | The thing's id in this store. |
Body
JSON, with Content-Type: application/json.
| Field | Type | Required | Description |
|---|---|---|---|
reason | string, at most 500 characters | no, default "Cancelled by the store" | Why, for the order's history. |
notify | boolean | no, default false | Email the customer that the order is cancelled. |
Answer
| Field | Type | Description |
|---|---|---|
data | object | |
data.id | string (uuid) | |
data.status | "cancelled" |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
| 403 | forbidden | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
| 403 | gated | The request needs a power beside the operation's scope (the message names it): changing a product, category or address on the site, an import that would, or a customer's email. A copied order is never changed. |
| 404 | not_found | No such route, or nothing with that id in the token's store (another store's ids are simply not found). |
| 409 | conflict | Nothing was done: it clashes with how things are now (nothing left to send), or an Idempotency-Key is in use or was used for another request. |
| 422 | invalid | Nothing was done: a body, query or cursor that is not as described, or a check of the screen it goes through; the message says what. |
| 429 | rate_limited | More calls than the budget allows; Retry-After says how many seconds to wait. |
| 500 | failed | Something went wrong on our side; nothing more was done. It is safe to try again. |
Example request
curl
curl -X POST 'https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/cancel' \
-H "Authorization: Bearer $KAIZENA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"reason":"Cancelled by the store"}'JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/cancel", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"reason": "Cancelled by the store"
}),
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/cancel",
method="POST",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
"Content-Type": "application/json",
},
data=json.dumps({
"reason": "Cancelled by the store",
}).encode(),
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)List an order's notes
GET https://kaizenaflow.com/api/admin/v1/orders/{id}/notes
Staff's notes on the order, newest first.
Operation:
orders.notesScope:
orders:read, ororders:write, which reads tooAnswers:
200, the answer underdata.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) | yes | The thing's id in this store. |
Answer
| Field | Type | Description |
|---|---|---|
data | list of objects | |
data[].note | string | |
data[].by | string | Who wrote it: a person's email, or the token's name. |
data[].created_at | string (date-time) |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
| 403 | forbidden | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
| 404 | not_found | No such route, or nothing with that id in the token's store (another store's ids are simply not found). |
| 429 | rate_limited | More calls than the budget allows; Retry-After says how many seconds to wait. |
| 500 | failed | Something went wrong on our side; nothing more was done. It is safe to try again. |
Example request
curl
curl 'https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/notes' \
-H "Authorization: Bearer $KAIZENA_TOKEN"JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/notes", {
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
},
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/notes",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
},
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)Add a note to an order
POST https://kaizenaflow.com/api/admin/v1/orders/{id}/notes
Adds a note for staff to the order's history, as the order page does; the customer never sees it.
Operation:
orders.noteScope:
orders:manageAnswers:
201, made: the answer underdata.Once only: with an
Idempotency-Keyheader.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) | yes | The thing's id in this store. |
Body
JSON, with Content-Type: application/json.
| Field | Type | Required | Description |
|---|---|---|---|
note | string, 1 to 2,000 characters | yes | A note for staff; the customer never sees it. |
Answer
| Field | Type | Description |
|---|---|---|
data | object | |
data.note | string | |
data.by | string | Who wrote it: a person's email, or the token's name. |
data.created_at | string (date-time) |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
| 403 | forbidden | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
| 403 | gated | The request needs a power beside the operation's scope (the message names it): changing a product, category or address on the site, an import that would, or a customer's email. A copied order is never changed. |
| 404 | not_found | No such route, or nothing with that id in the token's store (another store's ids are simply not found). |
| 409 | conflict | Nothing was done: it clashes with how things are now (nothing left to send), or an Idempotency-Key is in use or was used for another request. |
| 422 | invalid | Nothing was done: a body, query or cursor that is not as described, or a check of the screen it goes through; the message says what. |
| 429 | rate_limited | More calls than the budget allows; Retry-After says how many seconds to wait. |
| 500 | failed | Something went wrong on our side; nothing more was done. It is safe to try again. |
Example request
curl
curl -X POST 'https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/notes' \
-H "Authorization: Bearer $KAIZENA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"note":"Counted on Monday"}'JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/notes", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"note": "Counted on Monday"
}),
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/notes",
method="POST",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
"Content-Type": "application/json",
},
data=json.dumps({
"note": "Counted on Monday",
}).encode(),
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)Tag an order
POST https://kaizenaflow.com/api/admin/v1/orders/{id}/tags
Adds a tag to the order (at most 250 an order); one it has is kept once. Answers its tags.
Operation:
orders.tagScope:
orders:manageAnswers:
201, made: the answer underdata.Once only: with an
Idempotency-Keyheader.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) | yes | The thing's id in this store. |
Body
JSON, with Content-Type: application/json.
| Field | Type | Required | Description |
|---|---|---|---|
tag | string, 1 to 120 characters | yes | The tag's words; one the order has is kept once. |
Answer
| Field | Type | Description |
|---|---|---|
data | object | |
data.tags | list of string |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
| 403 | forbidden | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
| 404 | not_found | No such route, or nothing with that id in the token's store (another store's ids are simply not found). |
| 409 | conflict | Nothing was done: it clashes with how things are now (nothing left to send), or an Idempotency-Key is in use or was used for another request. |
| 422 | invalid | Nothing was done: a body, query or cursor that is not as described, or a check of the screen it goes through; the message says what. |
| 429 | rate_limited | More calls than the budget allows; Retry-After says how many seconds to wait. |
| 500 | failed | Something went wrong on our side; nothing more was done. It is safe to try again. |
Example request
curl
curl -X POST 'https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/tags' \
-H "Authorization: Bearer $KAIZENA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"tag":"vip"}'JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/tags", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"tag": "vip"
}),
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/tags",
method="POST",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
"Content-Type": "application/json",
},
data=json.dumps({
"tag": "vip",
}).encode(),
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)Remove an order's tag
DELETE https://kaizenaflow.com/api/admin/v1/orders/{id}/tags/{tag}
Takes a tag off the order, named as it is written in any case. Answers its tags.
Operation:
orders.untagScope:
orders:manageAnswers:
200, the answer underdata.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) | yes | The thing's id in this store. |
tag | string, 1 to 200 characters | yes | The tag's words, URL-encoded. |
Answer
| Field | Type | Description |
|---|---|---|
data | object | |
data.tags | list of string |
Errors
| Status | Code | When |
|---|---|---|
| 401 | unauthorized | No valid token in Authorization: Bearer kf_…, or one that was revoked. |
| 403 | forbidden | The token does not hold the scope the operation needs, or its owner does not hold the staff permission it needs in the store now (a store that is not open, as in the admin, keeps open only its orders, customers, reports and the owner's own pages such as its webhooks; its products, discounts, website and settings, read or changed, are refused); the message names which. |
| 404 | not_found | No such route, or nothing with that id in the token's store (another store's ids are simply not found). |
| 429 | rate_limited | More calls than the budget allows; Retry-After says how many seconds to wait. |
| 500 | failed | Something went wrong on our side; nothing more was done. It is safe to try again. |
Example request
curl
curl -X DELETE 'https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/tags/vip' \
-H "Authorization: Bearer $KAIZENA_TOKEN"JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/tags/vip", {
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
},
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/orders/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/tags/vip",
method="DELETE",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
},
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)