apyhub
DATA EXTRACTION · FILE MANIPULATION

Fix PDF Orientation API

Hosted on ApyHub

What it does

PDF Orientation Fixer auto-rotates PDF pages into the correct orientation using OCR. Send one or more PDF files in files, and the service creates a job for each file so you can process them asynchronously.

The POST response gives you a jobs array with job_id, filename, status, and progress for each file. Use /status/:job_id to check an individual job; it returns job_id, status, progress, and an optional error string when something fails. When a job is finished, /download/:job_id returns the corrected PDF as binary output.

If you need to track multiple files together, /overall-status accepts job_ids as a query value and returns aggregate status, progress, total_files, completed_files, and per-job details. This is useful for document pipelines that ingest scanned PDFs, rotated uploads, or mixed-orientation archives and need pages normalized before storage, review, or OCR extraction.

Use PDF Orientation Fixer when users upload scans from phones, fax exports, or batch document captures where page rotation is inconsistent and manual correction would be slow.

Note: Pricing is 1 atom per page + 50.

▣ ENDPOINT 01 / 04
POST
Auto-rotate PDF pages to correct orientation using OCR
http://localhost:8080/flowdocs/auto-correct-pdf-pages
QUICKSTARTGUIDE

Quickstart

Upload one or more PDF files to auto-rotate them.

curl -X POST "http://localhost:8080/flowdocs/auto-correct-pdf-pages" \
  -H "apy-token: $APY_TOKEN" \
  -F "files=@/path/to/report.pdf"

What you'll get back

Returns a JSON object with a jobs array. Each item in jobs is an object with job_id, filename, status, and progress fields for the created rotation job.

{
  "jobs": [
    {
      "job_id": "a1b2c3d4",
      "filename": "report.pdf",
      "status": "queued",
      "progress": 0
    }
  ]
}
TRY ITLIVE · 50 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.
body*
files*
PDF files to auto-rotate.

About this endpoint

What it does

Uploads one or more PDF files and starts an OCR-based auto-rotation process to correct page orientation. The response returns a job list with status and progress for each submitted file.

Request Body

ParameterTypeMandatoryDescription
filesString ArrayYesPDF files to auto-rotate. Max File Upload limit - 5

Response

Returns a JSON object with a jobs object field containing an array of job objects. Each job object includes job_id and filename as strings, status as a string, and progress as an integer.

ParameterTypeMandatoryDescription
jobsObject ArrayYesArray of job objects.
jobs[].job_idStringYesJob identifier.
jobs[].filenameStringYesName of the submitted file.
jobs[].statusStringYesJob status.
jobs[].progressIntegerYesJob progress.

Notes

This endpoint kicks off an async job and returns immediately with a job identifier; the actual work runs in the background. Pair this call with the corresponding job_check endpoint — poll that until the status reaches a terminal state to retrieve the result. Use the jobs[].job_id value from the response for polling.

Body

Name
Type
Description
bodyREQUIRED
object

Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.

▣ ENDPOINT 02 / 04
GET
Get the status of an auto-correct job
http://localhost:8080/flowdocs/auto-correct-pdf-pages/status/:job_id
QUICKSTARTGUIDE

Quickstart

Check the status of a PDF auto-correction job by its job_id.

curl -X GET "http://localhost:8080/flowdocs/auto-correct-pdf-pages/status/:job_id"

What you'll get back

Returns a JSON object with job_id as a string, status as one of queued, processing, done, or failed, progress as an integer from 0 to 100, and error as a nullable string.

{
  "job_id": "job_12345",
  "status": "processing",
  "progress": 60,
  "error": null
}
TRY ITLIVE · 1 ATOM
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.

About this endpoint

What it does

Returns the current status of an auto-correct PDF pages job identified by job_id. The response includes the job identifier, a status value, and a progress percentage, with an optional error message when present.

Path Parameter(s)

AttributeTypeMandatoryDescription
job_idStringYesIdentifies the auto-correct job to check.

Response

Returns a JSON object with required job_id string, status string, and progress integer fields, plus an optional error string field. The status value is one of queued, processing, done, or failed.

AttributeTypeMandatoryDescription
errorStringNoOptional error message.
job_idStringYesThe job identifier.
statusENUMYesJob state. Allowed values: queued, processing, done, failed.
progressIntegerYesProgress percentage from 0 to 100.

Path parameters

Name
Type
Description
job_idREQUIRED
string
▣ ENDPOINT 03 / 04
GET
Download a finished auto-correct output
http://localhost:8080/flowdocs/auto-correct-pdf-pages/download/:job_id
QUICKSTARTGUIDE

Quickstart

Download the corrected PDF for a completed job by replacing job_id in the path.

curl -X GET "http://localhost:8080/flowdocs/auto-correct-pdf-pages/download/:job_id" \
  -H "apy-token: $APY_TOKEN"

What you'll get back

Returns a binary file (string with format: binary) — the PDF download content itself.

(binary file content)
TRY ITLIVE · 5 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.

About this endpoint

What it does

Downloads the finished auto-correct PDF output for a completed job, identified by job_id. The response is a binary file stream.

Path Parameter(s)

AttributeTypeMandatoryDescription
job_idStringYesThe job identifier in the URL path.

Response

Returns a binary payload as a raw file download. The output schema is a string with format: binary, so the response is not a JSON object and has no named top-level fields.

Path parameters

Name
Type
Description
job_idREQUIRED
string
▣ ENDPOINT 04 / 04
GET
Aggregate progress across auto-correct jobs
http://localhost:8080/flowdocs/auto-correct-pdf-pages/overall-status
QUICKSTARTGUIDE

Quickstart

Check the overall status for one or more jobs by passing their job_ids as a query parameter.

curl -X GET "http://localhost:8080/flowdocs/auto-correct-pdf-pages/overall-status?job_ids=job-123,job-456" \
  -H "apy-token: $APY_TOKEN"

What you'll get back

Returns a JSON object with required status and progress fields, plus optional details, total_files, and completed_files.

  • status is a string: unknown, queued, processing, done, or failed
  • progress is an integer from 0 to 100
{
  "status": "processing",
  "progress": 60,
  "details": [
    {
      "job_id": "job-123",
      "status": "processing",
      "progress": 60
    }
  ],
  "total_files": 2,
  "completed_files": 1
}
TRY ITLIVE · 1 ATOM
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.

About this endpoint

What it does

Returns the aggregate status and overall progress for one or more auto-correct PDF jobs identified by job_ids. The response includes a top-level status, total progress, and optional per-job details.

Query Parameter(s)

AttributeTypeMandatoryDescription
job_idsStringYesJob identifier(s) to include in the aggregate check.

Response

Returns a JSON object with required status and progress fields, plus optional details, total_files, and completed_files fields. status is a string enum indicating the aggregate state, and progress is an integer from 0 to 100.

AttributeTypeMandatoryDescription
statusENUMYesAggregate status. Allowed values: unknown, queued, processing, done, failed.
detailsObject ArrayNoPer-job status entries. Each item may include job_id (String), status (String), and progress (Integer).
progressIntegerYesOverall progress percentage from 0 to 100.
total_filesIntegerNoTotal number of files included in the aggregate.
completed_filesIntegerNoNumber of files completed so far.

Query parameters

Name
Type
Description
job_idsREQUIRED
string
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.