Skip to main content

One-click Bitly import

Migrate your existing Bitly links into LeonAI in a single call. You provide a Bitly access token; LeonAI reads your Bitly links and recreates them through the normal link creation path — so imported links behave exactly like links you create directly. Requires links:write. Available on all tiers (imports respect your plan's link limit).

The import is idempotent: re-running it skips links that already exist, so it's safe to retry.

Preview first with a dry run​

Always start with dryRun: true to see what would be imported without writing anything:

curl -X POST https://api.short.leonai.io/api/v1/imports/bitly \
-H "X-API-Key: $LEONAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"accessToken": "<your-bitly-access-token>",
"dryRun": true
}'

Response (200 OK):

{
"success": true,
"data": {
"imported": 128,
"skipped": 12,
"failed": 2,
"limitReached": false,
"dryRun": true,
"sampleErrors": [{ "shortUrl": "bit.ly/xxxx", "reason": "Invalid destination URL" }]
}
}
FieldMeaning
importedLinks created (or that would be created, in a dry run)
skippedLinks skipped because they already exist (idempotency)
failedLinks that could not be imported
limitReachedtrue if your tier's link limit stopped the import partway
dryRunEchoes whether this was a preview
sampleErrorsA sample of { shortUrl, reason } for failures, for troubleshooting

Run the real import​

Once the preview looks right, drop dryRun (or set it to false):

curl -X POST https://api.short.leonai.io/api/v1/imports/bitly \
-H "X-API-Key: $LEONAI_API_KEY" -H "Content-Type: application/json" \
-d '{ "accessToken": "<your-bitly-access-token>" }'
Tier limits apply

Because imported links count against your plan's link quota, a large library can hit the limit. When it does, the import stops and returns limitReached: true with the number imported so far — upgrade and re-run (already-imported links are skipped).

Error codes​

StatusWhen
400Missing or malformed accessToken
429Rate limit exceeded (yours or Bitly's) — retry after a backoff
502Bitly could not be reached or returned an error
  • Links — bulk import from JSON/CSV as an alternative
  • Billing — plan link limits
  • API Reference — the full OpenAPI spec and Swagger UI