Contacts API

Note

The use of this API is restricted to those developers approved by LinkedIn and subject to applicable data restrictions in their agreements.

The Contacts API provides a complete list of the authenticated user's address book on LinkedIn. This address book includes their LinkedIn connections as well as any contact they've imported from other services such as Gmail and Yahoo! Mail.

As the list of contacts for any given user can be quite large, the Connections API utilizes an asynchronous call pattern to first request that the address book is generated. Once generated successfully, issue a another request to retrieve the user's address book contacts.

Initiating a Request to Generate the Address Book

Begin the process of getting the address book for a user by issuing a POST command to the following URL:

POST https://api.linkedin.com/v2/contactExporterTasks

A successful request will generate a 201 Created response, as well as a task id. The task id will be contained in the x-linkedin-id header field of the response.

Sample response header

x-linkedin-id: {task ID}

Use the task ID to:

  • Check on the status of a task: IN_PROGRESS, SUCCEEDED, or FAILED
  • Get the results of the task (the full address book for the user) once it has completed successfully

Retrieving the Generated Address Book

Once the process to generate the user's current address book has successfully been started, you can check on the status as well as retrieve the results.

If the user's results are available, all address book contacts will be included within the single response - there is no paging support.

GET https://api.linkedin.com/v2/contactExporterTasks/{task ID}?projection=(id,owner,status,result~)

Sample Response

{
    "id": "AQFHd8...",
    "owner": "urn:li:person:iQ5j0xo1FK",
    "result": "urn:li:contactExporterTaskResult:(AQFHd8...)",
    "result~": {
        "contacts": [
            {
                "emailAddress": "email@linkedin.com",
                "name": "abcabcabc lastName",
                "phoneNumber": {
                    "number": "1234445555"
                }
            }
        ],
        "expiresAt": 1475344703930,
        "id": "AQH3DG..."
    },
    "status": "SUCCEEDED"
}

It is important to be aware of the expiresAt field. Results from the Contacts list creation process are only available for a finite time, after which you have to regenerate a new Contacts list for the authenticated user.