Bitly’s old v3 API is effectively gone. It ran on API keys and returned XML by default, and any guide built around it (including our own, now retired) stopped working once Bitly moved everyone onto v4. If you’re still exporting Bitly link history into Excel for reporting, the current approach uses OAuth2 bearer tokens and a proper JSON REST API, and it’s actually less hassle once it’s set up.
This walks through generating a v4 access token, pulling your link history with a simple request, and loading it straight into Excel with Power Query so it refreshes on demand rather than being a one-off CSV.
Quick Facts
- Bitly’s current API is v4, JSON only, authenticated with an
Authorization: Bearertoken, not the old API key. - The base URL is
https://api-ssl.bitly.com/v4/. - For a personal export script, generate a token from your own account. You don’t need to register an OAuth app.
- Link history comes from
/v4/groups/{group_guid}/bitlinks, paginated in batches (100 per page max). - Power Query can call the API directly with a custom header, so Excel refreshes live rather than you re-exporting a CSV each time.
Step 1: Generate an access token
Log into Bitly, go to your profile icon, then Settings, Developer settings. Under API you can generate a token straight away. This is a personal access token tied to your account and is the simplest route for a script or a Power Query connection that only you use.
If you’re building something that needs to act on behalf of other users (a third-party app, not an internal export), you’d register an OAuth app instead and exchange an authorisation code for a token via /oauth/access_token. For a straightforward Excel export, the personal token is all you need. Keep it out of any workbook you share and treat it like a password.
Every request needs it in the header, not as a query parameter:
Authorization: Bearer YOUR_ACCESS_TOKEN
Step 2: Find your group GUID
Bitlinks belong to a group (Bitly’s term for a workspace), and the export endpoint needs that group’s GUID rather than your account. Grab it from your own user record:
curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
https://api-ssl.bitly.com/v4/user
The response includes default_group_guid. If you manage multiple groups (agency accounts, several brands), GET /v4/groups lists them all with their own guid values.
Step 3: Pull the link history
With the group GUID in hand, request the bitlinks:
curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
"https://api-ssl.bitly.com/v4/groups/GROUP_GUID/bitlinks?size=100"
Each result gives you link (the short URL), long_url (the destination), title, created_at, tags and archived, among other fields. That’s already enough for most reporting.
If you have more than 100 links, the response includes a pagination object with a search_after cursor. Pass that back as the search_after query parameter on the next request to get the following page, and keep going until it’s empty. There’s no single “give me everything” call, so budget for a loop if your account has a large link library.
Click counts aren’t included in this response. For those, query /v4/bitlinks/{bitlink_id}/clicks/summary per link, with a unit (day, week, month) and units (how many, or -1 for all time). It’s a separate call per link, so only bother if you actually need click totals in the export.
Step 4: Load it into Excel with Power Query
This is the part that actually replaces the old bulk-export workflow, and it’s better than a CSV because you can refresh it. In Excel: Data, Get Data, From Other Sources, Blank Query, then open the Advanced Editor and paste something like this:
let
Source = Json.Document(Web.Contents(
"https://api-ssl.bitly.com/v4/groups/GROUP_GUID/bitlinks?size=100",
[Headers=[Authorization="Bearer YOUR_ACCESS_TOKEN"]]
)),
links = Source[links],
ToTable = Table.FromList(links, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
Expanded = Table.ExpandRecordColumn(ToTable, "Column1",
{"id", "link", "long_url", "title", "created_at", "tags", "archived"})
in
Expanded
Click Close & Load and you’ve got a proper Excel table. Right-click it and choose Refresh whenever you want an up-to-date export, no re-running a script and re-importing a file. Swap the GROUP_GUID and token for your own values, and if you’re paginating past 100 links, wrap the same call in a function that follows search_after and appends each page’s results.
| v3 (retired) | v4 (current) |
| API key in the query string | OAuth2 bearer token in the header |
| XML by default, JSON optional | JSON only |
bitly.com/v3/... | api-ssl.bitly.com/v4/... |
| Flat link list | Grouped by workspace, paginated with search_after |
Frequently asked questions
Do I still need to register an app with Bitly?
Not for a personal export. A generic access token from Developer settings works for scripts and Power Query connections you control yourself. App registration is only needed if you’re building something other people authorise on their own accounts.
Why does my export stop at 100 links?
That’s the maximum page size. Check the pagination.search_after value in the response and pass it as a query parameter on your next call to keep going. An empty value means you’ve reached the end.
Will I get rate limited pulling a large history?
Possibly, on a big account. Bitly’s per-minute limit is a fraction of your hourly limit, and both vary by plan. Check GET /v4/user/platform_limits for your actual figures, and if you’re paginating through thousands of links, add a short pause between requests rather than firing them back to back.
Can I get click counts in the same export?
Not in the bitlinks list itself. Click data is a separate call per link (/v4/bitlinks/{bitlink_id}/clicks/summary), so only add it to your Power Query if you genuinely need click totals alongside the link list, since it multiplies the number of requests.
Discover more from TechyGeeksHome
Subscribe to get the latest posts sent to your email.