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" }]
}
}
| Field | Meaning |
|---|---|
imported | Links created (or that would be created, in a dry run) |
skipped | Links skipped because they already exist (idempotency) |
failed | Links that could not be imported |
limitReached | true if your tier's link limit stopped the import partway |
dryRun | Echoes whether this was a preview |
sampleErrors | A 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>" }'
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
| Status | When |
|---|---|
400 | Missing or malformed accessToken |
429 | Rate limit exceeded (yours or Bitly's) — retry after a backoff |
502 | Bitly could not be reached or returned an error |
Related
- Links — bulk import from JSON/CSV as an alternative
- Billing — plan link limits
- API Reference — the full OpenAPI spec and Swagger UI