bannerColor WARNING_YELLOW templateName stackForums

Invitation API - Unauthorized access

3 posts / 0 new
Last post
Fikre Leguesse's picture
Joined: 2011-08-30
May 10, 2013
Invitation API - Unauthorized access

Is there anything wrong with the below request? I keep getting an 'Unauthorized Access' response

Content-Type: application/json; charset=utf-8
x-li-format: json
Content-Length: 223
Expect: 100-continue

{"recipients":{"values": [{"_path":"/people/IDRetrievedFromSearch"}]},"subject":"Test Subject","body":"Test Body","item-content": { "invitation-request": { "connect-type":"friend","authorization":{"name":"NAME_SEARCH","value":"pXCC"}}}}

Shikha A. Sehgal's picture
LinkedIn Employee
Joined: 2012-07-27
May 10, 2013

hey Fikre:

Are you using w_messages member permission as explained in this doc -

Jack Sparrow's picture
Joined: 2014-05-21
Jun 2, 2014

I am so new to LinkedIn

Hi I have used the following code to send a connection request using linkedIn mailbox api.

NSString *str=[NSString stringWithFormat:@"",authToken];

NSMutableURLRequest *request=[NSMutableURLRequest
requestWithURL:[NSURL URLWithString:[str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]

NSDictionary *requestData =@{@"recipients":@{
@"_path":[NSString stringWithFormat:@"/people/id=%@",memberId]
@"subject": @"Invitation to connect.",
NSError *error2;
NSData *postData = [NSJSONSerialization dataWithJSONObject:requestData options:0 error:&error2];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:postData];

NSURLResponse *response;
NSError *error=nil;
NSData *connection=[NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];


I could see few fields in the header additional to that of


"authorization field which i have omitted in the json header because i have no idea how to get those values of 'name' and 'value'..

When inviting by member id, you must include a name and value node under invitation-request/authorization. You can get these authorization codes from standard profile and search results.

which api is are you mentioning above.