KosmoKrator

productivity

Bitly CLI for AI Agents

Use the Bitly CLI from KosmoKrator to call Bitly tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

Bitly CLI Setup

Bitly can be configured headlessly with `kosmokrator integrations:configure bitly`.

Install, configure, and verify
# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure bitly --set access_token="$BITLY_ACCESS_TOKEN" --enable --read allow --write ask --json
kosmokrator integrations:doctor bitly --json
kosmokrator integrations:status --json

Credentials

Authentication type: Bearer token bearer_token. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.

KeyEnv varTypeRequiredLabel
access_token BITLY_ACCESS_TOKEN Secret secret yes Access Token

Command Patterns

The generic command is stable across every integration. The provider shortcut is shorter for humans.

Generic CLI call
kosmo integrations:call bitly.bitly_shorten_link '{"long_url":"example_long_url","domain":"example_domain","group_guid":"example_group_guid"}' --json
Provider shortcut
kosmo integrations:bitly bitly_shorten_link '{"long_url":"example_long_url","domain":"example_domain","group_guid":"example_group_guid"}' --json

Discovery

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

Discovery commands
kosmo integrations:docs bitly --json
kosmo integrations:docs bitly.bitly_shorten_link --json
kosmo integrations:schema bitly.bitly_shorten_link --json
kosmo integrations:search "Bitly" --json
kosmo integrations:list --json

Automation Contexts

The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.

CLI Functions

Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.

bitly.bitly_shorten_link

Shorten a long URL into a Bitlink. Returns the shortened URL and link details.

Write write
Parameters
long_url, domain, group_guid
Generic call
kosmo integrations:call bitly.bitly_shorten_link '{"long_url":"example_long_url","domain":"example_domain","group_guid":"example_group_guid"}' --json
Shortcut
kosmo integrations:bitly bitly_shorten_link '{"long_url":"example_long_url","domain":"example_domain","group_guid":"example_group_guid"}' --json

bitly.bitly_get_link

Retrieve details for a Bitlink, including the long URL, title, tags, and timestamps.

Read read
Parameters
bitlink
Generic call
kosmo integrations:call bitly.bitly_get_link '{"bitlink":"example_bitlink"}' --json
Shortcut
kosmo integrations:bitly bitly_get_link '{"bitlink":"example_bitlink"}' --json

bitly.bitly_update_link

Update a Bitlink's metadata — set the title, archive/unarchive, or update tags.

Write write
Parameters
bitlink, title, archived, tags
Generic call
kosmo integrations:call bitly.bitly_update_link '{"bitlink":"example_bitlink","title":"example_title","archived":true,"tags":"example_tags"}' --json
Shortcut
kosmo integrations:bitly bitly_update_link '{"bitlink":"example_bitlink","title":"example_title","archived":true,"tags":"example_tags"}' --json

bitly.bitly_get_clicks

Get click metrics for a Bitlink. Returns click counts by time unit (minute, hour, day, week, month).

Read read
Parameters
bitlink, unit, units, unit_reference
Generic call
kosmo integrations:call bitly.bitly_get_clicks '{"bitlink":"example_bitlink","unit":"example_unit","units":1,"unit_reference":"example_unit_reference"}' --json
Shortcut
kosmo integrations:bitly bitly_get_clicks '{"bitlink":"example_bitlink","unit":"example_unit","units":1,"unit_reference":"example_unit_reference"}' --json

bitly.bitly_get_click_summary

Get total click summary data for a Bitlink.

Read read
Parameters
bitlink, params
Generic call
kosmo integrations:call bitly.bitly_get_click_summary '{"bitlink":"example_bitlink","params":"example_params"}' --json
Shortcut
kosmo integrations:bitly bitly_get_click_summary '{"bitlink":"example_bitlink","params":"example_params"}' --json

bitly.bitly_get_click_countries

Get click counts grouped by country for a Bitlink.

Read read
Parameters
bitlink, params
Generic call
kosmo integrations:call bitly.bitly_get_click_countries '{"bitlink":"example_bitlink","params":"example_params"}' --json
Shortcut
kosmo integrations:bitly bitly_get_click_countries '{"bitlink":"example_bitlink","params":"example_params"}' --json

bitly.bitly_get_click_referrers

Get click counts grouped by referrer for a Bitlink.

Read read
Parameters
bitlink, params
Generic call
kosmo integrations:call bitly.bitly_get_click_referrers '{"bitlink":"example_bitlink","params":"example_params"}' --json
Shortcut
kosmo integrations:bitly bitly_get_click_referrers '{"bitlink":"example_bitlink","params":"example_params"}' --json

bitly.bitly_list_groups

List all groups in the Bitly account. Groups organize links and are used when creating new Bitlinks.

Read read
Parameters
none
Generic call
kosmo integrations:call bitly.bitly_list_groups '{}' --json
Shortcut
kosmo integrations:bitly bitly_list_groups '{}' --json

bitly.bitly_get_group

Retrieve details for a specific Bitly group by its GUID.

Read read
Parameters
group_guid
Generic call
kosmo integrations:call bitly.bitly_get_group '{"group_guid":"example_group_guid"}' --json
Shortcut
kosmo integrations:bitly bitly_get_group '{"group_guid":"example_group_guid"}' --json

bitly.bitly_list_group_bitlinks

List Bitlinks in a Bitly group with optional filters.

Read read
Parameters
group_guid, params
Generic call
kosmo integrations:call bitly.bitly_list_group_bitlinks '{"group_guid":"example_group_guid","params":"example_params"}' --json
Shortcut
kosmo integrations:bitly bitly_list_group_bitlinks '{"group_guid":"example_group_guid","params":"example_params"}' --json

bitly.bitly_create_bitlink

Create a new Bitlink with title, tags, and optional custom domain. More full-featured than shorten — use this when you need metadata.

Write write
Parameters
long_url, title, tags, domain, group_guid
Generic call
kosmo integrations:call bitly.bitly_create_bitlink '{"long_url":"example_long_url","title":"example_title","tags":"example_tags","domain":"example_domain","group_guid":"example_group_guid"}' --json
Shortcut
kosmo integrations:bitly bitly_create_bitlink '{"long_url":"example_long_url","title":"example_title","tags":"example_tags","domain":"example_domain","group_guid":"example_group_guid"}' --json

bitly.bitly_expand_bitlink

Expand a Bitlink to retrieve its long URL.

Read read
Parameters
bitlink
Generic call
kosmo integrations:call bitly.bitly_expand_bitlink '{"bitlink":"example_bitlink"}' --json
Shortcut
kosmo integrations:bitly bitly_expand_bitlink '{"bitlink":"example_bitlink"}' --json

bitly.bitly_add_custom_bitlink

Add a custom back-half to an existing Bitlink on a custom domain.

Write write
Parameters
custom_bitlink, bitlink_id
Generic call
kosmo integrations:call bitly.bitly_add_custom_bitlink '{"custom_bitlink":"example_custom_bitlink","bitlink_id":"example_bitlink_id"}' --json
Shortcut
kosmo integrations:bitly bitly_add_custom_bitlink '{"custom_bitlink":"example_custom_bitlink","bitlink_id":"example_bitlink_id"}' --json

bitly.bitly_create_qr_code

Create a Bitly QR Code for a destination such as a Bitlink or long URL.

Write write
Parameters
body
Generic call
kosmo integrations:call bitly.bitly_create_qr_code '{"body":"example_body"}' --json
Shortcut
kosmo integrations:bitly bitly_create_qr_code '{"body":"example_body"}' --json

bitly.bitly_get_qr_code

Get a Bitly QR Code by ID.

Read read
Parameters
qr_code_id
Generic call
kosmo integrations:call bitly.bitly_get_qr_code '{"qr_code_id":"example_qr_code_id"}' --json
Shortcut
kosmo integrations:bitly bitly_get_qr_code '{"qr_code_id":"example_qr_code_id"}' --json

bitly.bitly_list_organization_webhooks

List webhooks for a Bitly organization.

Read read
Parameters
organization_guid
Generic call
kosmo integrations:call bitly.bitly_list_organization_webhooks '{"organization_guid":"example_organization_guid"}' --json
Shortcut
kosmo integrations:bitly bitly_list_organization_webhooks '{"organization_guid":"example_organization_guid"}' --json

bitly.bitly_create_organization_webhook

Create a webhook for a Bitly organization.

Write write
Parameters
organization_guid, body
Generic call
kosmo integrations:call bitly.bitly_create_organization_webhook '{"organization_guid":"example_organization_guid","body":"example_body"}' --json
Shortcut
kosmo integrations:bitly bitly_create_organization_webhook '{"organization_guid":"example_organization_guid","body":"example_body"}' --json

bitly.bitly_get_current_user

Get the authenticated Bitly user's profile. Use this to verify the connection and see account info.

Read read
Parameters
none
Generic call
kosmo integrations:call bitly.bitly_get_current_user '{}' --json
Shortcut
kosmo integrations:bitly bitly_get_current_user '{}' --json

bitly.bitly_api_get

Call any Bitly API v4 GET endpoint.

Read read
Parameters
path, params
Generic call
kosmo integrations:call bitly.bitly_api_get '{"path":"example_path","params":"example_params"}' --json
Shortcut
kosmo integrations:bitly bitly_api_get '{"path":"example_path","params":"example_params"}' --json

bitly.bitly_api_post

Call any Bitly API v4 POST endpoint.

Write write
Parameters
path, body
Generic call
kosmo integrations:call bitly.bitly_api_post '{"path":"example_path","body":"example_body"}' --json
Shortcut
kosmo integrations:bitly bitly_api_post '{"path":"example_path","body":"example_body"}' --json

bitly.bitly_api_patch

Call any Bitly API v4 PATCH endpoint.

Write write
Parameters
path, body
Generic call
kosmo integrations:call bitly.bitly_api_patch '{"path":"example_path","body":"example_body"}' --json
Shortcut
kosmo integrations:bitly bitly_api_patch '{"path":"example_path","body":"example_body"}' --json

bitly.bitly_api_delete

Call any Bitly API v4 DELETE endpoint.

Write write
Parameters
path, body
Generic call
kosmo integrations:call bitly.bitly_api_delete '{"path":"example_path","body":"example_body"}' --json
Shortcut
kosmo integrations:bitly bitly_api_delete '{"path":"example_path","body":"example_body"}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

bitly.bitly_get_clicks 4 parameters
Schema command
kosmo integrations:schema bitly.bitly_get_clicks --json
ParameterTypeRequiredDescription
bitlink string yes The Bitlink identifier (e.g., "bit.ly/abc123").
unit string no Time unit for click aggregation: "minute", "hour", "day", "week", or "month". Defaults to "day".
units integer no Number of time units to return. Use -1 for all available data. Defaults to -1.
unit_reference string no ISO 8601 timestamp for the reference point (e.g., "2026-01-01T00:00:00+0000").
bitly.bitly_get_click_summary 2 parameters
Schema command
kosmo integrations:schema bitly.bitly_get_click_summary --json
ParameterTypeRequiredDescription
bitlink string yes Bitlink identifier.
params object no Query parameters such as unit, units, and unit_reference.
bitly.bitly_get_click_countries 2 parameters
Schema command
kosmo integrations:schema bitly.bitly_get_click_countries --json
ParameterTypeRequiredDescription
bitlink string yes Bitlink identifier.
params object no Query parameters such as unit, units, size, and unit_reference.
bitly.bitly_get_click_referrers 2 parameters
Schema command
kosmo integrations:schema bitly.bitly_get_click_referrers --json
ParameterTypeRequiredDescription
bitlink string yes Bitlink identifier.
params object no Query parameters such as unit, units, size, and unit_reference.
bitly.bitly_list_groups 0 parameters
Schema command
kosmo integrations:schema bitly.bitly_list_groups --json
ParameterTypeRequiredDescription
No parameters.
bitly.bitly_get_group 1 parameters
Schema command
kosmo integrations:schema bitly.bitly_get_group --json
ParameterTypeRequiredDescription
group_guid string yes The GUID of the group to retrieve.
bitly.bitly_create_qr_code 1 parameters
Schema command
kosmo integrations:schema bitly.bitly_create_qr_code --json
ParameterTypeRequiredDescription
body object yes QR Code body accepted by Bitly, including destination and optional title/customization.
bitly.bitly_get_qr_code 1 parameters
Schema command
kosmo integrations:schema bitly.bitly_get_qr_code --json
ParameterTypeRequiredDescription
qr_code_id string yes QR Code ID.
bitly.bitly_list_organization_webhooks 1 parameters
Schema command
kosmo integrations:schema bitly.bitly_list_organization_webhooks --json
ParameterTypeRequiredDescription
organization_guid string yes Bitly organization GUID.
bitly.bitly_create_organization_webhook 2 parameters
Schema command
kosmo integrations:schema bitly.bitly_create_organization_webhook --json
ParameterTypeRequiredDescription
organization_guid string yes Bitly organization GUID.
body object yes Webhook body accepted by Bitly.
bitly.bitly_get_current_user 0 parameters
Schema command
kosmo integrations:schema bitly.bitly_get_current_user --json
ParameterTypeRequiredDescription
No parameters.
bitly.bitly_api_get 2 parameters
Schema command
kosmo integrations:schema bitly.bitly_api_get --json
ParameterTypeRequiredDescription
path string yes API path such as /groups or /user.
params object no Query parameters.
bitly.bitly_api_post 2 parameters
Schema command
kosmo integrations:schema bitly.bitly_api_post --json
ParameterTypeRequiredDescription
path string yes API path.
body object no JSON body.
bitly.bitly_api_patch 2 parameters
Schema command
kosmo integrations:schema bitly.bitly_api_patch --json
ParameterTypeRequiredDescription
path string yes API path.
body object no JSON body.
bitly.bitly_api_delete 2 parameters
Schema command
kosmo integrations:schema bitly.bitly_api_delete --json
ParameterTypeRequiredDescription
path string yes API path.
body object no JSON body.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.