Microsoft Graph API | Request and Response Max Payload size

Abhay Chandramouli 1,051 Reputation points
2023-04-03T07:17:55.9266667+00:00

I want to know the maximum allowed payload (in KB/MB) size for request and response for

/users POST

/users PATCH

/users GET

/users DELETE

Thanks,

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,498 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Unknown_Beast 145 Reputation points
    2023-04-03T07:26:11.53+00:00

    The maximum allowed payload size for requests and responses in Microsoft Graph API varies based on the specific endpoint being used and the HTTP method being used (e.g. POST, PATCH, GET, DELETE). Additionally, the maximum payload size may also depend on other factors such as the authentication method being used and the type of data being sent or received.

    As a general rule, the maximum payload size for requests and responses in Microsoft Graph API is typically limited to 4MB. However, some endpoints may have lower limits, such as 1MB or 2MB.

    To find the specific maximum payload size for a given endpoint and HTTP method, you can consult the Microsoft Graph API documentation. Each endpoint documentation page includes a "Request body" section that specifies the maximum payload size for that endpoint.

    For example, the documentation for the /users POST endpoint specifies a maximum payload size of 4MB, while the /users PATCH endpoint has a maximum payload size of 2MB. The /users GET and /users DELETE endpoints do not have a request body, so the maximum payload size for those endpoints is not relevant.

    Keep in mind that exceeding the maximum allowed payload size for a given endpoint can result in errors or data loss, so it is important to ensure that your requests and responses stay within the specified limits.

    0 comments No comments

  2. Zehui Yao_MSFT 5,876 Reputation points
    2023-04-10T09:39:31.4+00:00

    Hi Abhay Chandramouli at the same time, Graph also supports uploading large files (larger than 4MB) by creating an upload session

    POST /drives/{driveId}/items/{itemId}/createUploadSession
    

    Then upload the file content to the upload session :

    PUT https://sn3302.up.1drv.com/up/fe6987415ace7X4e1eF866337
    Content-Length: 26
    Content-Range: bytes 0-25/128
    <bytes 0-25 of the file>
    

    You can refer to this documentation: https://learn.microsoft.com/en-us/graph/api/driveitem-createuploadsession?view=graph-rest-1.0


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  3. Campbell, David (TBS) 46 Reputation points
    2025-04-07T14:42:47.6233333+00:00

    I need to download a .docx file in PDF format.

    When running the following code: in an azure function using c# and Graph SDK 5.x

     var requestInfo = graphServiceClient.Drives[usersDrive.Id]
                                  .Items[theDriveItem.Id]
                                  .Content
                                  .GetAsync(requestConfiguration =>
                                            {
                                               requestConfiguration.QueryParameters.Format = "pdf";
                                            });
    

    On a file that is more than 1 mb will timeout.

    I can successfully download the file using the following code:

    var theDriveItem = graphClient.Drives[usersDrive.Id]
                                  .Items[uploadedDriveItem.Id]
                                  .ToGetRequestInformation(
                                       requestConfiguration =>
                                       {
                                       	  requestConfiguration.QueryParameters.Format = "pdf";
                                       });
    theDriveItem.AdditionalData.TryGetValue("@microsoft.graph.downloadUrl", 
    											out object downloadUrl);
    

    Then making a call using an HttpClient: ( actual implementation also uses Headers.range ) HttpRequestMessage req = new(HttpMethod.Get, (string)downloadUrl);

    Downloading a large file is not a problem, the problem occurs when you want that file in a different format.

    The download link of course is for the docx .. NOT for the requested format.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.