I've developed an app which connects to the Lucid API and calls GET https://api.lucid.co/documents/{doc_id}/contents to retrieve the contents of a document.
Most of the time, my request is successful: I get back a 200
response along with the JSON document.
However sometimes the Lucid API server fails to return the document. Instead I see this error.
Why is this happening? The document in question is only about 360KB, so it's not particularly large, and it is certainly not being modified by anyone.
Error: {"code":"badRequest",
"message":"Bad or malformed request",
"requestId":"8964e70358ce692e",
"details":{"error":"Document 62563ead-aa4a-4d29-8f2d-858a0a163b0d is too large to retrieve contents."}}
Context
The scopes used to create the access token areconst SCOPES = ["lucidchart.document.content", "offline_access", "user.profile"];
The document request is
const LUCID_API_HOST = "https://api.lucid.co";
const url = `${LUCID_API_HOST}/documents/${docId}/contents`;
const headers = {
"Lucid-Api-Version": "1",
Authorization: `Bearer ${accessToken}`,
"Content-Type": "application/json",
};
fetch(url, { method: "get", headers })