KosmoKrator

productivity

Instapaper Lua API for KosmoKrator Agents

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

Lua Namespace

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

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.instapaper.get_access_token({}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("instapaper"))' --json
kosmo integrations:lua --eval 'print(docs.read("instapaper.get_access_token"))' --json

Workflow file

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

workflow.lua
local instapaper = app.integrations.instapaper
local result = instapaper.get_access_token({})

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.instapaper, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.instapaper.default.* or app.integrations.instapaper.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need Instapaper, 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.

Instapaper

Namespace: instapaper

Use this integration to save URLs, inspect reading queues, organize folders, update read progress, retrieve article text, and manage bookmark highlights. The Full API uses OAuth 1.0a headers; OAuth parameters are signed by the integration and are not sent in the request body.

Authentication

Full API tools require consumer_key, consumer_secret, oauth_token, and oauth_token_secret.

instapaper_get_access_token exchanges xAuth username/password for oauth_token and oauth_token_secret. It requires only the consumer key and consumer secret from configuration plus safe runtime arguments:

instapaper_get_access_token({
  x_auth_username = "[email protected]",
  x_auth_password = "fake-password"
})

Simple API tools may use configured simple_username and simple_password, or explicit runtime username and password arguments. Do not store or log real passwords in agent-visible output.

Bookmarks

Save and inspect bookmarks:

instapaper_add_bookmark({
  url = "https://example.test/article",
  payload = {
    title = "Example Article",
    selection = "Short note",
    folder_id = "12345"
  }
})

instapaper_list_bookmarks({
  payload = {
    folder_id = "unread",
    limit = 25
  }
})

Bookmark mutation tools take bookmark_id: instapaper_delete_bookmark, instapaper_star_bookmark, instapaper_unstar_bookmark, instapaper_archive_bookmark, and instapaper_unarchive_bookmark.

instapaper_move_bookmark takes bookmark_id and folder_id. instapaper_update_read_progress takes bookmark_id, progress, and optional timestamp fields in payload.

instapaper_get_bookmark_text returns readable article HTML as value when the API responds with text instead of JSON.

Folders

Use instapaper_list_folders, instapaper_add_folder, instapaper_delete_folder, and instapaper_set_folder_order.

instapaper_add_folder({ title = "Research" })

instapaper_set_folder_order({
  folder_ids = "12345,67890"
})

Highlights

Highlights use the newer /api/1.1 paths. The integration interpolates bookmark and highlight ids into the URL.

instapaper_list_highlights({ bookmark_id = "111" })

instapaper_create_highlight({
  bookmark_id = "111",
  text = "Important passage",
  payload = {
    note = "Use in brief"
  }
})

instapaper_delete_highlight({ highlight_id = "222" })

Simple API

The Simple API is useful for quick credential checks or simple URL saves without the Full API token pair.

instapaper_simple_authenticate({
  username = "[email protected]",
  password = "fake-password"
})

instapaper_simple_add_url({
  username = "[email protected]",
  password = "fake-password",
  url = "https://example.test/post",
  payload = {
    title = "Example Post",
    selection = "Save for later"
  }
})

Simple API responses include status and either success, value, or parsed response fields depending on the upstream body.

Raw Full API POST

instapaper_api_post calls a safe relative Full API path with OAuth signing. It rejects absolute URLs.

instapaper_api_post({
  path = "/api/1/bookmarks/list",
  payload = { limit = 10 }
})
Raw agent markdown
# Instapaper

Namespace: `instapaper`

Use this integration to save URLs, inspect reading queues, organize folders, update read progress, retrieve article text, and manage bookmark highlights. The Full API uses OAuth 1.0a headers; OAuth parameters are signed by the integration and are not sent in the request body.

## Authentication

Full API tools require `consumer_key`, `consumer_secret`, `oauth_token`, and `oauth_token_secret`.

`instapaper_get_access_token` exchanges xAuth username/password for `oauth_token` and `oauth_token_secret`. It requires only the consumer key and consumer secret from configuration plus safe runtime arguments:

```lua
instapaper_get_access_token({
  x_auth_username = "[email protected]",
  x_auth_password = "fake-password"
})
```

Simple API tools may use configured `simple_username` and `simple_password`, or explicit runtime `username` and `password` arguments. Do not store or log real passwords in agent-visible output.

## Bookmarks

Save and inspect bookmarks:

```lua
instapaper_add_bookmark({
  url = "https://example.test/article",
  payload = {
    title = "Example Article",
    selection = "Short note",
    folder_id = "12345"
  }
})

instapaper_list_bookmarks({
  payload = {
    folder_id = "unread",
    limit = 25
  }
})
```

Bookmark mutation tools take `bookmark_id`: `instapaper_delete_bookmark`, `instapaper_star_bookmark`, `instapaper_unstar_bookmark`, `instapaper_archive_bookmark`, and `instapaper_unarchive_bookmark`.

`instapaper_move_bookmark` takes `bookmark_id` and `folder_id`. `instapaper_update_read_progress` takes `bookmark_id`, `progress`, and optional timestamp fields in `payload`.

`instapaper_get_bookmark_text` returns readable article HTML as `value` when the API responds with text instead of JSON.

## Folders

Use `instapaper_list_folders`, `instapaper_add_folder`, `instapaper_delete_folder`, and `instapaper_set_folder_order`.

```lua
instapaper_add_folder({ title = "Research" })

instapaper_set_folder_order({
  folder_ids = "12345,67890"
})
```

## Highlights

Highlights use the newer `/api/1.1` paths. The integration interpolates bookmark and highlight ids into the URL.

```lua
instapaper_list_highlights({ bookmark_id = "111" })

instapaper_create_highlight({
  bookmark_id = "111",
  text = "Important passage",
  payload = {
    note = "Use in brief"
  }
})

instapaper_delete_highlight({ highlight_id = "222" })
```

## Simple API

The Simple API is useful for quick credential checks or simple URL saves without the Full API token pair.

```lua
instapaper_simple_authenticate({
  username = "[email protected]",
  password = "fake-password"
})

instapaper_simple_add_url({
  username = "[email protected]",
  password = "fake-password",
  url = "https://example.test/post",
  payload = {
    title = "Example Post",
    selection = "Save for later"
  }
})
```

Simple API responses include `status` and either `success`, `value`, or parsed response fields depending on the upstream body.

## Raw Full API POST

`instapaper_api_post` calls a safe relative Full API path with OAuth signing. It rejects absolute URLs.

```lua
instapaper_api_post({
  path = "/api/1/bookmarks/list",
  payload = { limit = 10 }
})
```
Metadata-derived Lua example
local result = app.integrations.instapaper.get_access_token({})
print(result)

Functions

get_access_token Write

Exchange xAuth username and password for an Instapaper OAuth access token.

Lua path
app.integrations.instapaper.get_access_token
Full name
instapaper.instapaper_get_access_token
ParameterTypeRequiredDescription
No parameters.
verify_credentials Read

Verify the Instapaper OAuth credentials.

Lua path
app.integrations.instapaper.verify_credentials
Full name
instapaper.instapaper_verify_credentials
ParameterTypeRequiredDescription
No parameters.
list_bookmarks Read

List Instapaper bookmarks.

Lua path
app.integrations.instapaper.list_bookmarks
Full name
instapaper.instapaper_list_bookmarks
ParameterTypeRequiredDescription
No parameters.
update_read_progress Write

Update bookmark reading progress.

Lua path
app.integrations.instapaper.update_read_progress
Full name
instapaper.instapaper_update_read_progress
ParameterTypeRequiredDescription
No parameters.
add_bookmark Write

Add a URL to Instapaper.

Lua path
app.integrations.instapaper.add_bookmark
Full name
instapaper.instapaper_add_bookmark
ParameterTypeRequiredDescription
No parameters.
delete_bookmark Write

Delete an Instapaper bookmark.

Lua path
app.integrations.instapaper.delete_bookmark
Full name
instapaper.instapaper_delete_bookmark
ParameterTypeRequiredDescription
No parameters.
star_bookmark Write

Star an Instapaper bookmark.

Lua path
app.integrations.instapaper.star_bookmark
Full name
instapaper.instapaper_star_bookmark
ParameterTypeRequiredDescription
No parameters.
unstar_bookmark Write

Remove a star from an Instapaper bookmark.

Lua path
app.integrations.instapaper.unstar_bookmark
Full name
instapaper.instapaper_unstar_bookmark
ParameterTypeRequiredDescription
No parameters.
archive_bookmark Write

Archive an Instapaper bookmark.

Lua path
app.integrations.instapaper.archive_bookmark
Full name
instapaper.instapaper_archive_bookmark
ParameterTypeRequiredDescription
No parameters.
unarchive_bookmark Write

Move an archived bookmark back to unread.

Lua path
app.integrations.instapaper.unarchive_bookmark
Full name
instapaper.instapaper_unarchive_bookmark
ParameterTypeRequiredDescription
No parameters.
move_bookmark Write

Move a bookmark to a folder.

Lua path
app.integrations.instapaper.move_bookmark
Full name
instapaper.instapaper_move_bookmark
ParameterTypeRequiredDescription
No parameters.
get_bookmark_text Read

Get readable HTML text for a bookmark.

Lua path
app.integrations.instapaper.get_bookmark_text
Full name
instapaper.instapaper_get_bookmark_text
ParameterTypeRequiredDescription
No parameters.
list_folders Read

List Instapaper folders.

Lua path
app.integrations.instapaper.list_folders
Full name
instapaper.instapaper_list_folders
ParameterTypeRequiredDescription
No parameters.
add_folder Write

Create an Instapaper folder.

Lua path
app.integrations.instapaper.add_folder
Full name
instapaper.instapaper_add_folder
ParameterTypeRequiredDescription
No parameters.
delete_folder Write

Delete an Instapaper folder.

Lua path
app.integrations.instapaper.delete_folder
Full name
instapaper.instapaper_delete_folder
ParameterTypeRequiredDescription
No parameters.
set_folder_order Write

Set the order of Instapaper folders.

Lua path
app.integrations.instapaper.set_folder_order
Full name
instapaper.instapaper_set_folder_order
ParameterTypeRequiredDescription
No parameters.
list_highlights Read

List highlights for a bookmark.

Lua path
app.integrations.instapaper.list_highlights
Full name
instapaper.instapaper_list_highlights
ParameterTypeRequiredDescription
No parameters.
create_highlight Write

Create a bookmark highlight.

Lua path
app.integrations.instapaper.create_highlight
Full name
instapaper.instapaper_create_highlight
ParameterTypeRequiredDescription
No parameters.
delete_highlight Write

Delete an Instapaper highlight.

Lua path
app.integrations.instapaper.delete_highlight
Full name
instapaper.instapaper_delete_highlight
ParameterTypeRequiredDescription
No parameters.
simple_authenticate Read

Validate Simple API credentials with HTTP Basic auth.

Lua path
app.integrations.instapaper.simple_authenticate
Full name
instapaper.instapaper_simple_authenticate
ParameterTypeRequiredDescription
No parameters.
simple_add_url Write

Save a URL through the Instapaper Simple API.

Lua path
app.integrations.instapaper.simple_add_url
Full name
instapaper.instapaper_simple_add_url
ParameterTypeRequiredDescription
No parameters.
api_post Write

Call a safe relative Instapaper Full API path with OAuth signing.

Lua path
app.integrations.instapaper.api_post
Full name
instapaper.instapaper_api_post
ParameterTypeRequiredDescription
No parameters.