# PDF Report API

The PDF Report API enables API clients to asynchronously generate and download
PDF reports for connected SQR users.

The flow is fully async:
1. **Create** a report job — `POST /v1/document/api`
2. **Poll** for job completion — `GET /v1/document/api/{id}`
3. **Retrieve** the signed download URL — `GET /v1/document/api/{id}/url`

All endpoints require a **Bearer token** obtained from the OAuth Token API.


Version: 1.0

## Servers

```
https://api.sqr-group.com
```

## Security

### bearer

Type: http
Scheme: bearer
Bearer Format: JWT

## Download OpenAPI description

[PDF Report API](https://docs.sqr-group.com/_bundle/apis/pdf-report-docs.yaml)

## PDF Report (API Client)

API client PDF report generation job management.

### Create a PDF report generation job

 - [POST /v1/document/api](https://docs.sqr-group.com/apis/pdf-report-docs/pdf-report-(api-client)/createorgreportjob.md): Enqueues an async PDF report generation job for the specified user.
Authenticated via org Bearer token.

Returns 202 Accepted immediately with a jobId. The report is generated
in the background. Poll GET /v1/document/api/{id} to track progress.

Rate limit: Max 10 requests per 10 minutes per org.

### Get report job status

 - [GET /v1/document/api/{id}](https://docs.sqr-group.com/apis/pdf-report-docs/pdf-report-(api-client)/getorgreportjob.md): Returns the current status and metadata of a report generation job
scoped to the authenticated org.

Poll this endpoint until status reaches a terminal state:
- COMPLETE — report is ready; proceed to retrieve the download URL.
- FAILED — report generation failed; see errorCode for details.

Recommended polling interval: every 3–5 seconds initially, backing off
to 10–15 seconds if the job is still running after 30 seconds.

### Get a signed download URL for a completed PDF report

 - [GET /v1/document/api/{id}/url](https://docs.sqr-group.com/apis/pdf-report-docs/pdf-report-(api-client)/getorgreportdownloadurl.md): Issues a time-limited pre-signed S3 URL for downloading a completed PDF report.

- The URL is valid for 5 minutes (300 seconds) from the time it is issued.
- Org scope and RBAC are re-validated on every call — URLs are never cached server-side.
- If the report job is not yet in COMPLETE status, the API returns 422 Unprocessable Entity.

To download the report, make a direct GET request to the returned url. The URL
expires after expiresInSeconds seconds. Call this endpoint again to get a fresh URL.

