Skip to main content
Use this endpoint to check the status of a tool operation. This is particularly useful when:
  • You’ve set async: true and want to poll for the result
  • A synchronous request timed out (>30 seconds) and was automatically processed in the background
GET https://api.pdfnoodle.com/v1/tools/status/:requestId

Request

curl --location 'https://api.pdfnoodle.com/v1/tools/status/pdfnoodle_request_123456789' \
--header 'Authorization: Bearer pdfnoodle_api_123456789'

Response

The endpoint responds with 200 OK and returns the current status of the tool operation:
{
  "requestId": "pdfnoodle_request_123456789",
  "status": "ONGOING",
  "result": null,
  "metadata": {}
}
The result object contains the same response body you would receive from a synchronous tool request. For example, a merge operation returns url, fileName, and urlValidUntil, while a split operation returns urls, totalParts, etc.

Parameters

requestId
string
required
The requestId returned from an async tool request or from a synchronous request that timed out.

Response Fields

If the status is FAILED, check the metadata.errorMessage for details on what went wrong. Contact support if the issue persists.

Usage Example

Here’s a complete example of using async mode with polling:
// Step 1: Make an async tool request
const response = await fetch("https://api.pdfnoodle.com/v1/tools/merge-pdfs", {
  method: "POST",
  headers: {
    Authorization: "Bearer pdfnoodle_api_123456789",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    urls: [
      "https://example.com/document-1.pdf",
      "https://example.com/document-2.pdf",
    ],
    async: true,
  }),
});

const { requestId, statusUrl } = await response.json();

// Step 2: Poll for the result
async function pollForResult(requestId) {
  const maxAttempts = 60;
  let attempts = 0;

  while (attempts < maxAttempts) {
    const statusResponse = await fetch(
      `https://api.pdfnoodle.com/v1/tools/status/${requestId}`,
      {
        method: "GET",
        headers: {
          Authorization: "Bearer pdfnoodle_api_123456789",
        },
      }
    );

    const result = await statusResponse.json();

    if (result.status === "SUCCESS") {
      return result.result;
    }

    if (result.status === "FAILED") {
      throw new Error(result.metadata.errorMessage);
    }

    await new Promise((resolve) => setTimeout(resolve, 5000));
    attempts++;
  }

  throw new Error("Operation timed out");
}

const result = await pollForResult(requestId);
console.log("Merged PDF URL:", result.url);