Forms
The store's forms (D705): read, made and changed with forms:write; their responses read with the right to read customers.
| Operation | Method and path | Scope |
|---|---|---|
| List forms | GET /forms | forms:read |
| Get a form | GET /forms/{id} | forms:read |
| List a form's responses | GET /forms/{id}/responses | forms:read |
| Make a form | POST /forms | forms:write |
| Change a form | PATCH /forms/{id} | forms:write |
List forms
GET https://kaizenaflow.com/api/admin/v1/forms
The store's forms (D705), archived last, newest change first, with their responses counted.
Operation:
forms.listScope:
forms:read, orforms:write, which reads tooAnswers:
200, the answer underdata.
Answer
| Field | Type | Description |
|---|---|---|
data | list of objects | |
data[].id | string (uuid) | |
data[].name | string | The owner's name for it; never shown on the site. |
data[].kind | one of message, signup | A message form, or a newsletter sign-up. |
data[].status | one of active, archived | archived: it shows nothing on the site and takes no responses. |
data[].questions | integer | How many questions it asks (a sign-up's own email and name not counted). |
data[].responses | integer | |
data[].unread | integer | Responses not yet opened in the admin. |
data[].last_response_at | string (date-time) or null | |
data[].updated_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. |
| 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/forms' \
-H "Authorization: Bearer $KAIZENA_TOKEN"JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/forms", {
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/forms",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
},
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)Get a form
GET https://kaizenaflow.com/api/admin/v1/forms/{id}
One form with its draft: what it asks, its words in every language, who it emails and how long it keeps responses.
Operation:
forms.getScope:
forms:read, orforms: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.name | string | The owner's name for it; never shown on the site. |
data.kind | one of message, signup | A message form, or a newsletter sign-up. |
data.status | one of active, archived | archived: it shows nothing on the site and takes no responses. |
data.questions | integer | How many questions it asks (a sign-up's own email and name not counted). |
data.responses | integer | |
data.unread | integer | Responses not yet opened in the admin. |
data.last_response_at | string (date-time) or null | |
data.updated_at | string (date-time) | |
data.made_from | string or null | starter:{key} or template:{id}: what it was made from. Never a link that changes it. |
data.draft | map of string to any | The form as the editor keeps it (kind, name, questions with their words per language, words, delivery, signup, keepMonths): what PATCH takes back whole. |
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/forms/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f' \
-H "Authorization: Bearer $KAIZENA_TOKEN"JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/forms/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/forms/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
},
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)List a form's responses
GET https://kaizenaflow.com/api/admin/v1/forms/{id}/responses
What visitors sent with the form, newest first, as the Responses tab shows them. A response is a person's data: it needs the right to read customers, and goes after the form's own months.
Operation:
forms.responsesScope:
forms:read, orforms: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.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string (uuid) | yes | The thing's id in this store. |
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. |
Answer
| Field | Type | Description |
|---|---|---|
data | list of objects | |
data[].id | string (uuid) | |
data[].answers | list of objects | What the visitor answered, labelled in the owner's language, in the form's order. |
data[].answers[].label | string | |
data[].answers[].value | string | |
data[].contact_email | string or null | The first email address answered, lower case. |
data[].path | string | The page it was sent from. |
data[].locale | string | |
data[].state | one of new, read, archived | |
data[].delivery | one of sent, logged, failed, inbox | How it reached the store: emailed (sent, or only logged without email settings), the email failed, or the support inbox. |
data[].created_at | string (date-time) | |
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. |
| 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/forms/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/responses' \
-H "Authorization: Bearer $KAIZENA_TOKEN"JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/forms/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/responses", {
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/forms/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f/responses",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
},
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)Make a form
POST https://kaizenaflow.com/api/admin/v1/forms
Makes a form from a template, or whole from a draft. It shows on the site only once a page's Form component places it.
Operation:
forms.createScope:
forms:writeAnswers:
201, made: the answer underdata.Once only: with an
Idempotency-Keyheader.
Body
JSON, with Content-Type: application/json.
| Field | Type | Required | Description |
|---|---|---|---|
template_id | string (uuid) | no | A form template the store may use (its own, its owner's other stores', Kaizena Flow's or the marketplace's): the form is made from it in the store's languages, sending to the store's contact address. |
draft | map of string to any | no | The form whole, as GET answers its draft; the editor's own checks run on it. |
Answer
| Field | Type | Description |
|---|---|---|
data | object | |
data.id | string (uuid) | |
data.name | string | The owner's name for it; never shown on the site. |
data.kind | one of message, signup | A message form, or a newsletter sign-up. |
data.status | one of active, archived | archived: it shows nothing on the site and takes no responses. |
data.questions | integer | How many questions it asks (a sign-up's own email and name not counted). |
data.responses | integer | |
data.unread | integer | Responses not yet opened in the admin. |
data.last_response_at | string (date-time) or null | |
data.updated_at | string (date-time) | |
data.made_from | string or null | starter:{key} or template:{id}: what it was made from. Never a link that changes it. |
data.draft | map of string to any | The form as the editor keeps it (kind, name, questions with their words per language, words, delivery, signup, keepMonths): what PATCH takes back whole. |
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/forms' \
-H "Authorization: Bearer $KAIZENA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"template_id":"41872e6b-c6f6-44b6-9980-f2f41db16bc9"}'JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/forms", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"template_id": "41872e6b-c6f6-44b6-9980-f2f41db16bc9"
}),
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/forms",
method="POST",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
"Content-Type": "application/json",
},
data=json.dumps({
"template_id": "41872e6b-c6f6-44b6-9980-f2f41db16bc9",
}).encode(),
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)Change a form
PATCH https://kaizenaflow.com/api/admin/v1/forms/{id}
Saves the form's draft whole: a page that places it shows the change at once.
Operation:
forms.updateScope:
forms:writeAnswers:
200, the answer underdata.
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 |
|---|---|---|---|
draft | map of string to any | yes | The form whole, as GET answers its draft (read it first); its kind never changes. The editor's own checks run on it. |
Answer
| Field | Type | Description |
|---|---|---|
data | object | |
data.id | string (uuid) | |
data.name | string | The owner's name for it; never shown on the site. |
data.kind | one of message, signup | A message form, or a newsletter sign-up. |
data.status | one of active, archived | archived: it shows nothing on the site and takes no responses. |
data.questions | integer | How many questions it asks (a sign-up's own email and name not counted). |
data.responses | integer | |
data.unread | integer | Responses not yet opened in the admin. |
data.last_response_at | string (date-time) or null | |
data.updated_at | string (date-time) | |
data.made_from | string or null | starter:{key} or template:{id}: what it was made from. Never a link that changes it. |
data.draft | map of string to any | The form as the editor keeps it (kind, name, questions with their words per language, words, delivery, signup, keepMonths): what PATCH takes back whole. |
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 -X PATCH 'https://kaizenaflow.com/api/admin/v1/forms/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f' \
-H "Authorization: Bearer $KAIZENA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"draft":{"example":"example"}}'JavaScript
const response = await fetch("https://kaizenaflow.com/api/admin/v1/forms/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f", {
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.KAIZENA_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"draft": {
"example": "example"
}
}),
});
const answer = await response.json();Python
import json
import os
import urllib.request
request = urllib.request.Request(
"https://kaizenaflow.com/api/admin/v1/forms/3f2b8c1e-6d4a-4b9e-8c7f-1a2b3c4d5e6f",
method="PATCH",
headers={
"Authorization": "Bearer " + os.environ["KAIZENA_TOKEN"],
"Content-Type": "application/json",
},
data=json.dumps({
"draft": {
"example": "example",
},
}).encode(),
)
with urllib.request.urlopen(request) as response:
answer = json.load(response)