Showing results for 
Search instead for 
Did you mean: 

403 forbidden when REST api call

I am calling "{0}/reports/{1}/ExportTo" Api in my mvc application.

HttpWebRequest request = System.Net.HttpWebRequest.CreateHttp(string.Format("{0}/reports/{1}/ExportTo", workspaceId,reportId1));
request.KeepAlive = true;
request.Method = "POST";
request.ContentType = "application/json";

request.Headers.Add("Authorization", String.Format("Bearer {0}", token));

using (var streamWriter = new StreamWriter(request.GetRequestStream()))
string json = "{\"format\":\"PDF\"}";


var response = (HttpWebResponse)request.GetResponse();

Here i was getting access token like this,

string result = authContext.AcquireTokenAsync(resourceUriPowerBi, clientCredential).Result.AccessTok...

after this I got the error

{"error":{"code":"InvalidRequest","message":"Export report requires effective identity to be provided for the report's dataset"}}

then I write a code to get embed token by passing access level and identities i used at power bi Desktop to use RLS

string embedToken =
(await pbiClient.Reports.GenerateTokenInGroupAsync(workspaceId,

Now I got the 403 forbidden error with no text.

Can anyone please help me to understand this why it is giving 403 error.

earlier i successfully called the refresh dataset api using access token got using client credential...

Tahnks in advance.

Status: New
Community Support

Hi @nayana


Please try the API with your account via Try it to see if the same issue occurs:


Best Regards,
Qiuyun Yu

New Member

Hi @v-qiuyu-msft

Same response using Try it, Postman

Now, for reports which do not have row level security applied I am successfully able to get PDF by next api 

Get File Of Export To File In Group. 

But when I input reports to which Row level security applied from Power bi desktop giving this error

{"error":{"code":"InvalidRequest","message":"Export report requires effective identity to be provided for the report's dataset"}}


Here I thought I should use embed token with roles and identities, so I passed the embed token in Authorization header. But for this now I am getting 403 error.


I can't reach to conclusion whether I stick with access token or I should use embed token both are giving two different errors.

Community Support

Hi @nayana


Please create a support ticket to get help. 


Support Ticket.gif


Best Regards,
Qiuyun Yu

Frequent Visitor

I would like to know if you got this resolved ?

As I'm sitting with a simillar issue....