Linkedin API - get company ID from url
Asked Answered
A

11

7

Is there a way to get the numeric company ID from the URL of a company page on Linkedin? This ID is the one I'll use to query the Linkedin API and get more information on the company. I need to get the ID from the information provided with the URL, to use it to get the rest of the information related to the company page.

It seems unusual to me that you need to dig in the HTML code to get the company ID you need to use to interact using the Linkedin API, so correct me if I'm wrong.

I know there have been similar request handlers, but I'm wondering why there isn't a handler available to get the company ID like there is to get the profile id from its url:

https://api.linkedin.com/v1/people/url=xxxx

I know there is the search company handler, but that is a text based research and I found myself with some inconsistent results from time to time.

I don't want to crawl the company page for the ID since I get blacklisted by Linkedin if I do it too many times from the same IP address.

I am aware of these answers:

But they seem outdated or marginally related to what I ask and since LI API has changed much over the past year, if there was any development on this.

EDIT: added more info on the kind of ID I am looking for. I had erroneously marked @display's answer as correct but unfortunately it's not what I am looking for. I am referring to the companyId that I'd use to query the Linkedin API concerning that company.

Archipelago answered 30/3, 2016 at 18:37 Comment(1)
Not a panacea, but potentially useful: learn.microsoft.com/en-us/linkedin/marketing/integrations/… – Jariah
M
7

June 2020 Update

Most of the above methods no longer work, including using the jobs page URL and hovering over search results. The 2019 update by @rinogo almost works. To make it easier, paste this script into the console. Of course, updates from LinkedIn may case this to fail eventually.

(() => {
  const name = document.location.pathname.replace(/^\/[^\/]*\/([^\/]*)\/?/, '$1');
  for (let json of Array.from(document.querySelectorAll('code'))) {
    try {json = JSON.parse(json.innerText);} catch (e) {json = null;}
    if (json && json.included) {
      for (let incl of json.included) {
        if (incl.universalName === name && incl.objectUrn) {
          return 'Company ID for [' + incl.universalName + '] is [' + incl.objectUrn.substr('urn:li:company:'.length) + ']';
        }
      }
    }
  }
  return 'Company ID not found';
})();
Mcnalley answered 30/6, 2020 at 23:37 Comment(3)
Works for me, 6 October 2020. Thanks! 😊 – Luteous
bookmarklet: javascript:(() => { const name = document.location.pathname.replace(/^\/[^\/]*\/([^\/]*)\/?/, '$1'); for (let json of Array.from(document.querySelectorAll('code'))) { try {json = JSON.parse(json.innerText);} catch (e) {json = null;} if (json && json.included) { for (let incl of json.included) { if (incl.universalName === name && incl.objectUrn) { alert('Company ID for [' + incl.universalName + '] is [' + incl.objectUrn.substr('urn:li:company:'.length) + ']'); return; } } } } alert('Company ID not found'); return; })(); – Aile
What is 'the console'? Oh, I see. Browser console. Worked great. Thanks. – Fiendish
J
3

2020 update

Please see Whatabrain's answer.

2019 update

Arbitrary Pages

The solutions provided previously are outdated. The following is not the best solution, but it will work in a pinch. It does require "crawling", unfortunately. (I know this doesn't answer OP's question, but it should help others who arrive here since this is the top Google result)

View the HTML source for the "home page" of the company whose ID you are trying to discover. Search for the string, https://www.linkedin.com/company/. The first instance of this string on the page is followed immediately by the company ID.

You can verify that you have the right company ID by visiting the entire link (including the Company ID), e.g. https://www.linkedin.com/company/123456.

If this approach stops working at some point, please comment below and I'll update this answer.

UPDATE: I'm using the strategy today (7/2/2019) and am finding that the last instance is currently more reliable due to some changes made by LinkedIn. Ultimately, the overall strategy remains sound. View the source and find some repeatable way to search for the company ID. It may take some experimentation to find a reliable approach.


Pages with admin rights

If you have admin rights to the Page, finding the Company ID is trivial. While signed in, visit your Company Page. The Company ID is used right within the URL.

For example:

Admin URL for Company Page: https://www.linkedin.com/company/123123123/admin/

Company ID: 123123123

Or, you can of course use the API to find the Company ID for any Company Page of which you are an admin.

Jariah answered 28/12, 2018 at 19:53 Comment(2)
Of course, if you have admin access to the Company Page, getting the ID via the API is trivial. There should be plenty of documentation out there about how to do so in the official docs. – Jariah
@Garconis Perhaps provide a link to your Company Page in chat and I can help you out? – Jariah
C
2

We can obtain the company id from the url of a company page. For this we must have a valid linkedin account. Once you are in the company page, just check the url

https://www.linkedin.com/company/123456

The numbers given as 123456 is the respective company id.

Hope that you meant this company id.

Codify answered 29/6, 2016 at 13:7 Comment(3)
I think I'll try to check this. It seems a new thing for Linkedin since I don't remember the ID inside the URL.. Hopefully it works for all the companies and not only for the new ones. – Archipelago
Hi @display. I've updated my question. That id you mention is fine, but unfortunately some of the new Linkedin urls do not have the numeric ID I need to query the Linkedin API to get information on a company. Do you know of a way to get this numeric ID from the url? – Archipelago
the problem is that you can have https://www.linkedin.com/company/oracle and https://www.linkedin.com/company/1028 from the first impossible to know the ID – Snipes
R
2

As of Sep 2024, I find this method to get Organization/Company ID. Here's the step-by-step guide:-

  1. Navigate to the Company page and Inspect the page, then head over to the Network tab - Preview 1
  2. Click on the Follow/Unfollow button on the Company page - Preview 2
  3. A POST request is made to the following URL https://www.linkedin.com/voyager/api/feed/dash/followingStates/urn:li:fsd_followingState:urn:li:fsd_company:1337 - Preview 3

The numerical value after fsd_company: is the Organization/Company ID.

Verify this ID here - https://www.linkedin.com/company/1337

Royroyal answered 15/10, 2023 at 9:25 Comment(0)
R
1

The way I got the ID is by going to the page, and clicking "View Jobs" (as long as they have some).

Then the URL will have the ID on it:

https://www.linkedin.com/jobs/search?locationId=OTHERS.worldwide&f_C=12345678
Recession answered 7/2, 2019 at 18:39 Comment(0)
S
0

To find your LinkedIn company ID:

  1. Open LinkedIn in a new tab
  2. In your search results, select your company page.
  3. Navigate to the URL at the top of your company page.
  4. Copy the number immediately following 'www.linkedin.com/company/' but before the question mark.

Solution provided by: https://support.klipfolio.com/hc/en-us/articles/216181827-Use-LinkedIn-as-a-data-source

Seleucid answered 13/10, 2016 at 12:58 Comment(0)
C
0

Anyone still looking a solution, please follow:

  1. Go to https://developer.linkedin.com/plugins/company-profile
  2. Type the name of the company in the Company Name box and it will suggest the name.
  3. Once you select the Company page, click on Get Code button.
  4. You will get the company page id with data-id.

Screenshot:

enter image description here

Curch answered 14/9, 2018 at 5:10 Comment(1)
Page not found. – Recession
F
0

I know it kinda hard to find it, but you can find the company id by manually, maybe someone can make it into auto or make the code into javascript to find the company id but you can find company id after

urn:li:fsd_company:

inside element (inspect element after that ctrl + f)

Funkhouser answered 20/9, 2023 at 3:34 Comment(0)
J
0

Just a heads up - you can get this by:

  1. Opening an incognito window,
  2. Searching for the company like "LinkedIn Company name".
  3. Then goto the unlogged in linkedin site with the reduced company profile
  4. Click "View all nn employees"
  5. LinkedIn will try to log you in but look closely in the URL for the "facetCurrentCompany%3D%"
  6. There will be some numbers and a letter.
  7. The numbers AFTER the letter is the company ID.

Geez....

Jaco answered 14/8 at 11:47 Comment(0)
C
-1

Successfully used this method 2/27/2019.

  1. Search for the company in LinkedIn.com
  2. When located in search window, HOVER over the company name.
  3. Locate ID at the bottom showing where the URL will direct.

Hovered over company name in top arrow, gathered ID in displayed URL at bottom arrow

Collected answered 27/2, 2019 at 20:14 Comment(0)
P
-2

I have a much easier solution that works! (15/01/2019)

Go to the company's page e.g. https://www.linkedin.com/company/something

Then view the source (CTRL+U in Chrome). Search for the expression "company/". The second match contains the ID! Have fun.

Prajna answered 15/1, 2019 at 11:31 Comment(2)
The question specifically says "I don't want to crawl the company page for the ID since I get blacklisted by Linkedin if I do it too many times from the same ip." so this doesn't seem a valid answer – Elisha
Also the 2018 Update answer still works, and is more specific, i.e. it's the first match for that string. – Natalia

© 2022 - 2024 β€” McMap. All rights reserved.