Optimize your LinkedIn URL by replacing the assigned slug with a short custom one built from your name, then checking that tools still find you under it. The change takes about two minutes. The checking is where most guides stop short.
This version is for people who send, scrape or match LinkedIn URLs for a living. It covers the rules, the limits and two scripts.
TL;DR
- Set one custom slug: your name, 3 to 100 characters, no spaces, symbols or the word "linkedin". It takes about 15 minutes with testing.
- LinkedIn lets you change it 5 times in 6 months. Choose once.
- Testing spends 0 to 2 LeadOcean records. A lookup that finds nobody is free, and the Free plan gives you 1,000 records for life.
Prerequisites
- A LinkedIn account where you can edit your own profile.
- Python 3 with
requests, andcurl. - A LeadOcean key for the check in Step 5. Free works. Export it as
$LEADOCEAN_API_KEY. - Your current profile URL. Examples here use the placeholder
https://www.linkedin.com/in/jane-doe-example.
export LEADOCEAN_API_KEY="paste-your-key-here"Step 1: Read what your URL looks like now
Your URL is linkedin.com/in/ plus a slug. LinkedIn assigns a slug when you join. Until you change it, it often ends in a block of random characters.
That block is a heuristic, not a documented format. This check flags it.
import re
def looks_assigned(url: str) -> bool:
slug = url.rstrip("/").split("/in/")[-1].lower()
return bool(re.search(r"-[0-9a-z]{8,}$", slug) and re.search(r"\d", slug.split("-")[-1]))
print(looks_assigned("https://www.linkedin.com/in/jane-doe-98b8972b")) # True
print(looks_assigned("https://www.linkedin.com/in/jane-doe-example")) # FalseThe second example is false because example has no digit. Treat a true as "probably the assigned slug", then confirm on your profile.
Step 2: Choose a slug that passes the rules
Use your name. Add a middle initial or a short role word only if your name is taken. The rules come from LinkedIn's own help page (October 2026):
- 3 to 100 characters.
- No spaces, symbols, special characters or the word "linkedin".
- Case does not matter.
JohnSmithandjohnsmithpoint to the same profile. - Slugs are first come, first served.
This validator encodes those rules.
import re
def valid_slug(slug: str) -> list[str]:
errors = []
if not 3 <= len(slug) <= 100:
errors.append("length must be 3 to 100")
if not re.fullmatch(r"[A-Za-z0-9-]+", slug):
errors.append("letters, digits and hyphens only")
if "linkedin" in slug.lower():
errors.append("must not contain 'linkedin'")
return errors
for s in ["jane-doe", "jd", "jane doe", "jane-doe-linkedin"]:
print(s, valid_slug(s) or "ok")The validator allows hyphens. LinkedIn's page bans symbols without listing exceptions, so drop the hyphen if the form rejects it.
Here are good and bad slugs under the same rules.
| Slug | Verdict | Why |
|---|---|---|
jane-doe | Good | Short, readable, matches the name |
jane-doe-cro | Fine if jane-doe is taken | A role word breaks when the role changes |
jane-doe-98b8972b | Weak | Looks like the assigned slug and is hard to say aloud |
best-b2b-growth-ninja | Bad | Not a name, so people cannot guess it |
Step 3: Change it and mind the limits
Open Me, then View Profile, then the Edit icon next to Public profile & URL. Edit the custom URL, type the last part and click Save.
The limits are what trip people up:
- You can change it up to 5 times within 6 months. After the fifth change you wait 6 months.
- Your previous URL stays linked to you for 6 months, and nobody else can claim it in that time.
- If you unlink a URL, it is hidden for 7 days and then anyone can claim it.
- You can revert straight after a change. If you cannot, LinkedIn asks you to contact them.
- Language versions of your profile share the slug and add a language code at the end.
Do not unlink the old slug until your email signature, site and bios use the new one.
Step 4: Normalize every URL before you store it
Case does not matter on LinkedIn, but a string match in your CRM does not know that. Normalize each URL once, in one place.
from urllib.parse import urlsplit
def normalize(url: str) -> str:
parts = urlsplit(url.strip())
slug = parts.path.rstrip("/").lower()
return f"https://www.linkedin.com{slug}"
print(normalize("HTTPS://linkedin.com/in/Jane-Doe-Example/?utm_source=share"))Output:
https://www.linkedin.com/in/jane-doe-exampleThis drops the query string and the fragment, lowercases the slug and forces the www host. It does not follow redirects, so an old slug stays an old slug.
Step 5: Test the URL against LeadOcean
Send the new URL to enrichment. Exactly one identifier is allowed, and here it is linkedin_url. A 404 means we hold nothing for that profile and costs nothing.
curl -s -o /dev/null -w "%{http_code}\n" -X POST https://api.leadocean.io/v1/people/enrich \
-H "x-api-key: $LEADOCEAN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"linkedin_url": "https://www.linkedin.com/in/jane-doe-example"}'A 200 costs one record and means the URL resolves to a person. Run the same call with your previous slug.
This guide does not claim either slug will resolve after a change. Run both and treat your own result as the answer.
A 404 on the new slug right after a change is normal. The dataset refreshes monthly, so it may still hold only the old slug. If both return 404, send email instead of linkedin_url.
To audit a team, loop over a file of URLs with the Step 4 function. Keep it under the plan's rate limit, 5 requests a second on Free and 200 on Agency.
import os, time, requests
H = {"x-api-key": os.environ["LEADOCEAN_API_KEY"]}
for url in open("team_urls.txt"):
url = normalize(url)
r = requests.post("https://api.leadocean.io/v1/people/enrich",
headers=H, json={"linkedin_url": url})
print(url, r.status_code)
time.sleep(0.25)A 404 row is not a fault in your profile. It means this dataset does not hold that person. The dataset refreshes monthly, and each record carries its own fetched_at date.
Step 6: Put the new URL to work
A new slug only pays off where people see it. Update these in one sitting, because the old slug stays linked for only 6 months.
- Your email signature and your website footer.
- Speaker bios, conference pages and podcast notes.
- Your GitHub, X and other profile link fields.
- Your CRM record, using the Step 4 function so the stored string is the normalized one.
If you track clicks, add UTM parameters to the link in your signature. LinkedIn serves the same profile either way, and Step 4 strips the parameters before you match.
What you get
A 200 returns a person in the documented shape. Contact points appear only if you add "reveal_email": true, and that costs no extra record. This is the response shape from the API reference, with placeholder values.
{
"success": true,
"data": {
"profile_data": { "...": "profile fields" },
"contact_data": {
"has_email": true,
"has_phone": false,
"email_status": "verified",
"email_type": "work",
"contact_current_experiences": [ { "...": "current role" } ]
},
"resume_data": { "...": "past roles, educations, certifications when held" }
},
"meta": { "source": "leadocean" }
}Since October 2026, resume_data holds past roles and education when we have them.
Troubleshooting
| Error | Cause | Fix |
|---|---|---|
| LinkedIn says the URL is not available | Someone already claimed that slug | Add a middle initial or a short role word |
| You cannot save a sixth change | 5 changes used in 6 months | Wait, or revert to a slug you already hold |
| Old link shows Profile Not Found | You unlinked it, or 6 months passed | Re-point your signature and bios to the new slug |
| 401 from the API | Missing or wrong x-api-key | Re-export $LEADOCEAN_API_KEY and retry |
| 404 from the API | Nobody matched that URL | Free. Try the other slug, or the email |
| 429 from the API | Above the plan's rate limit | Honour Retry-After. Free allows 5 a second |
| 402 from the API | Records spent | Free is 1,000 for life. Move to Solo at $97 a month |
FAQ
Does a custom LinkedIn URL get me more visitors?
LinkedIn says a custom URL helps people and recruiters identify your profile in search results. We hold no ranking data, so we will not quote a lift. The sure gain is a URL people can type and remember.
Should I put keywords in the slug?
No. Use your name. A slug stuffed with a job title ages badly when the title changes, and you only get 5 changes in 6 months.
Can I keep the old URL working?
For 6 months, yes, unless you unlink it. After that you have no guarantee. Update every place that links to the old one.
Does LeadOcean update when I change my slug?
The dataset is refreshed monthly, so a change can take a refresh cycle to show. Test both slugs to see where yours stands.
How do I find a LinkedIn URL for someone else?
See how to find a LinkedIn URL from a website.
To go the other way, read how to get an email from a LinkedIn profile. For engagement signals, see warm leads from LinkedIn posts.
Check any LinkedIn URL against 693M people. Start free.
Free to start. No credit card. 1,000 records to spend whenever you like.
Get your free API key →