Skip to content
Kaizena FlowDocs
Search

Search the docs

Draft orders

Draft orders staff make and shoppers' requests for a quote (D173, D431), sent as a pay link or declined.

OperationMethod and pathScope
List draft ordersGET /draftsorders:read
Get a draft orderGET /drafts/{id}orders:read
Create a draft orderPOST /draftsorders:manage
Change a draft orderPATCH /drafts/{id}orders:manage
Send a draft orderPOST /drafts/{id}/sendorders:send
Decline a request for a quotePOST /drafts/{id}/declineorders:send

List draft orders

GET https://kaizenaflow.com/api/admin/v1/drafts

The store's draft orders and shoppers' requests for a quote (D173, D431), newest first, each with its lines and what it totals now.

  • Operation: drafts.list

  • Scope: orders:read, or orders:write, which reads too

  • Answers: 200, a page: the rows under data, and next for the page after.

  • Pages: at most 100 rows, 50 when limit is left out; give an answer's next as ?after= for the page after.

Query parameters

NameTypeRequiredDescription
limitinteger, 1 to 100noRows a page holds, at most 100; 50 when left out. A larger number gives 100.
afterstring, at most 200 charactersnoThe next cursor of the page before; the first page when left out.
updated_afterstring (date-time)noOnly what was made or changed after this time (ISO 8601 with its offset), for incremental sync.
statusone of open, sent, paid, expired, cancellednoOnly drafts in this state.
quotesone of true, falsenotrue: only shoppers' requests for a quote.

Answer

FieldTypeDescription
datalist of objects
data[].idstring (uuid)
data[].numberstringThe draft's own number (D-…); the order it becomes gets the store's next order number.
data[].statusone of open, sent, paid, expired, cancelledopen: being made. sent: its order waits for payment. paid, expired or cancelled: ended.
data[].sourceone of staff, quotestaff: made in the admin or here. quote: a shopper's request for a quote (D431).
data[].quoteone of requested, declined or nullA request for a quote: waiting (requested) or declined; null for any other draft.
data[].versionintegerRaised by every change: give it back with a change or a send, and one made since is refused as conflict.
data[].marketstringA market, by its code (the country's ISO 3166-1 code, such as NO).
data[].currencystring, matching ^[A-Z]{3}$An ISO 4217 code, such as NOK or EUR.
data[].customer_idstring (uuid) or null
data[].emailstring or null
data[].phonestring or null
data[].shipping_addressobject
data[].shipping_address.namestring
data[].shipping_address.line1string
data[].shipping_address.line2string
data[].shipping_address.postal_codestring
data[].shipping_address.citystring
data[].shipping_address.countrystring
data[].billing_addressobject
data[].billing_address.namestring
data[].billing_address.line1string
data[].billing_address.line2string
data[].billing_address.postal_codestring
data[].billing_address.citystring
data[].billing_address.countrystring
data[].company_namestring or null
data[].organisation_numberstring or null
data[].note_to_buyerstring or null
data[].internal_notestring or null
data[].request_notestring or nullWhat the shopper wrote with a request for a quote.
data[].tagslist of string
data[].discountobject or nullA discount staff give on the whole draft, with the words the buyer sees.
data[].discount.kindone of percent, amount
data[].discount.percentnumber or null
data[].discount.amount_minorinteger or nullAn amount in minor units of the currency (øre, cents), VAT included where the store's prices are.
data[].discount.labelstring
data[].shippingobjectrate: the market's shipping rate. custom: the amount given.
data[].shipping.kindone of rate, free, custom
data[].shipping.amount_minorinteger or nullAn amount in minor units of the currency (øre, cents), VAT included where the store's prices are.
data[].lineslist of objects
data[].lines[].idstring (uuid)
data[].lines[].kindone of goods, custom
data[].lines[].variant_idstring (uuid) or null
data[].lines[].skustring
data[].lines[].titlestring
data[].lines[].quantityinteger
data[].lines[].unit_price_minorintegerWhat one unit costs on the draft, VAT included.
data[].lines[].list_price_minorinteger or nullThe market's list price when the line was last saved; null for a custom item.
data[].lines[].custom_pricebooleanA price given instead of the list price.
data[].lines[].price_requestedbooleanA requested product priced on request with no price given yet: the draft cannot be sent until it has one.
data[].lines[].vat_categorystring or null
data[].total_minorinteger or nullWhat the draft totals now, with shipping, the discount and VAT, as the order would; null when it cannot be worked out yet.
data[].blockinglist of stringWhy a send would be refused now, in words; empty when it can be sent.
data[].order_idstring (uuid) or nullThe order a sent draft made.
data[].sent_atstring (date-time) or null
data[].expires_atstring (date-time) or nullWhen a sent draft's pay link ends and its order is cancelled.
data[].created_atstring (date-time)
data[].updated_atstring (date-time)
nextstring or nullThe cursor of the next page, given as ?after=; null on the last page.

Errors

StatusCodeWhen
401unauthorizedNo valid token in Authorization: Bearer kf_…, or one that was revoked.
403feature_offThe store has switched off the feature the operation stands behind (Settings, Store features); the message names it.
403forbiddenThe 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.
422invalidNothing 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.
429rate_limitedMore calls than the budget allows; Retry-After says how many seconds to wait.
500failedSomething 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/drafts' \
  -H "Authorization: Bearer $KAIZENA_TOKEN"

JavaScript

const response = await fetch("https://kaizenaflow.com/api/admin/v1/drafts", {
  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/drafts",
    headers={
        "Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
    },
)
with urllib.request.urlopen(request) as response:
    answer = json.load(response)

Get a draft order

GET https://kaizenaflow.com/api/admin/v1/drafts/{id}

One draft order or request for a quote, with what would stop it being sent now.

Path parameters

NameTypeRequiredDescription
idstring (uuid)yesThe thing's id in this store.

Answer

FieldTypeDescription
dataobject
data.idstring (uuid)
data.numberstringThe draft's own number (D-…); the order it becomes gets the store's next order number.
data.statusone of open, sent, paid, expired, cancelledopen: being made. sent: its order waits for payment. paid, expired or cancelled: ended.
data.sourceone of staff, quotestaff: made in the admin or here. quote: a shopper's request for a quote (D431).
data.quoteone of requested, declined or nullA request for a quote: waiting (requested) or declined; null for any other draft.
data.versionintegerRaised by every change: give it back with a change or a send, and one made since is refused as conflict.
data.marketstringA market, by its code (the country's ISO 3166-1 code, such as NO).
data.currencystring, matching ^[A-Z]{3}$An ISO 4217 code, such as NOK or EUR.
data.customer_idstring (uuid) or null
data.emailstring or null
data.phonestring or null
data.shipping_addressobject
data.shipping_address.namestring
data.shipping_address.line1string
data.shipping_address.line2string
data.shipping_address.postal_codestring
data.shipping_address.citystring
data.shipping_address.countrystring
data.billing_addressobject
data.billing_address.namestring
data.billing_address.line1string
data.billing_address.line2string
data.billing_address.postal_codestring
data.billing_address.citystring
data.billing_address.countrystring
data.company_namestring or null
data.organisation_numberstring or null
data.note_to_buyerstring or null
data.internal_notestring or null
data.request_notestring or nullWhat the shopper wrote with a request for a quote.
data.tagslist of string
data.discountobject or nullA discount staff give on the whole draft, with the words the buyer sees.
data.discount.kindone of percent, amount
data.discount.percentnumber or null
data.discount.amount_minorinteger or nullAn amount in minor units of the currency (øre, cents), VAT included where the store's prices are.
data.discount.labelstring
data.shippingobjectrate: the market's shipping rate. custom: the amount given.
data.shipping.kindone of rate, free, custom
data.shipping.amount_minorinteger or nullAn amount in minor units of the currency (øre, cents), VAT included where the store's prices are.
data.lineslist of objects
data.lines[].idstring (uuid)
data.lines[].kindone of goods, custom
data.lines[].variant_idstring (uuid) or null
data.lines[].skustring
data.lines[].titlestring
data.lines[].quantityinteger
data.lines[].unit_price_minorintegerWhat one unit costs on the draft, VAT included.
data.lines[].list_price_minorinteger or nullThe market's list price when the line was last saved; null for a custom item.
data.lines[].custom_pricebooleanA price given instead of the list price.
data.lines[].price_requestedbooleanA requested product priced on request with no price given yet: the draft cannot be sent until it has one.
data.lines[].vat_categorystring or null
data.total_minorinteger or nullWhat the draft totals now, with shipping, the discount and VAT, as the order would; null when it cannot be worked out yet.
data.blockinglist of stringWhy a send would be refused now, in words; empty when it can be sent.
data.order_idstring (uuid) or nullThe order a sent draft made.
data.sent_atstring (date-time) or null
data.expires_atstring (date-time) or nullWhen a sent draft's pay link ends and its order is cancelled.
data.created_atstring (date-time)
data.updated_atstring (date-time)

Errors

StatusCodeWhen
401unauthorizedNo valid token in Authorization: Bearer kf_…, or one that was revoked.
403feature_offThe store has switched off the feature the operation stands behind (Settings, Store features); the message names it.
403forbiddenThe 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.
404not_foundNo such route, or nothing with that id in the token's store (another store's ids are simply not found).
429rate_limitedMore calls than the budget allows; Retry-After says how many seconds to wait.
500failedSomething 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/drafts/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f' \
  -H "Authorization: Bearer $KAIZENA_TOKEN"

JavaScript

const response = await fetch("https://kaizenaflow.com/api/admin/v1/drafts/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/drafts/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f",
    headers={
        "Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
    },
)
with urllib.request.urlopen(request) as response:
    answer = json.load(response)

Create a draft order

POST https://kaizenaflow.com/api/admin/v1/drafts

Makes a draft order through the draft editor's own functions: an empty draft in the market, then saved with what is given, checked as the editor checks it. Nothing is held and no order number used until it is sent.

Body

JSON, with Content-Type: application/json.

FieldTypeRequiredDescription
marketstring, matching ^[A-Z]{2}$noThe market the draft sells in, by its code; the store's own market when left out.
customer_idstring (uuid) or nullnoOne of the store's customers, or null for none.
emailstring, at most 254 characters or nullno
phonestring, at most 40 characters or nullno
shipping_addressobjectnoEach field given replaces the draft's; one left out stays.
shipping_address.namestring, at most 200 charactersno
shipping_address.line1string, at most 200 charactersno
shipping_address.line2string, at most 200 charactersno
shipping_address.postal_codestring, at most 20 charactersno
shipping_address.citystring, at most 100 charactersno
shipping_address.countrystring, at most 2 charactersnoAn ISO 3166-1 code, such as NO.
billing_addressobjectnoEach field given replaces the draft's; one left out stays.
billing_address.namestring, at most 200 charactersno
billing_address.line1string, at most 200 charactersno
billing_address.line2string, at most 200 charactersno
billing_address.postal_codestring, at most 20 charactersno
billing_address.citystring, at most 100 charactersno
billing_address.countrystring, at most 2 charactersnoAn ISO 3166-1 code, such as NO.
company_namestring, at most 120 characters or nullno
organisation_numberstring, at most 30 characters or nullno
note_to_buyerstring, at most 500 characters or nullnoWords the buyer reads on the pay page and the order.
internal_notestring, at most 1,000 characters or nullnoWords for staff only.
tagslist of string, at most 120 characters, at most 250 itemsnoThe draft's tags, carried to its order; replaces the tags there.
discountobject or nullno
discount.kindone of percent, amountyes
discount.percentnumber, 0.01 to 100noFor percent: how much is taken off, such as 10 or 12.5.
discount.amount_minorinteger, at least 1noFor amount: what is taken off, in minor units.
discount.labelstring, 1 to 60 charactersyesThe words the buyer sees.
shippingobjectno
shipping.kindone of rate, free, customyes
shipping.amount_minorinteger, at least 0noFor custom: the shipping price in minor units, VAT included.
lineslist of objects, at most 100 itemsnoThe draft's lines as they should be, in order: they replace the lines there.
lines[].idstring (uuid)noA line of the draft to keep (its quantity and price as given here).
lines[].variant_idstring (uuid)noA product's variant, by its id.
lines[].skustring, 1 to 64 charactersnoA product's variant, by its SKU.
lines[].titlestring, at most 120 charactersnoA custom item's title (no variant).
lines[].quantityinteger, 1 to 9,999yes
lines[].unit_price_minorinteger, 0 to 10,000,000,000 or nullnoThe price of one unit, VAT included, in minor units of the draft's currency; left out or null on a product's line, its list price. A custom item needs one.
lines[].vat_categorystring, matching ^[a-z][a-z0-9_]{1,30}$noA custom item's VAT category, such as standard.

Answer

FieldTypeDescription
dataobject
data.idstring (uuid)
data.numberstringThe draft's own number (D-…); the order it becomes gets the store's next order number.
data.statusone of open, sent, paid, expired, cancelledopen: being made. sent: its order waits for payment. paid, expired or cancelled: ended.
data.sourceone of staff, quotestaff: made in the admin or here. quote: a shopper's request for a quote (D431).
data.quoteone of requested, declined or nullA request for a quote: waiting (requested) or declined; null for any other draft.
data.versionintegerRaised by every change: give it back with a change or a send, and one made since is refused as conflict.
data.marketstringA market, by its code (the country's ISO 3166-1 code, such as NO).
data.currencystring, matching ^[A-Z]{3}$An ISO 4217 code, such as NOK or EUR.
data.customer_idstring (uuid) or null
data.emailstring or null
data.phonestring or null
data.shipping_addressobject
data.shipping_address.namestring
data.shipping_address.line1string
data.shipping_address.line2string
data.shipping_address.postal_codestring
data.shipping_address.citystring
data.shipping_address.countrystring
data.billing_addressobject
data.billing_address.namestring
data.billing_address.line1string
data.billing_address.line2string
data.billing_address.postal_codestring
data.billing_address.citystring
data.billing_address.countrystring
data.company_namestring or null
data.organisation_numberstring or null
data.note_to_buyerstring or null
data.internal_notestring or null
data.request_notestring or nullWhat the shopper wrote with a request for a quote.
data.tagslist of string
data.discountobject or nullA discount staff give on the whole draft, with the words the buyer sees.
data.discount.kindone of percent, amount
data.discount.percentnumber or null
data.discount.amount_minorinteger or nullAn amount in minor units of the currency (øre, cents), VAT included where the store's prices are.
data.discount.labelstring
data.shippingobjectrate: the market's shipping rate. custom: the amount given.
data.shipping.kindone of rate, free, custom
data.shipping.amount_minorinteger or nullAn amount in minor units of the currency (øre, cents), VAT included where the store's prices are.
data.lineslist of objects
data.lines[].idstring (uuid)
data.lines[].kindone of goods, custom
data.lines[].variant_idstring (uuid) or null
data.lines[].skustring
data.lines[].titlestring
data.lines[].quantityinteger
data.lines[].unit_price_minorintegerWhat one unit costs on the draft, VAT included.
data.lines[].list_price_minorinteger or nullThe market's list price when the line was last saved; null for a custom item.
data.lines[].custom_pricebooleanA price given instead of the list price.
data.lines[].price_requestedbooleanA requested product priced on request with no price given yet: the draft cannot be sent until it has one.
data.lines[].vat_categorystring or null
data.total_minorinteger or nullWhat the draft totals now, with shipping, the discount and VAT, as the order would; null when it cannot be worked out yet.
data.blockinglist of stringWhy a send would be refused now, in words; empty when it can be sent.
data.order_idstring (uuid) or nullThe order a sent draft made.
data.sent_atstring (date-time) or null
data.expires_atstring (date-time) or nullWhen a sent draft's pay link ends and its order is cancelled.
data.created_atstring (date-time)
data.updated_atstring (date-time)

Errors

StatusCodeWhen
401unauthorizedNo valid token in Authorization: Bearer kf_…, or one that was revoked.
403feature_offThe store has switched off the feature the operation stands behind (Settings, Store features); the message names it.
403forbiddenThe 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.
409conflictNothing 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.
422invalidNothing 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.
429rate_limitedMore calls than the budget allows; Retry-After says how many seconds to wait.
500failedSomething 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/drafts' \
  -H "Authorization: Bearer $KAIZENA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"market":"NO"}'

JavaScript

const response = await fetch("https://kaizenaflow.com/api/admin/v1/drafts", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "market": "NO"
  }),
});
const answer = await response.json();

Python

import json
import os
import urllib.request

request = urllib.request.Request(
    "https://kaizenaflow.com/api/admin/v1/drafts",
    method="POST",
    headers={
        "Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
        "Content-Type": "application/json",
    },
    data=json.dumps({
        "market": "NO",
    }).encode(),
)
with urllib.request.urlopen(request) as response:
    answer = json.load(response)

Change a draft order

PATCH https://kaizenaflow.com/api/admin/v1/drafts/{id}

Changes only what is given on an open draft, through the editor's save: its customer, addresses, notes, tags, discount, shipping, lines, or its lines' prices by SKU.

  • Operation: drafts.update

  • Scope: orders:manage

  • Answers: 200, the answer under data.

Path parameters

NameTypeRequiredDescription
idstring (uuid)yesThe thing's id in this store.

Body

JSON, with Content-Type: application/json.

FieldTypeRequiredDescription
versioninteger, at least 1noThe version the change was made against: a draft changed since is refused as conflict. The draft as it is now when left out.
marketstring, matching ^[A-Z]{2}$noMoves the draft to another market: lines at their list price take that market's.
customer_idstring (uuid) or nullnoOne of the store's customers, or null for none.
emailstring, at most 254 characters or nullno
phonestring, at most 40 characters or nullno
shipping_addressobjectnoEach field given replaces the draft's; one left out stays.
shipping_address.namestring, at most 200 charactersno
shipping_address.line1string, at most 200 charactersno
shipping_address.line2string, at most 200 charactersno
shipping_address.postal_codestring, at most 20 charactersno
shipping_address.citystring, at most 100 charactersno
shipping_address.countrystring, at most 2 charactersnoAn ISO 3166-1 code, such as NO.
billing_addressobjectnoEach field given replaces the draft's; one left out stays.
billing_address.namestring, at most 200 charactersno
billing_address.line1string, at most 200 charactersno
billing_address.line2string, at most 200 charactersno
billing_address.postal_codestring, at most 20 charactersno
billing_address.citystring, at most 100 charactersno
billing_address.countrystring, at most 2 charactersnoAn ISO 3166-1 code, such as NO.
company_namestring, at most 120 characters or nullno
organisation_numberstring, at most 30 characters or nullno
note_to_buyerstring, at most 500 characters or nullnoWords the buyer reads on the pay page and the order.
internal_notestring, at most 1,000 characters or nullnoWords for staff only.
tagslist of string, at most 120 characters, at most 250 itemsnoThe draft's tags, carried to its order; replaces the tags there.
discountobject or nullno
discount.kindone of percent, amountyes
discount.percentnumber, 0.01 to 100noFor percent: how much is taken off, such as 10 or 12.5.
discount.amount_minorinteger, at least 1noFor amount: what is taken off, in minor units.
discount.labelstring, 1 to 60 charactersyesThe words the buyer sees.
shippingobjectno
shipping.kindone of rate, free, customyes
shipping.amount_minorinteger, at least 0noFor custom: the shipping price in minor units, VAT included.
lineslist of objects, at most 100 itemsnoThe draft's lines as they should be, in order: they replace the lines there.
lines[].idstring (uuid)noA line of the draft to keep (its quantity and price as given here).
lines[].variant_idstring (uuid)noA product's variant, by its id.
lines[].skustring, 1 to 64 charactersnoA product's variant, by its SKU.
lines[].titlestring, at most 120 charactersnoA custom item's title (no variant).
lines[].quantityinteger, 1 to 9,999yes
lines[].unit_price_minorinteger, 0 to 10,000,000,000 or nullnoThe price of one unit, VAT included, in minor units of the draft's currency; left out or null on a product's line, its list price. A custom item needs one.
lines[].vat_categorystring, matching ^[a-z][a-z0-9_]{1,30}$noA custom item's VAT category, such as standard.
priceslist of objects, at most 100 itemsnoPrices of the draft's lines by SKU (D437): each line of the SKU takes it; the other lines keep theirs. A request priced on request is answered so.
prices[].skustring, 1 to 64 charactersyes
prices[].unit_price_minorinteger, 0 to 10,000,000,000 or nullyesnull: back to the list price.

Answer

FieldTypeDescription
dataobject
data.idstring (uuid)
data.numberstringThe draft's own number (D-…); the order it becomes gets the store's next order number.
data.statusone of open, sent, paid, expired, cancelledopen: being made. sent: its order waits for payment. paid, expired or cancelled: ended.
data.sourceone of staff, quotestaff: made in the admin or here. quote: a shopper's request for a quote (D431).
data.quoteone of requested, declined or nullA request for a quote: waiting (requested) or declined; null for any other draft.
data.versionintegerRaised by every change: give it back with a change or a send, and one made since is refused as conflict.
data.marketstringA market, by its code (the country's ISO 3166-1 code, such as NO).
data.currencystring, matching ^[A-Z]{3}$An ISO 4217 code, such as NOK or EUR.
data.customer_idstring (uuid) or null
data.emailstring or null
data.phonestring or null
data.shipping_addressobject
data.shipping_address.namestring
data.shipping_address.line1string
data.shipping_address.line2string
data.shipping_address.postal_codestring
data.shipping_address.citystring
data.shipping_address.countrystring
data.billing_addressobject
data.billing_address.namestring
data.billing_address.line1string
data.billing_address.line2string
data.billing_address.postal_codestring
data.billing_address.citystring
data.billing_address.countrystring
data.company_namestring or null
data.organisation_numberstring or null
data.note_to_buyerstring or null
data.internal_notestring or null
data.request_notestring or nullWhat the shopper wrote with a request for a quote.
data.tagslist of string
data.discountobject or nullA discount staff give on the whole draft, with the words the buyer sees.
data.discount.kindone of percent, amount
data.discount.percentnumber or null
data.discount.amount_minorinteger or nullAn amount in minor units of the currency (øre, cents), VAT included where the store's prices are.
data.discount.labelstring
data.shippingobjectrate: the market's shipping rate. custom: the amount given.
data.shipping.kindone of rate, free, custom
data.shipping.amount_minorinteger or nullAn amount in minor units of the currency (øre, cents), VAT included where the store's prices are.
data.lineslist of objects
data.lines[].idstring (uuid)
data.lines[].kindone of goods, custom
data.lines[].variant_idstring (uuid) or null
data.lines[].skustring
data.lines[].titlestring
data.lines[].quantityinteger
data.lines[].unit_price_minorintegerWhat one unit costs on the draft, VAT included.
data.lines[].list_price_minorinteger or nullThe market's list price when the line was last saved; null for a custom item.
data.lines[].custom_pricebooleanA price given instead of the list price.
data.lines[].price_requestedbooleanA requested product priced on request with no price given yet: the draft cannot be sent until it has one.
data.lines[].vat_categorystring or null
data.total_minorinteger or nullWhat the draft totals now, with shipping, the discount and VAT, as the order would; null when it cannot be worked out yet.
data.blockinglist of stringWhy a send would be refused now, in words; empty when it can be sent.
data.order_idstring (uuid) or nullThe order a sent draft made.
data.sent_atstring (date-time) or null
data.expires_atstring (date-time) or nullWhen a sent draft's pay link ends and its order is cancelled.
data.created_atstring (date-time)
data.updated_atstring (date-time)

Errors

StatusCodeWhen
401unauthorizedNo valid token in Authorization: Bearer kf_…, or one that was revoked.
403feature_offThe store has switched off the feature the operation stands behind (Settings, Store features); the message names it.
403forbiddenThe 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.
404not_foundNo such route, or nothing with that id in the token's store (another store's ids are simply not found).
409conflictNothing 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.
422invalidNothing 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.
429rate_limitedMore calls than the budget allows; Retry-After says how many seconds to wait.
500failedSomething went wrong on our side; nothing more was done. It is safe to try again.

Example request

curl

curl -X PATCH 'https://kaizenaflow.com/api/admin/v1/drafts/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f' \
  -H "Authorization: Bearer $KAIZENA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"version":1}'

JavaScript

const response = await fetch("https://kaizenaflow.com/api/admin/v1/drafts/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f", {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "version": 1
  }),
});
const answer = await response.json();

Python

import json
import os
import urllib.request

request = urllib.request.Request(
    "https://kaizenaflow.com/api/admin/v1/drafts/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f",
    method="PATCH",
    headers={
        "Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
        "Content-Type": "application/json",
    },
    data=json.dumps({
        "version": 1,
    }).encode(),
)
with urllib.request.urlopen(request) as response:
    answer = json.load(response)

Send a draft order

POST https://kaizenaflow.com/api/admin/v1/drafts/{id}/send

Makes the draft's order (waiting for payment, numbered, stock held until the link ends) and emails the customer its pay link, or answers the link once with create_link. A request for a quote goes as a quote. Refused while it has a problem (blocking).

Path parameters

NameTypeRequiredDescription
idstring (uuid)yesThe thing's id in this store.

Body

JSON, with Content-Type: application/json.

FieldTypeRequiredDescription
versioninteger, at least 1no
valid_daysinteger, 1 to 30noHow long the pay link lasts; the store's own when left out.
create_linkbooleanno, default falsetrue: answer the pay link (once) instead of emailing it to the customer.

Answer

FieldTypeDescription
dataobject
data.draftobject
data.draft.idstring (uuid)
data.draft.numberstringThe draft's own number (D-…); the order it becomes gets the store's next order number.
data.draft.statusone of open, sent, paid, expired, cancelledopen: being made. sent: its order waits for payment. paid, expired or cancelled: ended.
data.draft.sourceone of staff, quotestaff: made in the admin or here. quote: a shopper's request for a quote (D431).
data.draft.quoteone of requested, declined or nullA request for a quote: waiting (requested) or declined; null for any other draft.
data.draft.versionintegerRaised by every change: give it back with a change or a send, and one made since is refused as conflict.
data.draft.marketstringA market, by its code (the country's ISO 3166-1 code, such as NO).
data.draft.currencystring, matching ^[A-Z]{3}$An ISO 4217 code, such as NOK or EUR.
data.draft.customer_idstring (uuid) or null
data.draft.emailstring or null
data.draft.phonestring or null
data.draft.shipping_addressobject
data.draft.shipping_address.namestring
data.draft.shipping_address.line1string
data.draft.shipping_address.line2string
data.draft.shipping_address.postal_codestring
data.draft.shipping_address.citystring
data.draft.shipping_address.countrystring
data.draft.billing_addressobject
data.draft.billing_address.namestring
data.draft.billing_address.line1string
data.draft.billing_address.line2string
data.draft.billing_address.postal_codestring
data.draft.billing_address.citystring
data.draft.billing_address.countrystring
data.draft.company_namestring or null
data.draft.organisation_numberstring or null
data.draft.note_to_buyerstring or null
data.draft.internal_notestring or null
data.draft.request_notestring or nullWhat the shopper wrote with a request for a quote.
data.draft.tagslist of string
data.draft.discountobject or nullA discount staff give on the whole draft, with the words the buyer sees.
data.draft.discount.kindone of percent, amount
data.draft.discount.percentnumber or null
data.draft.discount.amount_minorinteger or nullAn amount in minor units of the currency (øre, cents), VAT included where the store's prices are.
data.draft.discount.labelstring
data.draft.shippingobjectrate: the market's shipping rate. custom: the amount given.
data.draft.shipping.kindone of rate, free, custom
data.draft.shipping.amount_minorinteger or nullAn amount in minor units of the currency (øre, cents), VAT included where the store's prices are.
data.draft.lineslist of objects
data.draft.lines[].idstring (uuid)
data.draft.lines[].kindone of goods, custom
data.draft.lines[].variant_idstring (uuid) or null
data.draft.lines[].skustring
data.draft.lines[].titlestring
data.draft.lines[].quantityinteger
data.draft.lines[].unit_price_minorintegerWhat one unit costs on the draft, VAT included.
data.draft.lines[].list_price_minorinteger or nullThe market's list price when the line was last saved; null for a custom item.
data.draft.lines[].custom_pricebooleanA price given instead of the list price.
data.draft.lines[].price_requestedbooleanA requested product priced on request with no price given yet: the draft cannot be sent until it has one.
data.draft.lines[].vat_categorystring or null
data.draft.total_minorinteger or nullWhat the draft totals now, with shipping, the discount and VAT, as the order would; null when it cannot be worked out yet.
data.draft.blockinglist of stringWhy a send would be refused now, in words; empty when it can be sent.
data.draft.order_idstring (uuid) or nullThe order a sent draft made.
data.draft.sent_atstring (date-time) or null
data.draft.expires_atstring (date-time) or nullWhen a sent draft's pay link ends and its order is cancelled.
data.draft.created_atstring (date-time)
data.draft.updated_atstring (date-time)
data.order_idstring (uuid)
data.order_numberstring
data.expires_atstring (date-time)
data.linkstring or nullThe pay link, answered only this once and only with create_link.
data.emailedone of sent, logged, failed, duplicate, suppressed or null

Errors

StatusCodeWhen
401unauthorizedNo valid token in Authorization: Bearer kf_…, or one that was revoked.
403feature_offThe store has switched off the feature the operation stands behind (Settings, Store features); the message names it.
403forbiddenThe 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.
404not_foundNo such route, or nothing with that id in the token's store (another store's ids are simply not found).
409conflictNothing 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.
422invalidNothing 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.
429rate_limitedMore calls than the budget allows; Retry-After says how many seconds to wait.
500failedSomething 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/drafts/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/send' \
  -H "Authorization: Bearer $KAIZENA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"version":1}'

JavaScript

const response = await fetch("https://kaizenaflow.com/api/admin/v1/drafts/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/send", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "version": 1
  }),
});
const answer = await response.json();

Python

import json
import os
import urllib.request

request = urllib.request.Request(
    "https://kaizenaflow.com/api/admin/v1/drafts/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/send",
    method="POST",
    headers={
        "Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
        "Content-Type": "application/json",
    },
    data=json.dumps({
        "version": 1,
    }).encode(),
)
with urllib.request.urlopen(request) as response:
    answer = json.load(response)

Decline a request for a quote

POST https://kaizenaflow.com/api/admin/v1/drafts/{id}/decline

Declines a shopper's open request for a quote with a short reply they are emailed, as the draft page does.

Path parameters

NameTypeRequiredDescription
idstring (uuid)yesThe thing's id in this store.

Body

JSON, with Content-Type: application/json.

FieldTypeRequiredDescription
replystring, 1 to 1,000 charactersyesWhat the shopper is emailed: why their request is declined.

Answer

FieldTypeDescription
dataobject
data.idstring (uuid)
data.numberstringThe draft's own number (D-…); the order it becomes gets the store's next order number.
data.statusone of open, sent, paid, expired, cancelledopen: being made. sent: its order waits for payment. paid, expired or cancelled: ended.
data.sourceone of staff, quotestaff: made in the admin or here. quote: a shopper's request for a quote (D431).
data.quoteone of requested, declined or nullA request for a quote: waiting (requested) or declined; null for any other draft.
data.versionintegerRaised by every change: give it back with a change or a send, and one made since is refused as conflict.
data.marketstringA market, by its code (the country's ISO 3166-1 code, such as NO).
data.currencystring, matching ^[A-Z]{3}$An ISO 4217 code, such as NOK or EUR.
data.customer_idstring (uuid) or null
data.emailstring or null
data.phonestring or null
data.shipping_addressobject
data.shipping_address.namestring
data.shipping_address.line1string
data.shipping_address.line2string
data.shipping_address.postal_codestring
data.shipping_address.citystring
data.shipping_address.countrystring
data.billing_addressobject
data.billing_address.namestring
data.billing_address.line1string
data.billing_address.line2string
data.billing_address.postal_codestring
data.billing_address.citystring
data.billing_address.countrystring
data.company_namestring or null
data.organisation_numberstring or null
data.note_to_buyerstring or null
data.internal_notestring or null
data.request_notestring or nullWhat the shopper wrote with a request for a quote.
data.tagslist of string
data.discountobject or nullA discount staff give on the whole draft, with the words the buyer sees.
data.discount.kindone of percent, amount
data.discount.percentnumber or null
data.discount.amount_minorinteger or nullAn amount in minor units of the currency (øre, cents), VAT included where the store's prices are.
data.discount.labelstring
data.shippingobjectrate: the market's shipping rate. custom: the amount given.
data.shipping.kindone of rate, free, custom
data.shipping.amount_minorinteger or nullAn amount in minor units of the currency (øre, cents), VAT included where the store's prices are.
data.lineslist of objects
data.lines[].idstring (uuid)
data.lines[].kindone of goods, custom
data.lines[].variant_idstring (uuid) or null
data.lines[].skustring
data.lines[].titlestring
data.lines[].quantityinteger
data.lines[].unit_price_minorintegerWhat one unit costs on the draft, VAT included.
data.lines[].list_price_minorinteger or nullThe market's list price when the line was last saved; null for a custom item.
data.lines[].custom_pricebooleanA price given instead of the list price.
data.lines[].price_requestedbooleanA requested product priced on request with no price given yet: the draft cannot be sent until it has one.
data.lines[].vat_categorystring or null
data.total_minorinteger or nullWhat the draft totals now, with shipping, the discount and VAT, as the order would; null when it cannot be worked out yet.
data.blockinglist of stringWhy a send would be refused now, in words; empty when it can be sent.
data.order_idstring (uuid) or nullThe order a sent draft made.
data.sent_atstring (date-time) or null
data.expires_atstring (date-time) or nullWhen a sent draft's pay link ends and its order is cancelled.
data.created_atstring (date-time)
data.updated_atstring (date-time)

Errors

StatusCodeWhen
401unauthorizedNo valid token in Authorization: Bearer kf_…, or one that was revoked.
403feature_offThe store has switched off the feature the operation stands behind (Settings, Store features); the message names it.
403forbiddenThe 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.
404not_foundNo such route, or nothing with that id in the token's store (another store's ids are simply not found).
409conflictNothing 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.
422invalidNothing 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.
429rate_limitedMore calls than the budget allows; Retry-After says how many seconds to wait.
500failedSomething 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/drafts/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/decline' \
  -H "Authorization: Bearer $KAIZENA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"reply":"example"}'

JavaScript

const response = await fetch("https://kaizenaflow.com/api/admin/v1/drafts/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/decline", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "reply": "example"
  }),
});
const answer = await response.json();

Python

import json
import os
import urllib.request

request = urllib.request.Request(
    "https://kaizenaflow.com/api/admin/v1/drafts/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/decline",
    method="POST",
    headers={
        "Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
        "Content-Type": "application/json",
    },
    data=json.dumps({
        "reply": "example",
    }).encode(),
)
with urllib.request.urlopen(request) as response:
    answer = json.load(response)

Made from the API contract, version 1.57This page as Markdown

Was this page helpful?