Skip to main content

Referencia

MarkpdfClient

string
required
Your API key. If you don’t pass it, the client reads process.env.MARKPDF_API_KEY (Node) or Deno.env (Deno).
string
default:"https://api.markpdf.tech"
URL base of API.
number
default:"300000"
Timeout per request in milliseconds, implemented with AbortController.
number
default:"2"
Automatic retries with exponential backoff in 429 and 5xx.
typeof fetch
Implementation of fetch to use. By default it uses the global fetch of the runtime. Useful for injecting a fetch with a proxy or for tests.

Methods

They all accept the same options as the query params of API, in camelCase.

convertFile

Upload content to POST /convert/raw. Returns Promise<string> with Markdown, or Promise<ConversionResult> if responseFormat: "json".
boolean
default:"true"
If the server responds 202 (backends saturated), SDK automatically polls GET /jobs/{id}. With autoPoll: false, the method throws MarkpdfJobQueuedError with jobId to do a manual poll. See Streaming and async.

convertFromUrl

Llama a POST /convert/from-url.

convertStream

Returns a AsyncIterable<string> that emits Markdown fragments as they arrive by POST /convert/stream or /convert/stream-from-url. See Streaming and async.

pdfIndex

Call POST /pdf/index. Returns the typed spine — same fields as POST /pdf/index.

getJob

Consulta manualmente GET /jobs/{id}.

Tipos

ConversionResult

PdfSpine

JobStatus

All types are exported from @markpdf/sdk for you to use in your own code: