apyhub
FILE CONVERSION · FILE MANIPULATION

Generate File Preview API

Hosted on ApyHub

What it does

PNG Preview Generator turns an uploaded file or a remote file URL into a PNG preview. Send a file in the request body, or send a url, and you can get the result either as a streamed PNG download or as a signed data link. You can also pass an optional width query parameter to control the preview size.

Use PNG Preview Generator when you need a consistent image representation of files before a user opens them. It supports document, image, video, and archive files on the upload path, which makes it useful for file managers, content dashboards, review queues, and share flows where you want a quick visual preview instead of the original file.

The service exposes two request patterns: /file/* for uploaded binaries and /url/* for remote assets. For download responses, the API returns binary PNG data. For link responses, it returns an object with a data field containing a URI. That gives you flexibility to either stream the preview directly or store and fetch it later.

If your application needs thumbnails or previews for mixed file types, PNG Preview Generator gives you a single output format that is easy to display, cache, and pass between services.

▣ ENDPOINT 01 / 04
POST
Generate PNG preview from uploaded file and stream download
http://localhost:8080/apyhub/generate-png-preview/file/download
QUICKSTARTGUIDE

Quickstart

Upload a file to generate a PNG preview, optionally setting the preview width with a query parameter.

curl -X POST "http://localhost:8080/apyhub/generate-png-preview/file/download" \
  -H "apy-token: $APY_TOKEN" \
  -F "file=@/path/to/document.pdf"

What you'll get back

Returns a binary file, which is the generated PNG preview.

TRY ITLIVE · 300 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*
Supported document, image, video, or archive file.

About this endpoint

What it does

Generates a PNG preview from an uploaded file and returns the resulting image as a binary stream for download. The request uploads a source file and can optionally include a width query parameter to control the preview width.

Query Parameter(s)

AttributeTypeMandatoryDescription
widthIntegerNoPreview width in pixels. Minimum value: 0.

Request Body

ParameterTypeMandatoryDescription
fileStringYesBinary file input. Supported document, image, video, or archive file.

Response

Returns a binary response body containing the generated PNG preview for download. The output schema is a single binary string, so the response is not a JSON object and does not include named fields.

Query parameters

Name
Type
Description
widthOPTIONAL
integer

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
POST
Generate PNG preview from uploaded file and return signed link
http://localhost:8080/apyhub/generate-png-preview/file/link
QUICKSTARTGUIDE

Quickstart

Upload a file link to generate a PNG preview, optionally setting the preview width with a query parameter.

curl -X POST "http://localhost:8080/apyhub/generate-png-preview/file/link?width=800" \
  -H "apy-token: $APY_TOKEN" \
  -F "file=@/path/to/file"

What you'll get back

Returns a JSON object with a data string field containing the generated preview URI.

{
  "data": "https://example.com/preview.png"
}
TRY ITLIVE · 300 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*

About this endpoint

What it does

Generates a PNG preview from an uploaded file and returns a signed link to the generated result. The request uploads the source file, and the response contains a URI in the data field.

Query Parameter(s)

AttributeTypeMandatoryDescription
widthIntegerNoPreview width in pixels. Must be a non-negative integer (minimum: 0).

Request Body

ParameterTypeMandatoryDescription
fileStringYesFile to generate the PNG preview from. Binary upload (format: binary).

Response

Returns a JSON object with a data string field formatted as a URI. The data value is the signed link to the generated PNG preview.

ParameterTypeMandatoryDescription
dataStringYesSigned URI for the generated PNG preview (format: uri).

Query parameters

Name
Type
Description
widthOPTIONAL
integer

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 03 / 04
POST
Generate PNG preview from remote file URL and stream download
http://localhost:8080/apyhub/generate-png-preview/url/download
QUICKSTARTGUIDE

Quickstart

Download a PNG preview from a public URL.

curl -X POST "http://localhost:8080/apyhub/generate-png-preview/url/download?width=800" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://assets.apyhub.com/samples/sample.pdf"}'

What you'll get back

Returns a binary file response (string with format: binary), which is the generated PNG preview.

TRY ITLIVE · 300 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.
body*

About this endpoint

What it does

Generates a PNG preview from a remote file URL and returns the result as a streamed binary download. The request supplies the source url in the body, and an optional width query parameter can be used to control the preview width.

Query Parameter(s)

AttributeTypeMandatoryDescription
widthIntegerNoPreview width in pixels. Must be greater than or equal to 0.

Request Body

ParameterTypeMandatoryDescription
urlStringYesRemote file URL to generate the PNG preview from. Must be a valid URI.

Response

Returns a binary string response containing the generated PNG preview. The success response is the streamed PNG download body from the endpoint.

ParameterTypeMandatoryDescription

Query parameters

Name
Type
Description
widthOPTIONAL
integer

Body

Name
Type
Description
bodyREQUIRED
object
▣ ENDPOINT 04 / 04
POST
Generate PNG preview from remote file URL and return signed link
http://localhost:8080/apyhub/generate-png-preview/url/link
QUICKSTARTGUIDE

Quickstart

Generate a PNG preview from a URL by sending the source link in the request body.

curl -X POST "http://localhost:8080/apyhub/generate-png-preview/url/link" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://assets.apyhub.com/samples/sample.pdf"}'

What you'll get back

Returns a JSON object with a data string field containing the generated PNG preview URL.

{
  "data": "https://..."
}
TRY ITLIVE · 300 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.
body*

About this endpoint

What it does

Generates a PNG preview from a remote file URL and returns a signed link to the resulting PNG. The request sends the source file URL in the body, and the response returns a JSON object containing the generated link in data.

Query Parameter(s)

AttributeTypeMandatoryDescription
widthIntegerNoPreview width in pixels. Minimum: 0.

Request Body

ParameterTypeMandatoryDescription
urlStringYesRemote file URL to convert. Format: URI.

Response

Returns a JSON object with a data string field containing a URI to the generated PNG preview. Success response shape: {"data": "string"}.

ParameterTypeMandatoryDescription
dataStringYesSigned URI for the generated PNG preview. Format: URI.

Query parameters

Name
Type
Description
widthOPTIONAL
integer

Body

Name
Type
Description
bodyREQUIRED
object
▣ 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.