KosmoKrator

data

Netlify Lua API for KosmoKrator Agents

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

Lua Namespace

Agents call this integration through app.integrations.netlify.*. Use lua_read_doc("integrations.netlify") 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 Netlify workflow without starting an interactive agent session.

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.netlify.create_deploy({site_id = "example_site_id", title = "example_title", branch = "example_branch", framework = "example_framework", body = "example_body"}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("netlify"))' --json
kosmo integrations:lua --eval 'print(docs.read("netlify.create_deploy"))' --json

Workflow file

Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.

workflow.lua
local netlify = app.integrations.netlify
local result = netlify.create_deploy({site_id = "example_site_id", title = "example_title", branch = "example_branch", framework = "example_framework", body = "example_body"})

dump(result)
Run the workflow
kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json
Namespace note. integrations:lua exposes app.integrations.netlify, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.netlify.default.* or app.integrations.netlify.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need Netlify, use the narrower mcp:lua command.

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.

Netlify — Lua API Reference

create_site

Create a new Netlify site.

Parameters

NameTypeRequiredDescription
namestringyesName for the site
custom_domainstringnoCustom domain to assign to the site
repoobjectnoRepository configuration for continuous deployment
bodyobjectnoAdditional site configuration fields

Example

local result = app.integrations.netlify.create_site({
  name = "agent-preview",
  body = {
    password = "preview-password"
  }
})

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

list_sites

List all Netlify sites.

Parameters

NameTypeRequiredDescription
namestringnoFilter by site name
pageintegernoPage number for pagination (default: 1)
per_pageintegernoNumber of sites per page (default: 30)

Examples

-- List all sites
local result = app.integrations.netlify.list_sites({})

for _, site in ipairs(result.sites) do
  print(site.name .. " (" .. site.state .. ") - " .. site.url)
end
-- Filter by name
local result = app.integrations.netlify.list_sites({
  name = "my-site"
})

get_site

Get detailed information about a specific Netlify site.

Parameters

NameTypeRequiredDescription
site_idstringyesThe site identifier or site name (e.g., “abc123” or “mysite.netlify.app”)

Examples

local result = app.integrations.netlify.get_site({
  site_id = "abc123-def456"
})

print("Site: " .. result.name)
print("URL: " .. result.ssl_url)
print("State: " .. result.state)
print("Custom domain: " .. (result.custom_domain or "none"))

delete_site

Delete a Netlify site permanently.

Parameters

NameTypeRequiredDescription
site_idstringyesThe Netlify site ID to delete

Example

app.integrations.netlify.delete_site({
  site_id = "abc123-def456"
})

create_deploy

Trigger a new deploy for a Netlify site. The deploy body should follow Netlify’s deploy API shape, such as file digests for atomic deploys or deploy options supported by the API.

Parameters

NameTypeRequiredDescription
site_idstringyesThe Netlify site ID
titlestringnoDeploy title, sent as a Netlify API query parameter
branchstringnoBranch to deploy
frameworkstringnoFramework override
bodyobjectnoAdditional deploy body fields

Example

local result = app.integrations.netlify.create_deploy({
  site_id = "abc123-def456",
  title = "Agent deploy",
  body = {
    async = true
  }
})

print("Deploy: " .. result.id .. " " .. result.state)

list_deploys

List deploys for a Netlify site.

Parameters

NameTypeRequiredDescription
site_idstringyesThe site identifier
pageintegernoPage number for pagination (default: 1)
per_pageintegernoNumber of deploys per page (default: 30)

Examples

local result = app.integrations.netlify.list_deploys({
  site_id = "abc123-def456"
})

for _, deploy in ipairs(result.deploys) do
  print(deploy.state .. " - " .. (deploy.branch or "unknown") .. " @ " .. deploy.created_at)
end

get_deploy

Get detailed information about a specific Netlify deploy.

Parameters

NameTypeRequiredDescription
deploy_idstringyesThe deploy identifier

Examples

local result = app.integrations.netlify.get_deploy({
  deploy_id = "789xyz"
})

print("State: " .. result.state)
print("Branch: " .. (result.branch or "unknown"))
print("Deploy time: " .. (result.deploy_time or 0) .. "s")
print("URL: " .. (result.deploy_url or "N/A"))

list_forms

List all forms for a Netlify site.

Parameters

NameTypeRequiredDescription
site_idstringyesThe site identifier

Examples

local result = app.integrations.netlify.list_forms({
  site_id = "abc123-def456"
})

for _, form in ipairs(result.forms) do
  print(form.name .. " - " .. form.submission_count .. " submissions")
end

list_dns_zones

List all DNS zones configured in Netlify.

Parameters

NameTypeRequiredDescription
pageintegernoPage number for pagination
per_pageintegernoNumber of DNS zones per page

Examples

local result = app.integrations.netlify.list_dns_zones({})

for _, zone in ipairs(result.dns_zones) do
  print(zone.name .. " (" .. (zone.domain or "N/A") .. ")")
  for _, ns in ipairs(zone.nameservers) do
    print("  NS: " .. ns)
  end
end

get_current_user

Get details of the currently authenticated Netlify user.

Parameters

None.

Examples

local result = app.integrations.netlify.get_current_user({})

print("User: " .. (result.full_name or result.email))
print("Email: " .. result.email)
print("Sites: " .. (result.site_count or 0))

Multi-Account Usage

If you have multiple Netlify accounts configured, use account-specific namespaces:

-- Default account (always works)
app.integrations.netlify.function_name({...})

-- Explicit default (portable across setups)
app.integrations.netlify.default.function_name({...})

-- Named accounts
app.integrations.netlify.production.function_name({...})
app.integrations.netlify.staging.function_name({...})

All functions are identical across accounts — only the credentials differ.

Raw agent markdown
# Netlify — Lua API Reference

## create_site

Create a new Netlify site.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `name` | string | yes | Name for the site |
| `custom_domain` | string | no | Custom domain to assign to the site |
| `repo` | object | no | Repository configuration for continuous deployment |
| `body` | object | no | Additional site configuration fields |

### Example

```lua
local result = app.integrations.netlify.create_site({
  name = "agent-preview",
  body = {
    password = "preview-password"
  }
})

print("Created site: " .. result.id)
```

---

## list_sites

List all Netlify sites.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `name` | string | no | Filter by site name |
| `page` | integer | no | Page number for pagination (default: 1) |
| `per_page` | integer | no | Number of sites per page (default: 30) |

### Examples

```lua
-- List all sites
local result = app.integrations.netlify.list_sites({})

for _, site in ipairs(result.sites) do
  print(site.name .. " (" .. site.state .. ") - " .. site.url)
end
```

```lua
-- Filter by name
local result = app.integrations.netlify.list_sites({
  name = "my-site"
})
```

---

## get_site

Get detailed information about a specific Netlify site.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `site_id` | string | yes | The site identifier or site name (e.g., "abc123" or "mysite.netlify.app") |

### Examples

```lua
local result = app.integrations.netlify.get_site({
  site_id = "abc123-def456"
})

print("Site: " .. result.name)
print("URL: " .. result.ssl_url)
print("State: " .. result.state)
print("Custom domain: " .. (result.custom_domain or "none"))
```

---

## delete_site

Delete a Netlify site permanently.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `site_id` | string | yes | The Netlify site ID to delete |

### Example

```lua
app.integrations.netlify.delete_site({
  site_id = "abc123-def456"
})
```

---

## create_deploy

Trigger a new deploy for a Netlify site. The deploy body should follow Netlify's deploy API shape, such as file digests for atomic deploys or deploy options supported by the API.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `site_id` | string | yes | The Netlify site ID |
| `title` | string | no | Deploy title, sent as a Netlify API query parameter |
| `branch` | string | no | Branch to deploy |
| `framework` | string | no | Framework override |
| `body` | object | no | Additional deploy body fields |

### Example

```lua
local result = app.integrations.netlify.create_deploy({
  site_id = "abc123-def456",
  title = "Agent deploy",
  body = {
    async = true
  }
})

print("Deploy: " .. result.id .. " " .. result.state)
```

---

## list_deploys

List deploys for a Netlify site.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `site_id` | string | yes | The site identifier |
| `page` | integer | no | Page number for pagination (default: 1) |
| `per_page` | integer | no | Number of deploys per page (default: 30) |

### Examples

```lua
local result = app.integrations.netlify.list_deploys({
  site_id = "abc123-def456"
})

for _, deploy in ipairs(result.deploys) do
  print(deploy.state .. " - " .. (deploy.branch or "unknown") .. " @ " .. deploy.created_at)
end
```

---

## get_deploy

Get detailed information about a specific Netlify deploy.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `deploy_id` | string | yes | The deploy identifier |

### Examples

```lua
local result = app.integrations.netlify.get_deploy({
  deploy_id = "789xyz"
})

print("State: " .. result.state)
print("Branch: " .. (result.branch or "unknown"))
print("Deploy time: " .. (result.deploy_time or 0) .. "s")
print("URL: " .. (result.deploy_url or "N/A"))
```

---

## list_forms

List all forms for a Netlify site.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `site_id` | string | yes | The site identifier |

### Examples

```lua
local result = app.integrations.netlify.list_forms({
  site_id = "abc123-def456"
})

for _, form in ipairs(result.forms) do
  print(form.name .. " - " .. form.submission_count .. " submissions")
end
```

---

## list_dns_zones

List all DNS zones configured in Netlify.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number for pagination |
| `per_page` | integer | no | Number of DNS zones per page |

### Examples

```lua
local result = app.integrations.netlify.list_dns_zones({})

for _, zone in ipairs(result.dns_zones) do
  print(zone.name .. " (" .. (zone.domain or "N/A") .. ")")
  for _, ns in ipairs(zone.nameservers) do
    print("  NS: " .. ns)
  end
end
```

---

## get_current_user

Get details of the currently authenticated Netlify user.

### Parameters

None.

### Examples

```lua
local result = app.integrations.netlify.get_current_user({})

print("User: " .. (result.full_name or result.email))
print("Email: " .. result.email)
print("Sites: " .. (result.site_count or 0))
```

---

## Multi-Account Usage

If you have multiple Netlify accounts configured, use account-specific namespaces:

```lua
-- Default account (always works)
app.integrations.netlify.function_name({...})

-- Explicit default (portable across setups)
app.integrations.netlify.default.function_name({...})

-- Named accounts
app.integrations.netlify.production.function_name({...})
app.integrations.netlify.staging.function_name({...})
```

All functions are identical across accounts — only the credentials differ.
Metadata-derived Lua example
local result = app.integrations.netlify.create_deploy({site_id = "example_site_id", title = "example_title", branch = "example_branch", framework = "example_framework", body = "example_body"})
print(result)

Functions

create_deploy Write

Trigger a new deploy for a Netlify site. Optionally specify a title, branch, or framework override.

Lua path
app.integrations.netlify.create_deploy
Full name
netlify.netlify_create_deploy
ParameterTypeRequiredDescription
site_id string yes The Netlify site ID.
title string no Title for the deploy.
branch string no Branch to deploy (e.g., "main", "staging"). Defaults to the site's production branch.
framework string no Framework override (e.g., "nextjs", "nuxt", "hugo", "gatsby").
body object no Additional deploy configuration fields.
create_site Write

Create a new Netlify site. Provide a name and optional configuration like custom domain, build settings, or repository.

Lua path
app.integrations.netlify.create_site
Full name
netlify.netlify_create_site
ParameterTypeRequiredDescription
name string yes Name for the site. Used as the default subdomain (e.g., "my-site" becomes my-site.netlify.app).
custom_domain string no Custom domain to assign to the site (e.g., "www.example.com").
repo object no Repository configuration for continuous deployment. Includes provider, repo path, branch, build command, and publish directory.
body object no Additional site configuration fields (e.g., password, processing_settings).
delete_site Write

Delete a Netlify site permanently. This removes all deploys, forms, and associated data. This action cannot be undone.

Lua path
app.integrations.netlify.delete_site
Full name
netlify.netlify_delete_site
ParameterTypeRequiredDescription
site_id string yes The Netlify site ID to delete.
get_current_user Read

Get details of the currently authenticated Netlify user. Returns user ID, email, name, and account info.

Lua path
app.integrations.netlify.get_current_user
Full name
netlify.netlify_get_current_user
ParameterTypeRequiredDescription
No parameters.
get_deploy Read

Get detailed information about a specific Netlify deploy, including its state, build log, and commit details.

Lua path
app.integrations.netlify.get_deploy
Full name
netlify.netlify_get_deploy
ParameterTypeRequiredDescription
deploy_id string yes The deploy identifier.
get_site Read

Get detailed information about a specific Netlify site, including its ID, name, URL, build settings, and deploy status.

Lua path
app.integrations.netlify.get_site
Full name
netlify.netlify_get_site
ParameterTypeRequiredDescription
site_id string yes The site identifier or site name (e.g., "abc123" or "mysite.netlify.app").
list_deploys Read

List deploys for a Netlify site. Returns deploy IDs, states, branches, and commit references.

Lua path
app.integrations.netlify.list_deploys
Full name
netlify.netlify_list_deploys
ParameterTypeRequiredDescription
site_id string yes The site identifier.
page integer no Page number for pagination (default: 1).
per_page integer no Number of deploys per page (default: 30).
list_dns_zones Read

List all DNS zones configured in Netlify. Returns zone IDs, domain names, and nameservers.

Lua path
app.integrations.netlify.list_dns_zones
Full name
netlify.netlify_list_dns_zones
ParameterTypeRequiredDescription
page integer no Page number for pagination.
per_page integer no Number of DNS zones per page.
list_forms Read

List all forms for a Netlify site. Returns form IDs, names, paths, and submission counts.

Lua path
app.integrations.netlify.list_forms
Full name
netlify.netlify_list_forms
ParameterTypeRequiredDescription
site_id string yes The site identifier.
list_sites Read

List all Netlify sites. Returns site IDs, names, URLs, and build status. Use this to discover site identifiers needed for deploy and form operations.

Lua path
app.integrations.netlify.list_sites
Full name
netlify.netlify_list_sites
ParameterTypeRequiredDescription
name string no Filter by site name.
page integer no Page number for pagination (default: 1).
per_page integer no Number of sites per page (default: 30).