Bitlinks
Bitlinks are shortened links. They could begin with the bit.ly domain or your own custom branded short domain (BSD).
Shorten a Link
Converts a long url to a Bitlink.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-H 'Content-Type: application/json' \
-X POST \
-d '{
"long_url": "https://dev.bitly.com",
"domain": "bit.ly",
"group_guid": "Ba1bc23dE4F"
}' \
https://api-ssl.bitly.com/v4/shorten{
"references": { "any" },
"link": "string",
"id": "string",
"long_url": "string",
"title": "string",
"archived": "boolean",
"created_at": "string",
"created_by": "string",
"client_id": "string",
"custom_bitlinks": [
"string"
],
"tags": [
"string"
],
"deeplinks": [
{
"guid": "string",
"bitlink": "string",
"app_uri_path": "string",
"install_url": "string",
"app_guid": "string",
"os": "string",
"install_type": "string",
"created": "string",
"modified": "string",
"brand_guid": "string"
}
]
}Create a Bitlink
Converts a long url to a Bitlink and sets additional parameters.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-H 'Content-Type: application/json' \
-X POST \
-d '{
"long_url": "https://dev.bitly.com",
"domain": "bit.ly",
"group_guid": "Ba1bc23dE4F",
"title": "Bitly API Documentation",
"tags": [
"bitly",
"api"
],
"deeplinks": [
{
"app_id": "com.bitly.app",
"app_uri_path": "/store?id=123456",
"install_url": "https://play.google.com/store/apps/details?id=com.bitly.app&hl=en_US",
"install_type": "promote_install"
}
]
}' \
https://api-ssl.bitly.com/v4/bitlinks{
"references": { "any" },
"link": "string",
"id": "string",
"long_url": "string",
"title": "string",
"archived": "boolean",
"created_at": "string",
"created_by": "string",
"client_id": "string",
"custom_bitlinks": [
"string"
],
"tags": [
"string"
],
"deeplinks": [
{
"guid": "string",
"bitlink": "string",
"app_uri_path": "string",
"install_url": "string",
"app_guid": "string",
"os": "string",
"install_type": "string",
"created": "string",
"modified": "string",
"brand_guid": "string"
}
]
}Update a Bitlink
Updates fields in the specified link.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-H 'Content-Type: application/json' \
-X PATCH \
-d '{
"link": "https://bit.ly/documentation",
"id": "bit.ly/documentation",
"long_url": "https://dev.bitly.com",
"title": "Bitly API Documentation",
"archived": false,
"created_at": "2006-03-12T16:29:46+0000",
"created_by": "chauncey",
"client_id": "1234a56b789cd0e123456fg7h8901j123km45n6p",
"custom_bitlinks": [
"https://chauncey.ly/documentation"
],
"tags": [
"bitly",
"api"
],
"deeplinks": [
{
"guid": "Ra1bcD2eF3h",
"bitlink": "bit.ly/documentation",
"app_uri_path": "/store?id=123456",
"install_url": "https://play.google.com/store/apps/details?id=com.bitly.app&hl=en_US",
"app_guid": "Ab1cdE2fG3h",
"os": "android",
"install_type": "promote_install",
"brand_guid": "Ba1bc23dE4F"
}
]
}' \
https://api-ssl.bitly.com/v4/bitlinks/bit.ly/12a4b6c{
"references": { "any" },
"link": "string",
"id": "string",
"long_url": "string",
"title": "string",
"archived": "boolean",
"created_at": "string",
"created_by": "string",
"client_id": "string",
"custom_bitlinks": [
"string"
],
"tags": [
"string"
],
"deeplinks": [
{
"guid": "string",
"bitlink": "string",
"app_uri_path": "string",
"install_url": "string",
"app_guid": "string",
"os": "string",
"install_type": "string",
"created": "string",
"modified": "string",
"brand_guid": "string"
}
]
}Retrieve a Bitlink
Returns information for the specified link.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/bitlinks/bit.ly/12a4b6c{
"references": { "any" },
"link": "string",
"id": "string",
"long_url": "string",
"title": "string",
"archived": "boolean",
"created_at": "string",
"created_by": "string",
"client_id": "string",
"custom_bitlinks": [
"string"
],
"tags": [
"string"
],
"deeplinks": [
{
"guid": "string",
"bitlink": "string",
"app_uri_path": "string",
"install_url": "string",
"app_guid": "string",
"os": "string",
"install_type": "string",
"created": "string",
"modified": "string",
"brand_guid": "string"
}
]
}Get a QR Code
Generates a QR code for a Bitlink.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/bitlinks/bit.ly/12a4b6c/qr{
"link": "string",
"id": "string",
"qr_code": "string"
}Expand a Bitlink
Returns the short link and long URL for the specified link.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-H 'Content-Type: application/json' \
-X POST \
-d '{
"bitlink_id": "bit.ly/12a4b6c"
}' \
https://api-ssl.bitly.com/v4/expand{
"link": "string",
"id": "string",
"long_url": "string",
"created_at": "string"
}Get Clicks for a Bitlink
Returns the click counts for the specified link in an array based on a date.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/bitlinks/bit.ly/12a4b6c/clicks?unit=month&units=5&size=10&unit_reference=2006-01-02T15%3A04%3A05-0700{
"link_clicks": [
{
"clicks": "integer",
"date": "string"
}
],
"units": "integer",
"unit": "string",
"unit_reference": "string"
}Get a Clicks Summary for a Bitlink
Returns the click counts for the specified link rolled up into a single field.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/bitlinks/bit.ly/12a4b6c/clicks/summary?unit=month&units=5&size=10&unit_reference=2006-01-02T15%3A04%3A05-0700{
"total_clicks": "integer",
"units": "integer",
"unit": "string",
"unit_reference": "string"
}Get Metrics for a Bitlink by Country
Returns the country origins of click traffic for the specified link.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/bitlinks/bit.ly/12a4b6c/countries?unit=month&units=5&size=10&unit_reference=2006-01-02T15%3A04%3A05-0700{
"unit": "string",
"units": "integer",
"facet": "string",
"unit_reference": "string",
"metrics": [
{
"clicks": "integer",
"value": "string"
}
]
}Get Metrics for a Bitlink by City
Returns the city origins of click traffic for the specified link.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/bitlinks/bit.ly/12a4b6c/cities?unit=month&units=5&size=10&unit_reference=2006-01-02T15%3A04%3A05-0700{
"unit": "string",
"units": "integer",
"facet": "string",
"unit_reference": "string",
"metrics": [
{
"clicks": "integer",
"city": "string",
"subregion": "string",
"region": "string",
"country": "string"
}
],
"other_metrics": {
"other_city_clicks": "integer",
"no_city_clicks": "integer"
}
}Get Metrics for a Bitlink by Device Type
Returns the device types generating click traffic to the specified link.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/bitlinks/bit.ly/12a4b6c/devices?unit=month&units=5&size=10&unit_reference=2006-01-02T15%3A04%3A05-0700{
"unit": "string",
"units": "integer",
"facet": "string",
"unit_reference": "string",
"metrics": [
{
"clicks": "integer",
"device_type": "string"
}
]
}Get Metrics for a Bitlink by Referrers
Returns referrer click counts for the specified link.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/bitlinks/bit.ly/12a4b6c/referrers?unit=month&units=5&size=10&unit_reference=2006-01-02T15%3A04%3A05-0700{
"unit": "string",
"units": "integer",
"facet": "string",
"unit_reference": "string",
"metrics": [
{
"clicks": "integer",
"value": "string"
}
]
}Get Metrics for a Bitlink by Referring Domains
Returns the referring domain click counts for the specified link.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/bitlinks/bit.ly/12a4b6c/referring_domains?unit=month&units=5&size=10&unit_reference=2006-01-02T15%3A04%3A05-0700{
"unit": "string",
"units": "integer",
"facet": "string",
"unit_reference": "string",
"metrics": [
{
"clicks": "integer",
"value": "string"
}
]
}Get Metrics for a Bitlink by Referrers by Domain
Returns click metrics grouped by referrers for the specified link.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/bitlinks/bit.ly/12a4b6c/referrers_by_domains?unit=month&units=5&size=10&unit_reference=2006-01-02T15%3A04%3A05-0700{
"unit": "string",
"units": "integer",
"facet": "string",
"unit_reference": "string",
"referrers_by_domain": [
{
"network": "string",
"referrers": [
{
"key": "string",
"value": "integer"
}
]
}
]
}Retrieve Bitlinks by Group
Returns a paginated collection of Bitlinks for a group.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/groups/Ba1bc23dE4F/bitlinks?size=10&page=1&keyword=chauncey&query=api&created_before=1501027200&created_after=1501027200&modified_after=1501027200&archived=both&deeplinks=both&domain_deeplinks=both&campaign_guid=Ca1bcd2EFGh&channel_guid=Ha1bc2DefGh&custom_bitlink=both&tags%5B0%5D=bitly&tags%5B1%5D=api&encoding_login%5B0%5D=chauncey{
"links": [
{
"references": { "any" },
"link": "string",
"id": "string",
"long_url": "string",
"title": "string",
"archived": "boolean",
"created_at": "string",
"created_by": "string",
"client_id": "string",
"custom_bitlinks": [
"string"
],
"tags": [
"string"
],
"deeplinks": [
{
"guid": "string",
"bitlink": "string",
"app_uri_path": "string",
"install_url": "string",
"app_guid": "string",
"os": "string",
"install_type": "string",
"created": "string",
"modified": "string",
"brand_guid": "string"
}
]
}
],
"pagination": {
"prev": "string",
"next": "string",
"size": "integer",
"page": "integer",
"total": "integer"
}
}Retrieve Sorted Bitlinks for Group
Returns a list of Bitlinks sorted by group.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/groups/Ba1bc23dE4F/bitlinks/clicks?unit=month&units=5&unit_reference=2006-01-02T15%3A04%3A05-0700&size=10{
"links": [
{
"references": { "any" },
"link": "string",
"id": "string",
"long_url": "string",
"title": "string",
"archived": "boolean",
"created_at": "string",
"created_by": "string",
"client_id": "string",
"custom_bitlinks": [
"string"
],
"tags": [
"string"
],
"deeplinks": [
{
"guid": "string",
"bitlink": "string",
"app_uri_path": "string",
"install_url": "string",
"app_guid": "string",
"os": "string",
"install_type": "string",
"created": "string",
"modified": "string",
"brand_guid": "string"
}
]
}
],
"sorted_links": [
{
"clicks": "integer",
"id": "string"
}
]
}BSDs
Branded short domains (BSDs) are the custom domains used to brand your links. A BSD can be added to a Bitly organization and may be assigned to one or more groups. They can contain up to 32 characters.
Get BSDs
Fetch all Branded Short Domains
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/bsds{
"bsds": [
"string"
]
}Campaigns
Bitly Campaigns are used to build and organize links and metrics for marketing campaigns.
Retrieve Campaigns
Returns the campaigns for the current authenticated user.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/campaigns?group_guid=Ba1bc23dE4F{
"campaigns": [
{
"references": { "any" },
"guid": "string",
"group_guid": "string",
"created_by": "string",
"name": "string",
"description": "string",
"created": "string",
"modified": "string"
}
]
}Create Campaign
Creates a new campaign.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-H 'Content-Type: application/json' \
-X POST \
-d '{
"group_guid": "Ba1bc23dE4F",
"name": "My Campaign",
"description": "my new campaign",
"channel_guids": [
"Ha1bc2DefGj",
"Ha1bc2DefGk"
]
}' \
https://api-ssl.bitly.com/v4/campaigns{
"references": { "any" },
"guid": "string",
"group_guid": "string",
"created_by": "string",
"name": "string",
"description": "string",
"created": "string",
"modified": "string"
}Retrieve a Campaign
Returns details for a campaign.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/campaigns/Ca1bcd2EFGh{
"references": { "any" },
"guid": "string",
"group_guid": "string",
"created_by": "string",
"name": "string",
"description": "string",
"created": "string",
"modified": "string"
}Update Campaign
Updates a campaign's details.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-H 'Content-Type: application/json' \
-X PATCH \
-d '{
"group_guid": "Ba1bc23dE4F",
"name": "My Campaign",
"description": "my new campaign",
"channel_guids": [
"Ha1bc2DefGj",
"Ha1bc2DefGk"
]
}' \
https://api-ssl.bitly.com/v4/campaigns/Ca1bcd2EFGh{
"references": { "any" },
"guid": "string",
"group_guid": "string",
"created_by": "string",
"name": "string",
"description": "string",
"created": "string",
"modified": "string"
}Retrieve Channels
Returns the channels available to a user.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/channels?group_guid=Ba1bc23dE4F&campaign_guid=Ca1bcd2EFGh{
"channels": [
{
"name": "string",
"guid": "string",
"created": "string",
"modified": "string",
"group_guid": "string",
"references": { "any" }
}
]
}Create Channel
Creates a new channel.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-H 'Content-Type: application/json' \
-X POST \
-d '{
"name": "My Channel",
"guid": "Ha1bc2DefGh",
"group_guid": "Ba1bc23dE4F",
"bitlinks": [
{
"campaign_guid": "Ca1bcd2EFGh",
"bitlink_id": "bit.ly/1234abcd"
}
]
}' \
https://api-ssl.bitly.com/v4/channels{
"name": "string",
"guid": "string",
"created": "string",
"modified": "string",
"group_guid": "string",
"references": { "any" }
}Get a Channel
Returns a channel's details.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/channels/Ha1bc2DefGh{
"name": "string",
"guid": "string",
"created": "string",
"modified": "string",
"group_guid": "string",
"references": { "any" }
}Update a Channel
Updates an existing channel.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-H 'Content-Type: application/json' \
-X PATCH \
-d '{
"name": "My Channel",
"guid": "Ha1bc2DefGh",
"group_guid": "Ba1bc23dE4F",
"bitlinks": [
{
"campaign_guid": "Ca1bcd2EFGh",
"bitlink_id": "bit.ly/1234abcd"
}
]
}' \
https://api-ssl.bitly.com/v4/channels/Ha1bc2DefGh{
"name": "string",
"guid": "string",
"created": "string",
"modified": "string",
"group_guid": "string",
"references": { "any" }
}Custom Bitlinks
Custom Bitlinks have both a BSD and a customized back-half (e.g., yourcompany.com/yourcampaign). A link is not a custom Bitlink if it begins with the bit.ly domain or ends with an auto-generated random string.
Add Custom Bitlink
Add a keyword (or "custom back-half") to a Bitlink.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-H 'Content-Type: application/json' \
-X POST \
-d '{
"custom_bitlink": "chauncey.ly/documentation",
"bitlink_id": "bit.ly/1234abcd"
}' \
https://api-ssl.bitly.com/v4/custom_bitlinks{
"custom_bitlink": "string",
"bitlink": {
"references": { "any" },
"link": "string",
"id": "string",
"long_url": "string",
"title": "string",
"archived": "boolean",
"created_at": "string",
"created_by": "string",
"client_id": "string",
"custom_bitlinks": [
"string"
],
"tags": [
"string"
],
"deeplinks": [
{
"guid": "string",
"bitlink": "string",
"app_uri_path": "string",
"install_url": "string",
"app_guid": "string",
"os": "string",
"install_type": "string",
"created": "string",
"modified": "string",
"brand_guid": "string"
}
]
},
"bitlink_history": [
{
"uuid": "string",
"group_guid": "string",
"keyword": "string",
"bsd": "string",
"hash": "string",
"login": "string",
"long_url": "string",
"created": "string",
"first_created": "string",
"deactivated": "string",
"is_active": "boolean"
}
]
}Update Custom Bitlink
Move a keyword (or custom back-half) to a different Bitlink.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-H 'Content-Type: application/json' \
-X PATCH \
-d '{
"bitlink_id": "bit.ly/1234abcd"
}' \
https://api-ssl.bitly.com/v4/custom_bitlinks/chauncey.ly/chauncey{
"custom_bitlink": "string",
"bitlink": {
"references": { "any" },
"link": "string",
"id": "string",
"long_url": "string",
"title": "string",
"archived": "boolean",
"created_at": "string",
"created_by": "string",
"client_id": "string",
"custom_bitlinks": [
"string"
],
"tags": [
"string"
],
"deeplinks": [
{
"guid": "string",
"bitlink": "string",
"app_uri_path": "string",
"install_url": "string",
"app_guid": "string",
"os": "string",
"install_type": "string",
"created": "string",
"modified": "string",
"brand_guid": "string"
}
]
},
"bitlink_history": [
{
"uuid": "string",
"group_guid": "string",
"keyword": "string",
"bsd": "string",
"hash": "string",
"login": "string",
"long_url": "string",
"created": "string",
"first_created": "string",
"deactivated": "string",
"is_active": "boolean"
}
]
}Retrieve Custom Bitlink
Returns the details and history of the specified link.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/custom_bitlinks/chauncey.ly/chauncey{
"custom_bitlink": "string",
"bitlink": {
"references": { "any" },
"link": "string",
"id": "string",
"long_url": "string",
"title": "string",
"archived": "boolean",
"created_at": "string",
"created_by": "string",
"client_id": "string",
"custom_bitlinks": [
"string"
],
"tags": [
"string"
],
"deeplinks": [
{
"guid": "string",
"bitlink": "string",
"app_uri_path": "string",
"install_url": "string",
"app_guid": "string",
"os": "string",
"install_type": "string",
"created": "string",
"modified": "string",
"brand_guid": "string"
}
]
},
"bitlink_history": [
{
"uuid": "string",
"group_guid": "string",
"keyword": "string",
"bsd": "string",
"hash": "string",
"login": "string",
"long_url": "string",
"created": "string",
"first_created": "string",
"deactivated": "string",
"is_active": "boolean"
}
]
}Get Metrics for a Custom Bitlink by Destination
Returns click metrics for the specified link by its historical destinations.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/custom_bitlinks/chauncey.ly/chauncey/clicks_by_destination?unit=month&units=5&unit_reference=2006-01-02T15%3A04%3A05-0700{
"unit": "string",
"units": "integer",
"facet": "string",
"unit_reference": "string",
"metrics": [
{
"clicks": "integer",
"value": "string"
}
]
}Get Clicks for a Custom Bitlink's Entire History
Returns the click counts for the specified link. This returns an array with clicks based on a date.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/custom_bitlinks/chauncey.ly/chauncey/clicks?unit=month&units=5&unit_reference=2006-01-02T15%3A04%3A05-0700{
"link_clicks": [
{
"clicks": "integer",
"date": "string"
}
],
"units": "integer",
"unit": "string",
"unit_reference": "string"
}Groups
Groups are subdivisions within organizations. Every user will be in at least one group, and every shortened link will be in one group. Most actions on our API will be on behalf of a group. For example, when you shorten a link, it will be on behalf of a user and a group.
Retrieve Groups
Returns a list of groups in the organization.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/groups?organization_guid=Oa1bcd234eF{
"groups": [
{
"references": { "any" },
"name": "string",
"guid": "string",
"created": "string",
"modified": "string",
"is_active": "boolean",
"role": "string",
"organization_guid": "string",
"bsds": [
"string"
]
}
]
}Update a Group
Updates the details of a group.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-H 'Content-Type: application/json' \
-X PATCH \
-d '{
"name": "My New Group",
"organization_guid": "Oa1bcd234eF",
"bsds": [
"chauncey.ly"
]
}' \
https://api-ssl.bitly.com/v4/groups/Ba1bc23dE4F{
"references": { "any" },
"name": "string",
"guid": "string",
"created": "string",
"modified": "string",
"is_active": "boolean",
"role": "string",
"organization_guid": "string",
"bsds": [
"string"
]
}Retrieve a Group
Returns details for a group.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/groups/Ba1bc23dE4F{
"references": { "any" },
"name": "string",
"guid": "string",
"created": "string",
"modified": "string",
"is_active": "boolean",
"role": "string",
"organization_guid": "string",
"bsds": [
"string"
]
}Retrieve Tags by Group
Returns the tags currently used in the specified group. Maximum 1000.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/groups/Ba1bc23dE4F/tags{
"tags": [
"string"
]
}Retrieve Group Preferences
Returns preferences for the specified group.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/groups/Ba1bc23dE4F/preferences{
"group_guid": "string",
"domain_preference": "string"
}Update Group Preferences
Updates preferences for a group.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-H 'Content-Type: application/json' \
-X PATCH \
-d '{
"group_guid": "Ba1bc23dE4F",
"domain_preference": "chauncey.ly"
}' \
https://api-ssl.bitly.com/v4/groups/Ba1bc23dE4F/preferences{
"group_guid": "string",
"domain_preference": "string"
}Retrieve Group Shorten Counts
Returns all the shorten counts for a group.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/groups/Ba1bc23dE4F/shorten_counts?unit=month&units=5&unit_reference=2006-01-02T15%3A04%3A05-0700{
"unit": "string",
"units": "integer",
"facet": "string",
"unit_reference": "string",
"metrics": [
{
"key": "string",
"value": "integer"
}
]
}Get Click Metrics for a Group by Country
Returns the geographic origins of click traffic by country for the specified group.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/groups/Ba1bc23dE4F/countries?unit=month&units=5&size=10&unit_reference=2006-01-02T15%3A04%3A05-0700{
"unit": "string",
"units": "integer",
"facet": "string",
"unit_reference": "string",
"metrics": [
{
"clicks": "integer",
"value": "string"
}
]
}Get Click Metrics for a Group by City
Returns the geographic origins of click traffic by city for the specified group.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/groups/Ba1bc23dE4F/cities?unit=month&units=5&size=10&unit_reference=2006-01-02T15%3A04%3A05-0700{
"unit": "string",
"units": "integer",
"facet": "string",
"unit_reference": "string",
"metrics": [
{
"clicks": "integer",
"city": "string",
"subregion": "string",
"region": "string",
"country": "string"
}
],
"other_metrics": {
"other_city_clicks": "integer",
"no_city_clicks": "integer"
}
}Get Click Metrics for a Group by Device Type
Returns the device types generating click traffic to the specified group's links.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/groups/Ba1bc23dE4F/devices?unit=month&units=5&size=10&unit_reference=2006-01-02T15%3A04%3A05-0700{
"unit": "string",
"units": "integer",
"facet": "string",
"unit_reference": "string",
"metrics": [
{
"clicks": "integer",
"device_type": "string"
}
]
}Get Click Metrics for a Group by Referring Networks
Returns metrics by referring networks for the specified group's links.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/groups/Ba1bc23dE4F/referring_networks{
"unit": "string",
"units": "integer",
"facet": "string",
"unit_reference": "string",
"metrics": [
{
"clicks": "integer",
"value": "string"
}
]
}Organizations
Organizations are equivalent to a Bitly account. Every plan limit, group, and user is tied to an organization.
Retrieve Organizations
Retrieve a list of organizations.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/organizations{
"organizations": [
{
"references": { "any" },
"name": "string",
"is_active": "boolean",
"guid": "string",
"tier": "string",
"tier_family": "string",
"tier_display_name": "string",
"role": "string",
"created": "string",
"modified": "string",
"bsds": [
"string"
]
}
]
}Retrieve an Organization
Retrive details for the specified organization.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/organizations/Oa1bcd234eF{
"references": { "any" },
"name": "string",
"is_active": "boolean",
"guid": "string",
"tier": "string",
"tier_family": "string",
"tier_display_name": "string",
"role": "string",
"created": "string",
"modified": "string",
"bsds": [
"string"
]
}Get Shorten Counts for an Organization
Returns the shorten counts for a specific organization over a specified time period.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/organizations/Oa1bcd234eF/shorten_counts?unit=month&units=5&unit_reference=2006-01-02T15%3A04%3A05-0700{
"unit": "string",
"units": "integer",
"facet": "string",
"unit_reference": "string",
"metrics": [
{
"key": "string",
"value": "integer"
}
]
}Get Plan Limits
Returns all plan limits and counts available for an organization.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/organizations/Oa1bcd234eF/plan_limits{
"references": { "any" },
"organization_guid": "string",
"plan_limits": [
{
"name": "string",
"description": "string",
"limit": "integer",
"count": "integer"
}
]
}User
Some subscription plans allow multiple users. Only one user is used for authenticating a call, and these operations apply only to the authenticated user.
Update a User
Update fields in the user
curl \
-H 'Authorization: Bearer {TOKEN}' \
-H 'Content-Type: application/json' \
-X PATCH \
-d '{
"name": "Chauncey McPufferson",
"default_group_guid": "Ba1bc23dE4F"
}' \
https://api-ssl.bitly.com/v4/user{
"login": "string",
"name": "string",
"is_active": "boolean",
"created": "string",
"modified": "string",
"is_sso_user": "boolean",
"emails": [
{
"email": "string",
"is_primary": "boolean",
"is_verified": "boolean"
}
],
"is_2fa_enabled": "boolean",
"default_group_guid": "string"
}Retrieve a User
Returns information for the current authenticated user.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/user{
"login": "string",
"name": "string",
"is_active": "boolean",
"created": "string",
"modified": "string",
"is_sso_user": "boolean",
"emails": [
{
"email": "string",
"is_primary": "boolean",
"is_verified": "boolean"
}
],
"is_2fa_enabled": "boolean",
"default_group_guid": "string"
}Get Platform Limits
Fetch all platform limits and counts available for an organization
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/user/platform_limits?path=%2Forganizations%2F%7Borganization_guid%7D{
"platform_limits": [
{
"endpoint": "string",
"methods": [
{
"name": "string",
"limit": "integer",
"count": "integer"
}
]
}
]
}Webhooks
Webhooks are a method of sending information from Bitly to an application outside of Bitly. It's a way to automate actions or updates between two different systems. These endpoints are for configuring your webhooks.
Get Webhooks
Fetch all webhooks available for an Organization
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/organizations/Oa1bcd234eF/webhooks{
"webhooks": [
{
"references": { "any" },
"guid": "string",
"created": "string",
"modified": "string",
"modified_by": "string",
"deactivated": "string",
"is_active": "boolean",
"organization_guid": "string",
"group_guid": "string",
"name": "string",
"event": "string",
"url": "string",
"status": "string"
}
]
}Create Webhook
Creates a webhook.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-H 'Content-Type: application/json' \
-X POST \
-d '{
"is_active": true,
"organization_guid": "Oa1bcd234eF",
"group_guid": "Ba1bc23dE4F",
"name": "My Webhook",
"event": "decodes",
"url": "https://bitly.com/webhooks"
}' \
https://api-ssl.bitly.com/v4/webhooks{
"references": { "any" },
"guid": "string",
"created": "string",
"modified": "string",
"modified_by": "string",
"deactivated": "string",
"is_active": "boolean",
"organization_guid": "string",
"group_guid": "string",
"name": "string",
"event": "string",
"url": "string",
"status": "string"
}Retrieve Webhook
Returns a webhook.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X GET \
https://api-ssl.bitly.com/v4/webhooks/Wa1bcDefG23{
"references": { "any" },
"guid": "string",
"created": "string",
"modified": "string",
"modified_by": "string",
"deactivated": "string",
"is_active": "boolean",
"organization_guid": "string",
"group_guid": "string",
"name": "string",
"event": "string",
"url": "string",
"status": "string"
}Update Webhook
Update a webhook
curl \
-H 'Authorization: Bearer {TOKEN}' \
-H 'Content-Type: application/json' \
-X PATCH \
-d '{
"guid": "Wa1bcDefG23",
"is_active": true,
"organization_guid": "Oa1bcd234eF",
"group_guid": "Ba1bc23dE4F",
"name": "My Webhook",
"event": "decodes",
"url": "https://bitly.com/webhooks"
}' \
https://api-ssl.bitly.com/v4/webhooks/Wa1bcDefG23{
"references": { "any" },
"guid": "string",
"created": "string",
"modified": "string",
"modified_by": "string",
"deactivated": "string",
"is_active": "boolean",
"organization_guid": "string",
"group_guid": "string",
"name": "string",
"event": "string",
"url": "string",
"status": "string"
}Delete Webhook
Deletes a webhook.
curl \
-H 'Authorization: Bearer {TOKEN}' \
-X DELETE \
https://api-ssl.bitly.com/v4/webhooks/Wa1bcDefG23