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 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.
| Key | Env var | Type | Required | Label |
|---|---|---|---|---|
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.
kosmo integrations:call bitly.bitly_shorten_link '{"long_url":"example_long_url","domain":"example_domain","group_guid":"example_group_guid"}' --json 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.
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 - Parameters
- long_url, domain, group_guid
kosmo integrations:call bitly.bitly_shorten_link '{"long_url":"example_long_url","domain":"example_domain","group_guid":"example_group_guid"}' --json 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 - Parameters
- bitlink
kosmo integrations:call bitly.bitly_get_link '{"bitlink":"example_bitlink"}' --json 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 - Parameters
- bitlink, title, archived, tags
kosmo integrations:call bitly.bitly_update_link '{"bitlink":"example_bitlink","title":"example_title","archived":true,"tags":"example_tags"}' --json 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 - Parameters
- bitlink, unit, units, unit_reference
kosmo integrations:call bitly.bitly_get_clicks '{"bitlink":"example_bitlink","unit":"example_unit","units":1,"unit_reference":"example_unit_reference"}' --json 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 - Parameters
- bitlink, params
kosmo integrations:call bitly.bitly_get_click_summary '{"bitlink":"example_bitlink","params":"example_params"}' --json 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 - Parameters
- bitlink, params
kosmo integrations:call bitly.bitly_get_click_countries '{"bitlink":"example_bitlink","params":"example_params"}' --json 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 - Parameters
- bitlink, params
kosmo integrations:call bitly.bitly_get_click_referrers '{"bitlink":"example_bitlink","params":"example_params"}' --json 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 - Parameters
- none
kosmo integrations:call bitly.bitly_list_groups '{}' --json kosmo integrations:bitly bitly_list_groups '{}' --json bitly.bitly_get_group
Retrieve details for a specific Bitly group by its GUID.
read - Parameters
- group_guid
kosmo integrations:call bitly.bitly_get_group '{"group_guid":"example_group_guid"}' --json 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 - Parameters
- group_guid, params
kosmo integrations:call bitly.bitly_list_group_bitlinks '{"group_guid":"example_group_guid","params":"example_params"}' --json 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 - Parameters
- long_url, title, tags, domain, group_guid
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 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 - Parameters
- bitlink
kosmo integrations:call bitly.bitly_expand_bitlink '{"bitlink":"example_bitlink"}' --json 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 - Parameters
- custom_bitlink, bitlink_id
kosmo integrations:call bitly.bitly_add_custom_bitlink '{"custom_bitlink":"example_custom_bitlink","bitlink_id":"example_bitlink_id"}' --json 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 - Parameters
- body
kosmo integrations:call bitly.bitly_create_qr_code '{"body":"example_body"}' --json kosmo integrations:bitly bitly_create_qr_code '{"body":"example_body"}' --json bitly.bitly_get_qr_code
Get a Bitly QR Code by ID.
read - Parameters
- qr_code_id
kosmo integrations:call bitly.bitly_get_qr_code '{"qr_code_id":"example_qr_code_id"}' --json 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 - Parameters
- organization_guid
kosmo integrations:call bitly.bitly_list_organization_webhooks '{"organization_guid":"example_organization_guid"}' --json 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 - Parameters
- organization_guid, body
kosmo integrations:call bitly.bitly_create_organization_webhook '{"organization_guid":"example_organization_guid","body":"example_body"}' --json 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 - Parameters
- none
kosmo integrations:call bitly.bitly_get_current_user '{}' --json kosmo integrations:bitly bitly_get_current_user '{}' --json bitly.bitly_api_get
Call any Bitly API v4 GET endpoint.
read - Parameters
- path, params
kosmo integrations:call bitly.bitly_api_get '{"path":"example_path","params":"example_params"}' --json 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 - Parameters
- path, body
kosmo integrations:call bitly.bitly_api_post '{"path":"example_path","body":"example_body"}' --json 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 - Parameters
- path, body
kosmo integrations:call bitly.bitly_api_patch '{"path":"example_path","body":"example_body"}' --json 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 - Parameters
- path, body
kosmo integrations:call bitly.bitly_api_delete '{"path":"example_path","body":"example_body"}' --json 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_shorten_link 3 parameters
kosmo integrations:schema bitly.bitly_shorten_link --json | Parameter | Type | Required | Description |
|---|---|---|---|
long_url | string | yes | The long URL to shorten (e.g., "https://example.test/very/long/path"). |
domain | string | no | Custom short domain to use (e.g., "bit.ly", "j.mp"). Defaults to the account's default domain. |
group_guid | string | no | The GUID of the group to associate this link with. If omitted, uses the default group. |
bitly.bitly_get_link 1 parameters
kosmo integrations:schema bitly.bitly_get_link --json | Parameter | Type | Required | Description |
|---|---|---|---|
bitlink | string | yes | The Bitlink identifier (e.g., "bit.ly/abc123" or a full Bitly URL). |
bitly.bitly_update_link 4 parameters
kosmo integrations:schema bitly.bitly_update_link --json | Parameter | Type | Required | Description |
|---|---|---|---|
bitlink | string | yes | The Bitlink identifier (e.g., "bit.ly/abc123"). |
title | string | no | A descriptive title for the link. |
archived | boolean | no | Whether to archive the link (true) or restore it (false). |
tags | array | no | Array of tags to assign to the link (e.g., ["marketing", "campaign"]). |
bitly.bitly_get_clicks 4 parameters
kosmo integrations:schema bitly.bitly_get_clicks --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema bitly.bitly_get_click_summary --json | Parameter | Type | Required | Description |
|---|---|---|---|
bitlink | string | yes | Bitlink identifier. |
params | object | no | Query parameters such as unit, units, and unit_reference. |
bitly.bitly_get_click_countries 2 parameters
kosmo integrations:schema bitly.bitly_get_click_countries --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema bitly.bitly_get_click_referrers --json | Parameter | Type | Required | Description |
|---|---|---|---|
bitlink | string | yes | Bitlink identifier. |
params | object | no | Query parameters such as unit, units, size, and unit_reference. |
bitly.bitly_list_groups 0 parameters
kosmo integrations:schema bitly.bitly_list_groups --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
bitly.bitly_get_group 1 parameters
kosmo integrations:schema bitly.bitly_get_group --json | Parameter | Type | Required | Description |
|---|---|---|---|
group_guid | string | yes | The GUID of the group to retrieve. |
bitly.bitly_list_group_bitlinks 2 parameters
kosmo integrations:schema bitly.bitly_list_group_bitlinks --json | Parameter | Type | Required | Description |
|---|---|---|---|
group_guid | string | yes | Bitly group GUID. |
params | object | no | Query parameters such as size, page, keyword, query, and archived. |
bitly.bitly_create_bitlink 5 parameters
kosmo integrations:schema bitly.bitly_create_bitlink --json | Parameter | Type | Required | Description |
|---|---|---|---|
long_url | string | yes | The destination URL to shorten. |
title | string | no | A descriptive title for the link (e.g., "Q1 Marketing Campaign"). |
tags | array | no | Array of tags to categorize the link (e.g., ["marketing", "q1"]). |
domain | string | no | Custom short domain (e.g., "bit.ly"). Defaults to account's default domain. |
group_guid | string | no | The GUID of the group to associate this link with. |
bitly.bitly_expand_bitlink 1 parameters
kosmo integrations:schema bitly.bitly_expand_bitlink --json | Parameter | Type | Required | Description |
|---|---|---|---|
bitlink | string | yes | Bitlink identifier such as bit.ly/abc123. |
bitly.bitly_add_custom_bitlink 2 parameters
kosmo integrations:schema bitly.bitly_add_custom_bitlink --json | Parameter | Type | Required | Description |
|---|---|---|---|
custom_bitlink | string | yes | Custom Bitlink such as example.test/campaign. |
bitlink_id | string | yes | Existing Bitlink ID. |
bitly.bitly_create_qr_code 1 parameters
kosmo integrations:schema bitly.bitly_create_qr_code --json | Parameter | Type | Required | Description |
|---|---|---|---|
body | object | yes | QR Code body accepted by Bitly, including destination and optional title/customization. |
bitly.bitly_get_qr_code 1 parameters
kosmo integrations:schema bitly.bitly_get_qr_code --json | Parameter | Type | Required | Description |
|---|---|---|---|
qr_code_id | string | yes | QR Code ID. |
bitly.bitly_list_organization_webhooks 1 parameters
kosmo integrations:schema bitly.bitly_list_organization_webhooks --json | Parameter | Type | Required | Description |
|---|---|---|---|
organization_guid | string | yes | Bitly organization GUID. |
bitly.bitly_create_organization_webhook 2 parameters
kosmo integrations:schema bitly.bitly_create_organization_webhook --json | Parameter | Type | Required | Description |
|---|---|---|---|
organization_guid | string | yes | Bitly organization GUID. |
body | object | yes | Webhook body accepted by Bitly. |
bitly.bitly_get_current_user 0 parameters
kosmo integrations:schema bitly.bitly_get_current_user --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
bitly.bitly_api_get 2 parameters
kosmo integrations:schema bitly.bitly_api_get --json | Parameter | Type | Required | Description |
|---|---|---|---|
path | string | yes | API path such as /groups or /user. |
params | object | no | Query parameters. |
bitly.bitly_api_post 2 parameters
kosmo integrations:schema bitly.bitly_api_post --json | Parameter | Type | Required | Description |
|---|---|---|---|
path | string | yes | API path. |
body | object | no | JSON body. |
bitly.bitly_api_patch 2 parameters
kosmo integrations:schema bitly.bitly_api_patch --json | Parameter | Type | Required | Description |
|---|---|---|---|
path | string | yes | API path. |
body | object | no | JSON body. |
bitly.bitly_api_delete 2 parameters
kosmo integrations:schema bitly.bitly_api_delete --json | Parameter | Type | Required | Description |
|---|---|---|---|
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.