KosmoKrator

forms

Formstack Lua API for KosmoKrator Agents

Agent-facing Lua documentation and function reference for the Formstack KosmoKrator integration.

8 functions 6 read 2 write Manual OAuth token auth

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.

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

NameTypeRequiredDescription
pageintegernoPage number for pagination (default: 1)
per_pageintegernoNumber of forms per page (default: 25, max: 200)
searchstringnoSearch 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

NameTypeRequiredDescription
form_idintegeryesThe 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

NameTypeRequiredDescription
form_idintegeryesThe numeric ID of the form
pageintegernoPage number for pagination (default: 1)
per_pageintegernoNumber of submissions per page (default: 25, max: 200)
expand_databooleannoExpand 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

NameTypeRequiredDescription
submission_idintegeryesThe 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

NameTypeRequiredDescription
form_idintegeryesThe numeric ID of the form
fieldsobjectyesObject with field keys and values, e.g. {field_123456 = "John", field_234567 = "[email protected]"}

Example

local result = app.integrations.formstack.create_submission({
  form_id = 12345,
  fields = {
    field_123456 = "Jane Doe",
    field_234567 = "[email protected]",
    field_345678 = "Hello, I have a question..."
  }
})

print("Created submission: " .. result.id)

delete_submission

Delete a submission permanently.

Parameters

NameTypeRequiredDescription
submission_idintegeryesThe 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 = "[email protected]"}` |

### Example

```lua
local result = app.integrations.formstack.create_submission({
  form_id = 12345,
  fields = {
    field_123456 = "Jane Doe",
    field_234567 = "[email protected]",
    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.

Metadata-Derived Lua Example

local result = app.integrations.formstack.formstack_list_forms({
  page = 1,
  per_page = 1,
  search = "example_search"
})
print(result)

Functions

formstack_list_forms

List all forms in your Formstack account. Returns form names, IDs, and pagination info. Use search to filter by name.

Operation
Read read
Full name
formstack.formstack_list_forms
ParameterTypeRequiredDescription
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.

formstack_get_form

Get details and field structure of a specific Formstack form. Returns all fields, their types, labels, and options.

Operation
Read read
Full name
formstack.formstack_get_form
ParameterTypeRequiredDescription
form_id integer yes The numeric ID of the form to retrieve.

formstack_list_submissions

List submissions for a specific Formstack form. Returns submission IDs, timestamps, and optionally expanded field data.

Operation
Read read
Full name
formstack.formstack_list_submissions
ParameterTypeRequiredDescription
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).

formstack_get_submission

Get details of a specific Formstack submission. Returns all field values, timestamps, and metadata.

Operation
Read read
Full name
formstack.formstack_get_submission
ParameterTypeRequiredDescription
submission_id integer yes The numeric ID of the submission to retrieve.

formstack_create_submission

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.

Operation
Write write
Full name
formstack.formstack_create_submission
ParameterTypeRequiredDescription
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": "[email protected]"}. Use Get Form to find field keys.

formstack_delete_submission

Delete a Formstack submission. This action is permanent and cannot be undone.

Operation
Write write
Full name
formstack.formstack_delete_submission
ParameterTypeRequiredDescription
submission_id integer yes The numeric ID of the submission to delete.

formstack_list_folders

List all folders in your Formstack account. Folders are used to organize forms.

Operation
Read read
Full name
formstack.formstack_list_folders
ParameterTypeRequiredDescription
No parameters.

formstack_get_current_user

Get the currently authenticated Formstack user profile. Returns name, email, and account info.

Operation
Read read
Full name
formstack.formstack_get_current_user
ParameterTypeRequiredDescription
No parameters.