> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pdfnoodle.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get PDF Status

> Retrieve the status of a PDF generation request using the requestId returned from asynchronous requests or when synchronous requests timeout.

> [!NOTE]
>
> Use this endpoint to check the status of a single PDF generation request. This is particularly useful when:
>
> <ul>
>   <li>You've made an asynchronous request and want to poll for status instead of waiting for the webhook</li>
>   <li>A synchronous request timed out (>30 seconds) and was automatically queued asynchronously</li>
> </ul>
>
> If you're looking to check the status of a batch PDF generation, use the [Get Batch PDF Status](https://docs.pdfnoodle.com/api-reference/pdf-status/get-batch.md) endpoint instead.

GET [https://api.pdfnoodle.com/v1/pdf/status/:requestId](https://api.pdfnoodle.com/v1/pdf/status/:requestId)

## Request

```bash cURL theme={null}
curl --location 'https://api.pdfnoodle.com/v1/pdf/status/pdfnoodle_request_123456789' \
--header 'Authorization: Bearer pdfnoodle_api_123456789'
```

```javascript JavaScript theme={null}
const response = await fetch(
  "https://api.pdfnoodle.com/v1/pdf/status/pdfnoodle_request_123456789",
  {
    method: "GET",
    headers: {
      Authorization: "Bearer pdfnoodle_api_123456789",
    },
  }
);

const result = await response.json();
```

```python Python theme={null}
import requests

response = requests.get(
    'https://api.pdfnoodle.com/v1/pdf/status/pdfnoodle_request_123456789',
    headers={
        'Authorization': 'Bearer pdfnoodle_api_123456789'
    }
)

result = response.json()
```

## Response

The endpoint responds with `200 OK` and returns the current status of the PDF generation:

```json ONGOING theme={null}
{
  "requestId": "pdfnoodle_request_123456789",
  "renderStatus": "ONGOING",
  "signedUrl": "",
  "metadata": {}
}
```

```json SUCCESS theme={null}
{
  "requestId": "pdfnoodle_request_123456789",
  "renderStatus": "SUCCESS",
  "signedUrl": "https://pdforge-production.s3.us-east-2.amazonaws.com/...",
  "metadata": {
    "executionTime": "1.805 seconds",
    "fileSize": "4.066 kB"
  }
}
```

```json FAILED theme={null}
{
  "requestId": "pdfnoodle_request_123456789",
  "renderStatus": "FAILED",
  "signedUrl": "",
  "metadata": {}
}
```

## Parameters

**requestId** `string` *required*

The requestId returned from an asynchronous request or from a synchronous
request that timed out

## Response Fields

The unique identifier for this PDF generation request

The current status of the PDF generation. Possible values: - `ONGOING` - The
PDF is still being generated - `SUCCESS` - The PDF has been successfully
generated - `FAILED` - The PDF generation failed

A temporary URL pointing to the generated PDF file. This will be empty (`""`)
when `renderStatus` is `ONGOING` or `FAILED`. The URL expires after 1 hour.

Additional metadata about the PDF render. Contains: - **executionTime** - Time
in seconds it took to generate your PDF (only present when `renderStatus` is
`SUCCESS`) - **fileSize** - PDF size in kiloBytes (only present when
`renderStatus` is `SUCCESS`)

> [!CAUTION]
>
> If the `renderStatus` is `FAILED`, you should contact support to figure out
> why your PDF generation failed.

## Usage Example

Here's a complete example of polling for PDF status:

> [tab] Node.js
>
> ```javascript theme={null}
> async function checkPdfStatus(requestId) {
>   const maxAttempts = 60; // Poll for up to 5 minutes (60 * 5 seconds)
>   let attempts = 0;
>
>   while (attempts < maxAttempts) {
>     const response = await fetch(
>       `https://api.pdfnoodle.com/v1/pdf/status/${requestId}`,
>       {
>         method: "GET",
>         headers: {
>           Authorization: "Bearer pdfnoodle_api_123456789",
>         },
>       }
>     );
>
>     const result = await response.json();
>
>     if (result.renderStatus === "SUCCESS") {
>       return result.signedUrl;
>     }
>
>     if (result.renderStatus === "FAILED") {
>       throw new Error("PDF generation failed");
>     }
>
>     // Wait 5 seconds before checking again
>     await new Promise((resolve) => setTimeout(resolve, 5000));
>     attempts++;
>   }
>
>   throw new Error("PDF generation timed out");
> }
> ```

> [tab] Python
>
> ```python theme={null}
> import requests
> import time
>
> def check_pdf_status(request_id):
>     max_attempts = 60  # Poll for up to 5 minutes (60 * 5 seconds)
>     attempts = 0
>
>     while attempts < max_attempts:
>         response = requests.get(
>             f'https://api.pdfnoodle.com/v1/pdf/status/{request_id}',
>             headers={
>                 'Authorization': 'Bearer pdfnoodle_api_123456789'
>             }
>         )
>
>         result = response.json()
>
>         if result['renderStatus'] == 'SUCCESS':
>             return result['signedUrl']
>
>         if result['renderStatus'] == 'FAILED':
>             raise Exception('PDF generation failed')
>
>         # Wait 5 seconds before checking again
>         time.sleep(5)
>         attempts += 1
>
>     raise Exception('PDF generation timed out')
> ```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.