KosmoKrator

other

Ipstack Lua API for KosmoKrator Agents

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

7 functions 7 read 0 write API key auth

Lua Namespace

Agents call this integration through app.integrations.ipstack.*. Use lua_read_doc("integrations.ipstack") 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.

IPstack — Lua API Reference

lookup_ip

Look up geolocation data for a single IP address. Returns country, region, city, coordinates, and more.

Parameters

NameTypeRequiredDescription
ipstringyesThe IPv4 or IPv6 address to look up (e.g., "134.201.250.155")
languagestringnoResponse language code (e.g., "en", "de", "fr")

Examples

local result = app.integrations.ipstack.lookup_ip({
  ip = "134.201.250.155"
})

if result.found ~= false then
  print(result.country_name)
  print(result.region_name)
  print(result.city)
  print(result.latitude .. ", " .. result.longitude)
end

lookup_bulk

Look up geolocation data for multiple IP addresses at once (up to 50). Returns an array of geolocation results.

Parameters

NameTypeRequiredDescription
ipsarrayyesArray of IP addresses (max 50, e.g., {"134.201.250.155", "72.229.28.185"})
languagestringnoResponse language code (e.g., "en", "de", "fr")

Examples

local result = app.integrations.ipstack.lookup_bulk({
  ips = { "134.201.250.155", "72.229.28.185", "110.174.165.78" }
})

for _, entry in ipairs(result) do
  print(entry.ip .. " → " .. entry.country_name .. ", " .. entry.city)
end

check_location

Check if an IP address is located in a specific country or region. Returns geolocation data with a location_match boolean.

Parameters

NameTypeRequiredDescription
ipstringyesThe IP address to check (e.g., "134.201.250.155")
country_codestringnoISO 3166-1 alpha-2 country code to match (e.g., "US", "DE", "JP")
region_codestringnoRegion or state code to match (e.g., "CA", "TX")

At least one of country_code or region_code must be provided.

Examples

-- Check if an IP is in the US
local result = app.integrations.ipstack.check_location({
  ip = "134.201.250.155",
  country_code = "US"
})

print("Location match: " .. tostring(result.location_match))
print("Country: " .. result.country_name)
-- Check if an IP is in California, US
local result = app.integrations.ipstack.check_location({
  ip = "134.201.250.155",
  country_code = "US",
  region_code = "CA"
})

get_timezone

Get timezone information for an IP address, including timezone ID, current time, and UTC offset.

Parameters

NameTypeRequiredDescription
ipstringyesThe IP address to look up timezone for (e.g., "134.201.250.155")

Examples

local result = app.integrations.ipstack.get_timezone({
  ip = "134.201.250.155"
})

if result.found ~= false then
  print("Timezone: " .. result.timezone.id)
  print("Current time: " .. result.timezone.current_time)
  print("UTC offset: " .. result.timezone.utc_offset)
end

get_currency

Get local currency information for an IP address, including currency code, name, symbol, and exchange rates.

Parameters

NameTypeRequiredDescription
ipstringyesThe IP address to look up currency for (e.g., "134.201.250.155")

Examples

local result = app.integrations.ipstack.get_currency({
  ip = "134.201.250.155"
})

if result.found ~= false then
  print("Currency: " .. result.currency.name .. " (" .. result.currency.code .. ")")
  print("Symbol: " .. result.currency.symbol)
end

get_connection

Get connection and ISP information for an IP address, including ASN, ISP name, and organization.

Parameters

NameTypeRequiredDescription
ipstringyesThe IP address to look up connection info for (e.g., "134.201.250.155")

Examples

local result = app.integrations.ipstack.get_connection({
  ip = "134.201.250.155"
})

if result.found ~= false then
  print("ISP: " .. result.connection.isp)
  print("ASN: " .. result.connection.asn)
  print("Organization: " .. result.connection.org)
end

get_current_user

Detect and geolocate the current requesting IP address. Useful for identifying the caller’s own location without knowing their IP.

Parameters

None.

Examples

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

if result.found ~= false then
  print("Your IP: " .. result.ip)
  print("Your location: " .. result.country_name .. ", " .. result.city)
end

Multi-Account Usage

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

-- Default account (always works)
app.integrations.ipstack.lookup_ip({ ip = "134.201.250.155" })

-- Explicit default (portable across setups)
app.integrations.ipstack.default.lookup_ip({ ip = "134.201.250.155" })

-- Named accounts
app.integrations.ipstack.production.lookup_ip({ ip = "134.201.250.155" })
app.integrations.ipstack.staging.get_timezone({ ip = "134.201.250.155" })

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

Raw agent markdown
# IPstack — Lua API Reference

## lookup_ip

Look up geolocation data for a single IP address. Returns country, region, city, coordinates, and more.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `ip` | string | yes | The IPv4 or IPv6 address to look up (e.g., `"134.201.250.155"`) |
| `language` | string | no | Response language code (e.g., `"en"`, `"de"`, `"fr"`) |

### Examples

```lua
local result = app.integrations.ipstack.lookup_ip({
  ip = "134.201.250.155"
})

if result.found ~= false then
  print(result.country_name)
  print(result.region_name)
  print(result.city)
  print(result.latitude .. ", " .. result.longitude)
end
```

---

## lookup_bulk

Look up geolocation data for multiple IP addresses at once (up to 50). Returns an array of geolocation results.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `ips` | array | yes | Array of IP addresses (max 50, e.g., `{"134.201.250.155", "72.229.28.185"}`) |
| `language` | string | no | Response language code (e.g., `"en"`, `"de"`, `"fr"`) |

### Examples

```lua
local result = app.integrations.ipstack.lookup_bulk({
  ips = { "134.201.250.155", "72.229.28.185", "110.174.165.78" }
})

for _, entry in ipairs(result) do
  print(entry.ip .. " → " .. entry.country_name .. ", " .. entry.city)
end
```

---

## check_location

Check if an IP address is located in a specific country or region. Returns geolocation data with a `location_match` boolean.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `ip` | string | yes | The IP address to check (e.g., `"134.201.250.155"`) |
| `country_code` | string | no | ISO 3166-1 alpha-2 country code to match (e.g., `"US"`, `"DE"`, `"JP"`) |
| `region_code` | string | no | Region or state code to match (e.g., `"CA"`, `"TX"`) |

At least one of `country_code` or `region_code` must be provided.

### Examples

```lua
-- Check if an IP is in the US
local result = app.integrations.ipstack.check_location({
  ip = "134.201.250.155",
  country_code = "US"
})

print("Location match: " .. tostring(result.location_match))
print("Country: " .. result.country_name)
```

```lua
-- Check if an IP is in California, US
local result = app.integrations.ipstack.check_location({
  ip = "134.201.250.155",
  country_code = "US",
  region_code = "CA"
})
```

---

## get_timezone

Get timezone information for an IP address, including timezone ID, current time, and UTC offset.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `ip` | string | yes | The IP address to look up timezone for (e.g., `"134.201.250.155"`) |

### Examples

```lua
local result = app.integrations.ipstack.get_timezone({
  ip = "134.201.250.155"
})

if result.found ~= false then
  print("Timezone: " .. result.timezone.id)
  print("Current time: " .. result.timezone.current_time)
  print("UTC offset: " .. result.timezone.utc_offset)
end
```

---

## get_currency

Get local currency information for an IP address, including currency code, name, symbol, and exchange rates.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `ip` | string | yes | The IP address to look up currency for (e.g., `"134.201.250.155"`) |

### Examples

```lua
local result = app.integrations.ipstack.get_currency({
  ip = "134.201.250.155"
})

if result.found ~= false then
  print("Currency: " .. result.currency.name .. " (" .. result.currency.code .. ")")
  print("Symbol: " .. result.currency.symbol)
end
```

---

## get_connection

Get connection and ISP information for an IP address, including ASN, ISP name, and organization.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `ip` | string | yes | The IP address to look up connection info for (e.g., `"134.201.250.155"`) |

### Examples

```lua
local result = app.integrations.ipstack.get_connection({
  ip = "134.201.250.155"
})

if result.found ~= false then
  print("ISP: " .. result.connection.isp)
  print("ASN: " .. result.connection.asn)
  print("Organization: " .. result.connection.org)
end
```

---

## get_current_user

Detect and geolocate the current requesting IP address. Useful for identifying the caller's own location without knowing their IP.

### Parameters

None.

### Examples

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

if result.found ~= false then
  print("Your IP: " .. result.ip)
  print("Your location: " .. result.country_name .. ", " .. result.city)
end
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations.ipstack.lookup_ip({ ip = "134.201.250.155" })

-- Explicit default (portable across setups)
app.integrations.ipstack.default.lookup_ip({ ip = "134.201.250.155" })

-- Named accounts
app.integrations.ipstack.production.lookup_ip({ ip = "134.201.250.155" })
app.integrations.ipstack.staging.get_timezone({ ip = "134.201.250.155" })
```

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

Metadata-Derived Lua Example

local result = app.integrations.ipstack.ipstack_lookup_ip({
  ip = "example_ip",
  language = "example_language"
})
print(result)

Functions

ipstack_lookup_ip

Look up geolocation data for a single IP address using IPstack. Returns country, region, city, coordinates, and more.

Operation
Read read
Full name
ipstack.ipstack_lookup_ip
ParameterTypeRequiredDescription
ip string yes The IPv4 or IPv6 address to look up (e.g., "134.201.250.155").
language string no Response language code (e.g., "en", "de", "fr"). Defaults to English.

ipstack_lookup_bulk

Look up geolocation data for multiple IP addresses at once (up to 50). Returns an array of geolocation results.

Operation
Read read
Full name
ipstack.ipstack_lookup_bulk
ParameterTypeRequiredDescription
ips array yes Array of IPv4 or IPv6 addresses to look up (max 50, e.g., ["134.201.250.155", "72.229.28.185"]).
language string no Response language code (e.g., "en", "de", "fr"). Defaults to English.

ipstack_check_location

Check if an IP address is located in a specific country or region. Returns geolocation data with a location match indicator.

Operation
Read read
Full name
ipstack.ipstack_check_location
ParameterTypeRequiredDescription
ip string yes The IP address to check (e.g., "134.201.250.155").
country_code string no ISO 3166-1 alpha-2 country code to match (e.g., "US", "DE", "JP").
region_code string no Region or state code to match (e.g., "CA", "TX").

ipstack_get_timezone

Get timezone information for an IP address, including timezone ID, current time, and UTC offset.

Operation
Read read
Full name
ipstack.ipstack_get_timezone
ParameterTypeRequiredDescription
ip string yes The IP address to look up timezone for (e.g., "134.201.250.155").

ipstack_get_currency

Get local currency information for an IP address, including currency code, name, symbol, and exchange rates.

Operation
Read read
Full name
ipstack.ipstack_get_currency
ParameterTypeRequiredDescription
ip string yes The IP address to look up currency for (e.g., "134.201.250.155").

ipstack_get_connection

Get connection and ISP information for an IP address, including ASN, ISP name, and organization.

Operation
Read read
Full name
ipstack.ipstack_get_connection
ParameterTypeRequiredDescription
ip string yes The IP address to look up connection info for (e.g., "134.201.250.155").

ipstack_get_current_user

Detect and geolocate the current requesting IP address. Returns the caller's own IP geolocation data.

Operation
Read read
Full name
ipstack.ipstack_get_current_user
ParameterTypeRequiredDescription
No parameters.