Skip to main content
POST
/
jobs
/
optimize
Optimize a file
curl --request POST \
  --url https://api.filecheck.io/jobs/optimize \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "sources": [
    "<unknown>"
  ],
  "async": false,
  "webhook": "<unknown>",
  "metaData": "<unknown>"
}
'
{
  "job": {
    "id": "<string>",
    "createdAt": "<string>",
    "modifiedAt": "<string>",
    "status": "<string>",
    "outcome": "<string>",
    "ruleId": "<string>",
    "workflowId": "<string>",
    "metaData": {},
    "tasks": [
      {
        "id": "<string>",
        "createdAt": "<string>",
        "updatedAt": "<string>",
        "status": "<string>",
        "outcome": "<string>",
        "fileType": "<string>",
        "mimeType": "<string>",
        "source": "<string>",
        "fileRef": "<string>",
        "clientRef": "<string>",
        "jobId": "<string>",
        "originalArtifact": {},
        "outputArtifacts": [
          {
            "kind": "<string>",
            "role": "<string>",
            "bucket": "<string>",
            "key": "<string>",
            "downloadUrl": "<string>",
            "expiresIn": 123
          }
        ],
        "steps": [
          {
            "id": "<string>",
            "type": "<string>",
            "status": "<string>",
            "reason": "<string>",
            "params": {},
            "runtimeParams": {},
            "started": "<string>",
            "ended": "<string>",
            "duration": 123,
            "outputs": [
              {}
            ]
          }
        ]
      }
    ],
    "orderId": "<string>",
    "customerId": "<string>",
    "customerEmail": "<string>",
    "summary": {},
    "results": {}
  }
}

Authorizations

Authorization
string
header
required

Your secret key as a bearer token, e.g. Authorization: Bearer sk_live_…. Secret keys are server-side only.

Body

application/json

Optimize one or more files. Each source carries its own params, namespaced by file type: params.pdf for PDFs (DynaPDF pipeline) and params.raster for bitmaps (Sharp + fal.ai pipeline). Exactly one namespace per source is consumed — the server picks based on the detected file type. Mixed batches (PDF + raster in the same request) are supported. The request is synchronous by default — the response is 200 with { job } on completion, or 202 with pending: true if the job does not finish within ~27 s. An optional webhook is called when the job reaches a terminal status.

sources
any[]
required

List of files to optimize. Each item may include a params object describing which optimizations to apply. Even a single file must be wrapped in an array.

Required array length: 1 - 50 elements
async
boolean
default:false

When true, return 201 immediately with { job, pending: true } and let the webhook (if any) deliver the terminal result. When false (default), the request is synchronous — 200 on completion, or 202 with pending: true if the job does not finish within ~27 s.

webhook
any
metaData
any

Response

Sync completion (sync: true)

job
object