Convert HTML to PDF from Base44
Call /v1/convert from a Base44 backend function with the Bearer header, then fetch the download url with the same header.
Wire it up
The shared request is Authorization: Bearer wc_your_key and {"url": "https://example.com/"}. Base44 changes the wrapper, not those values or the authenticated download.
- Store the API key in the project's secret or environment storage, not in app code.
- Add a backend function that performs the POST; backend functions are the supported route for external HTTP calls, and they keep the key off the client.
- The function targets your serving origin plus
/v1/convert, sends theAuthorizationheader and the JSON body, and reads the receipt'sdownloadurl. - Expose the function to the app, and the UI receives the bytes the function fetched with the same
Authorizationheader; the download endpoint is key-scoped, so a bare url handed to the browser answers 401.
The full request
export async function convertPage(args: { url: string }) {
const res = await fetch("https://webcapture.io/v1/convert", {
method: "POST",
headers: {
Authorization: `Bearer ${secrets.WEBCAPTURE_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ url: args.url }),
});
const receipt = await res.json();
// key-scoped: the download GET takes the same Authorization header
const file = await fetch(receipt.download, {
headers: { Authorization: `Bearer ${secrets.WEBCAPTURE_KEY}` },
});
return file; // the pdf bytes, ready for the app
}
The response is the receipt JSON, so the function can return the fetched bytes or the whole receipt when the app also wants bytes or remaining. The download url is key-scoped: fetching it takes the same Authorization header as the POST, it answers 401 without the header, and another key's id answers 404, so the backend function is the right place to hold both calls.
Limits
The convert endpoint rate limits at 120 requests a minute per client IP; a full window answers 429 with retryAfterSec. The monthly quota is per account: exhausted, the endpoint answers 429 carrying used, limit, resetDate, and upgradeUrl, and each receipt's remaining field shows the count after the render. Serverless functions with short execution ceilings fit ?wait=false: the 202 ticket's download url stays valid for a later authenticated fetch.
Related
- Base44 documentation: the integration surface this page checked against.
- The webcapture API reference: every field the convert endpoint admits, with the response shapes.
- The free URL to PDF tool: try the same render in a browser before you wire the step.
- The automations hub: the same call translated for the other platforms.
Method
Checked 2026-10-05 against Base44: The backend-function route follows Base44's SDK documentation at doc-sdk.base44.app; Base44's custom-integration UI was retired, so the function shape, the secrets name, and the export style follow the current SDK docs and the generated app's own conventions. Source: https://doc-sdk.base44.app. Corrections: hello@webcapture.io.
Get a free key or read the API reference to wire Base44.