KosmoKrator

marketing

Later Lua API for KosmoKrator Agents

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

7 functions 6 read 1 write Manual OAuth token auth

Lua Namespace

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

Later — Lua API Reference

list_profiles

List all social media profiles connected to the Later account.

Parameters

NameTypeRequiredDescription
limitintegernoNumber of profiles to return per page
pageintegernoPage number for pagination

Example

local result = app.integrations.later.list_profiles()

for _, profile in ipairs(result.data) do
  print(profile.id .. ": " .. profile.platform .. " (" .. profile.username .. ")")
end

get_profile

Get details of a specific social profile.

Parameters

NameTypeRequiredDescription
profileIdstringyesThe social profile ID

Example

local result = app.integrations.later.get_profile({
  profileId = "abc123"
})
print(result.platform)
print(result.username)

list_posts

List scheduled and published posts.

Parameters

NameTypeRequiredDescription
profileIdstringnoFilter posts by profile ID
statusstringnoFilter by status: “scheduled”, “published”, or “draft”
limitintegernoNumber of posts to return per page
pageintegernoPage number for pagination

Example

local result = app.integrations.later.list_posts({
  status = "scheduled",
  limit = 20,
  page = 1
})

for _, post in ipairs(result.data) do
  print(post.id .. ": " .. post.text .. " @ " .. post.scheduled_at)
end

create_post

Create and schedule a new social media post.

Parameters

NameTypeRequiredDescription
textstringyesThe caption or text content of the post
profileIdsarrayyesProfile IDs to publish the post to
scheduledAtstringnoISO 8601 timestamp (e.g., "2025-02-01T09:00:00Z")
mediaUrlstringnoURL of the media to attach
mediaTypestringnoType of media: “image” or “video”
titlestringnoOptional title for the post

Example

local result = app.integrations.later.create_post({
  text = "Check out our latest blog post! https://example.com/blog",
  profileIds = {"abc123", "def456"},
  scheduledAt = "2025-02-01T09:00:00Z",
  mediaUrl = "https://example.com/image.jpg",
  mediaType = "image"
})
print("Created post: " .. result.id)

list_media

List media items in the Later media library.

Parameters

NameTypeRequiredDescription
limitintegernoNumber of items to return per page
pageintegernoPage number for pagination
typestringnoFilter by type: “image” or “video”

Example

local result = app.integrations.later.list_media({
  type = "image",
  limit = 10
})

for _, item in ipairs(result.data) do
  print(item.id .. ": " .. item.url)
end

get_media

Get details of a specific media item by ID.

Parameters

NameTypeRequiredDescription
mediaIdstringyesThe media item ID to retrieve

Example

local result = app.integrations.later.get_media({
  mediaId = "media_abc123"
})
print(result.url)
print(result.type)

get_current_user

Get the currently authenticated Later user profile.

Parameters

None.

Example

local result = app.integrations.later.get_current_user()
print("Logged in as: " .. (result.name or ""))
print("Email: " .. (result.email or ""))

Multi-Account Usage

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

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

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

-- Named accounts
app.integrations.later.client_acct.function_name({...})
app.integrations.later.agency.function_name({...})

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

Raw agent markdown
# Later — Lua API Reference

## list_profiles

List all social media profiles connected to the Later account.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Number of profiles to return per page |
| `page` | integer | no | Page number for pagination |

### Example

```lua
local result = app.integrations.later.list_profiles()

for _, profile in ipairs(result.data) do
  print(profile.id .. ": " .. profile.platform .. " (" .. profile.username .. ")")
end
```

---

## get_profile

Get details of a specific social profile.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `profileId` | string | yes | The social profile ID |

### Example

```lua
local result = app.integrations.later.get_profile({
  profileId = "abc123"
})
print(result.platform)
print(result.username)
```

---

## list_posts

List scheduled and published posts.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `profileId` | string | no | Filter posts by profile ID |
| `status` | string | no | Filter by status: "scheduled", "published", or "draft" |
| `limit` | integer | no | Number of posts to return per page |
| `page` | integer | no | Page number for pagination |

### Example

```lua
local result = app.integrations.later.list_posts({
  status = "scheduled",
  limit = 20,
  page = 1
})

for _, post in ipairs(result.data) do
  print(post.id .. ": " .. post.text .. " @ " .. post.scheduled_at)
end
```

---

## create_post

Create and schedule a new social media post.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `text` | string | yes | The caption or text content of the post |
| `profileIds` | array | yes | Profile IDs to publish the post to |
| `scheduledAt` | string | no | ISO 8601 timestamp (e.g., `"2025-02-01T09:00:00Z"`) |
| `mediaUrl` | string | no | URL of the media to attach |
| `mediaType` | string | no | Type of media: "image" or "video" |
| `title` | string | no | Optional title for the post |

### Example

```lua
local result = app.integrations.later.create_post({
  text = "Check out our latest blog post! https://example.com/blog",
  profileIds = {"abc123", "def456"},
  scheduledAt = "2025-02-01T09:00:00Z",
  mediaUrl = "https://example.com/image.jpg",
  mediaType = "image"
})
print("Created post: " .. result.id)
```

---

## list_media

List media items in the Later media library.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Number of items to return per page |
| `page` | integer | no | Page number for pagination |
| `type` | string | no | Filter by type: "image" or "video" |

### Example

```lua
local result = app.integrations.later.list_media({
  type = "image",
  limit = 10
})

for _, item in ipairs(result.data) do
  print(item.id .. ": " .. item.url)
end
```

---

## get_media

Get details of a specific media item by ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `mediaId` | string | yes | The media item ID to retrieve |

### Example

```lua
local result = app.integrations.later.get_media({
  mediaId = "media_abc123"
})
print(result.url)
print(result.type)
```

---

## get_current_user

Get the currently authenticated Later user profile.

### Parameters

None.

### Example

```lua
local result = app.integrations.later.get_current_user()
print("Logged in as: " .. (result.name or ""))
print("Email: " .. (result.email or ""))
```

---

## Multi-Account Usage

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

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

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

-- Named accounts
app.integrations.later.client_acct.function_name({...})
app.integrations.later.agency.function_name({...})
```

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

Metadata-Derived Lua Example

local result = app.integrations.later.later_list_profiles({
  limit = 1,
  page = 1
})
print(result)

Functions

later_list_profiles

List all social media profiles connected to the Later account. Returns profile IDs, platform types, and display names.

Operation
Read read
Full name
later.later_list_profiles
ParameterTypeRequiredDescription
limit integer no Number of profiles to return per page.
page integer no Page number for pagination.

later_get_profile

Get details of a specific social media profile in Later by its ID. Returns profile platform type, display name, and account metadata.

Operation
Read read
Full name
later.later_get_profile
ParameterTypeRequiredDescription
profileId string yes The social profile ID to retrieve.

later_list_posts

List scheduled and published posts in Later. Optionally filter by profile ID, status (scheduled, published, draft), and paginate results.

Operation
Read read
Full name
later.later_list_posts
ParameterTypeRequiredDescription
profileId string no Filter posts by a specific social profile ID.
status string no Filter by post status: "scheduled", "published", or "draft".
limit integer no Number of posts to return per page.
page integer no Page number for pagination.

later_create_post

Create and schedule a new social media post in Later. Provide the caption text, target profile IDs, and optionally a scheduled time or media URL.

Operation
Write write
Full name
later.later_create_post
ParameterTypeRequiredDescription
text string yes The caption or text content of the post.
profileIds array yes Array of Later profile IDs to publish the post to.
scheduledAt string no ISO 8601 timestamp for when the post should be published (e.g., "2025-02-01T09:00:00Z").
mediaUrl string no URL of the media (image or video) to attach to the post.
mediaType string no Type of media: "image" or "video".
title string no Optional title for the post.

later_list_media

List media items in the Later media library. Returns media IDs, URLs, types, and metadata. Optionally filter by media type.

Operation
Read read
Full name
later.later_list_media
ParameterTypeRequiredDescription
limit integer no Number of media items to return per page.
page integer no Page number for pagination.
type string no Filter by media type: "image" or "video".

later_get_media

Get details of a specific media item in Later by its ID. Returns the media URL, type, dimensions, and metadata.

Operation
Read read
Full name
later.later_get_media
ParameterTypeRequiredDescription
mediaId string yes The media item ID to retrieve.

later_get_current_user

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

Operation
Read read
Full name
later.later_get_current_user
ParameterTypeRequiredDescription
No parameters.