productivity
Formstack Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Formstack KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.formstack.*.
Use lua_read_doc("integrations.formstack") inside KosmoKrator to discover the same reference at runtime.
Call Lua from the Headless CLI
Use kosmo integrations:lua when a shell script, CI job, cron job, or another coding CLI should run a deterministic
Formstack workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.formstack.list({page = 1, per_page = 1, search = "example_search"}))' --json kosmo integrations:lua --eval 'print(docs.read("formstack"))' --json
kosmo integrations:lua --eval 'print(docs.read("formstack.list"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local formstack = app.integrations.formstack
local result = formstack.list({page = 1, per_page = 1, search = "example_search"})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.formstack, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.formstack.default.* or app.integrations.formstack.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Formstack, use the narrower mcp:lua command.
# Use mcp:lua for MCP-only scripts; use integrations:lua for this integration namespace.
kosmo mcp:lua --eval 'dump(mcp.servers())' --json Agent-Facing Lua Docs
This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.
Formstack — Lua API Reference
list_forms
List all forms in your Formstack account.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number for pagination (default: 1) |
per_page | integer | no | Number of forms per page (default: 25, max: 200) |
search | string | no | Search string to filter forms by name |
Example
local result = app.integrations.formstack.list_forms({
page = 1,
per_page = 25
})
for _, form in ipairs(result.forms) do
print(form.id .. ": " .. form.name)
end
get_form
Get details and field structure of a specific form.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
form_id | integer | yes | The numeric ID of the form |
Example
local form = app.integrations.formstack.get_form({
form_id = 12345
})
print("Form: " .. form.name)
for _, field in ipairs(form.fields) do
print(" " .. field.label .. " (" .. field.type .. ") = field key: " .. field.name)
end
list_submissions
List submissions for a specific form.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
form_id | integer | yes | The numeric ID of the form |
page | integer | no | Page number for pagination (default: 1) |
per_page | integer | no | Number of submissions per page (default: 25, max: 200) |
expand_data | boolean | no | Expand submission data with field labels (default: false) |
Example
local result = app.integrations.formstack.list_submissions({
form_id = 12345,
per_page = 10,
expand_data = true
})
for _, sub in ipairs(result.submissions) do
print("Submission " .. sub.id .. " at " .. sub.timestamp)
end
get_submission
Get details of a specific submission.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
submission_id | integer | yes | The numeric ID of the submission |
Example
local sub = app.integrations.formstack.get_submission({
submission_id = 67890
})
print("Submission " .. sub.id)
for key, value in pairs(sub.data) do
print(" " .. key .. " = " .. tostring(value))
end
create_submission
Create a new submission for a form. Use get_form first to discover available field keys.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
form_id | integer | yes | The numeric ID of the form |
fields | object | yes | Object with field keys and values, e.g. {field_123456 = "John", field_234567 = "john@example.com"} |
Example
local result = app.integrations.formstack.create_submission({
form_id = 12345,
fields = {
field_123456 = "Jane Doe",
field_234567 = "jane@example.com",
field_345678 = "Hello, I have a question..."
}
})
print("Created submission: " .. result.id)
delete_submission
Delete a submission permanently.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
submission_id | integer | yes | The numeric ID of the submission to delete |
Example
app.integrations.formstack.delete_submission({
submission_id = 67890
})
print("Submission deleted")
list_folders
List all folders in your Formstack account.
Parameters
None.
Example
local result = app.integrations.formstack.list_folders()
for _, folder in ipairs(result.folders) do
print(folder.id .. ": " .. folder.name)
end
get_current_user
Get the currently authenticated user’s profile.
Parameters
None.
Example
local user = app.integrations.formstack.get_current_user({})
print("Logged in as: " .. user.first_name .. " " .. user.last_name .. " (" .. user.email .. ")")
Multi-Account Usage
If you have multiple Formstack accounts configured, use account-specific namespaces:
-- Default account (always works)
app.integrations.formstack.function_name({...})
-- Explicit default (portable across setups)
app.integrations.formstack.default.function_name({...})
-- Named accounts
app.integrations.formstack.work.function_name({...})
app.integrations.formstack.personal.function_name({...})
All functions are identical across accounts — only the credentials differ.
Raw agent markdown
# Formstack — Lua API Reference
## list_forms
List all forms in your Formstack account.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number for pagination (default: 1) |
| `per_page` | integer | no | Number of forms per page (default: 25, max: 200) |
| `search` | string | no | Search string to filter forms by name |
### Example
```lua
local result = app.integrations.formstack.list_forms({
page = 1,
per_page = 25
})
for _, form in ipairs(result.forms) do
print(form.id .. ": " .. form.name)
end
```
---
## get_form
Get details and field structure of a specific form.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `form_id` | integer | yes | The numeric ID of the form |
### Example
```lua
local form = app.integrations.formstack.get_form({
form_id = 12345
})
print("Form: " .. form.name)
for _, field in ipairs(form.fields) do
print(" " .. field.label .. " (" .. field.type .. ") = field key: " .. field.name)
end
```
---
## list_submissions
List submissions for a specific form.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `form_id` | integer | yes | The numeric ID of the form |
| `page` | integer | no | Page number for pagination (default: 1) |
| `per_page` | integer | no | Number of submissions per page (default: 25, max: 200) |
| `expand_data` | boolean | no | Expand submission data with field labels (default: false) |
### Example
```lua
local result = app.integrations.formstack.list_submissions({
form_id = 12345,
per_page = 10,
expand_data = true
})
for _, sub in ipairs(result.submissions) do
print("Submission " .. sub.id .. " at " .. sub.timestamp)
end
```
---
## get_submission
Get details of a specific submission.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `submission_id` | integer | yes | The numeric ID of the submission |
### Example
```lua
local sub = app.integrations.formstack.get_submission({
submission_id = 67890
})
print("Submission " .. sub.id)
for key, value in pairs(sub.data) do
print(" " .. key .. " = " .. tostring(value))
end
```
---
## create_submission
Create a new submission for a form. Use `get_form` first to discover available field keys.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `form_id` | integer | yes | The numeric ID of the form |
| `fields` | object | yes | Object with field keys and values, e.g. `{field_123456 = "John", field_234567 = "john@example.com"}` |
### Example
```lua
local result = app.integrations.formstack.create_submission({
form_id = 12345,
fields = {
field_123456 = "Jane Doe",
field_234567 = "jane@example.com",
field_345678 = "Hello, I have a question..."
}
})
print("Created submission: " .. result.id)
```
---
## delete_submission
Delete a submission permanently.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `submission_id` | integer | yes | The numeric ID of the submission to delete |
### Example
```lua
app.integrations.formstack.delete_submission({
submission_id = 67890
})
print("Submission deleted")
```
---
## list_folders
List all folders in your Formstack account.
### Parameters
None.
### Example
```lua
local result = app.integrations.formstack.list_folders()
for _, folder in ipairs(result.folders) do
print(folder.id .. ": " .. folder.name)
end
```
---
## get_current_user
Get the currently authenticated user's profile.
### Parameters
None.
### Example
```lua
local user = app.integrations.formstack.get_current_user({})
print("Logged in as: " .. user.first_name .. " " .. user.last_name .. " (" .. user.email .. ")")
```
---
## Multi-Account Usage
If you have multiple Formstack accounts configured, use account-specific namespaces:
```lua
-- Default account (always works)
app.integrations.formstack.function_name({...})
-- Explicit default (portable across setups)
app.integrations.formstack.default.function_name({...})
-- Named accounts
app.integrations.formstack.work.function_name({...})
app.integrations.formstack.personal.function_name({...})
```
All functions are identical across accounts — only the credentials differ. local result = app.integrations.formstack.list({page = 1, per_page = 1, search = "example_search"})
print(result) Functions
list Read
List all forms in your Formstack account. Returns form names, IDs, and pagination info. Use search to filter by name.
- Lua path
app.integrations.formstack.list- Full name
formstack.formstack_list_forms
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number for pagination (default: 1). |
per_page | integer | no | Number of forms per page (default: 25, max: 200). |
search | string | no | Optional search string to filter forms by name. |
get Read
Get details and field structure of a specific Formstack form. Returns all fields, their types, labels, and options.
- Lua path
app.integrations.formstack.get- Full name
formstack.formstack_get_form
| Parameter | Type | Required | Description |
|---|---|---|---|
form_id | integer | yes | The numeric ID of the form to retrieve. |
list_submissions Read
List submissions for a specific Formstack form. Returns submission IDs, timestamps, and optionally expanded field data.
- Lua path
app.integrations.formstack.list_submissions- Full name
formstack.formstack_list_submissions
| Parameter | Type | Required | Description |
|---|---|---|---|
form_id | integer | yes | The numeric ID of the form. |
page | integer | no | Page number for pagination (default: 1). |
per_page | integer | no | Number of submissions per page (default: 25, max: 200). |
expand_data | boolean | no | Whether to expand submission data with field labels (default: false). |
get_submission Read
Get details of a specific Formstack submission. Returns all field values, timestamps, and metadata.
- Lua path
app.integrations.formstack.get_submission- Full name
formstack.formstack_get_submission
| Parameter | Type | Required | Description |
|---|---|---|---|
submission_id | integer | yes | The numeric ID of the submission to retrieve. |
create_submission Write
Create a new submission for a Formstack form. Pass field values using the field keys from the form structure. Use Get Form first to discover available fields.
- Lua path
app.integrations.formstack.create_submission- Full name
formstack.formstack_create_submission
| Parameter | Type | Required | Description |
|---|---|---|---|
form_id | integer | yes | The numeric ID of the form to submit to. |
fields | object | yes | Object with field keys and their values. E.g. {"field_123456": "John Doe", "field_234567": "john@example.com"}. Use Get Form to find field keys. |
delete_submission Write
Delete a Formstack submission. This action is permanent and cannot be undone.
- Lua path
app.integrations.formstack.delete_submission- Full name
formstack.formstack_delete_submission
| Parameter | Type | Required | Description |
|---|---|---|---|
submission_id | integer | yes | The numeric ID of the submission to delete. |
list_folders Read
List all folders in your Formstack account. Folders are used to organize forms.
- Lua path
app.integrations.formstack.list_folders- Full name
formstack.formstack_list_folders
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_current_user Read
Get the currently authenticated Formstack user profile. Returns name, email, and account info.
- Lua path
app.integrations.formstack.get_current_user- Full name
formstack.formstack_get_current_user
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||