x402_convert_file
Convert files between formats including image resize, CSV to JSON, HTML to PDF, and DOCX to PDF using URL-based inputs with base64 output.
Instructions
Convert files between formats — image resize/reformat, CSV to JSON, HTML to PDF, or DOCX to PDF. Price: $0.02 USDC per conversion (paid mode) | Free test: returns fixture data.
Supported conversions:
image: resize/reformat an image from a URL (Pillow) — outputs base64-encoded bytes
csv: convert a CSV URL to JSON array
html_pdf: render HTML from a URL to PDF — outputs base64-encoded bytes
docx: convert a DOCX document URL to PDF — outputs base64-encoded bytes (mammoth + WeasyPrint, content-fidelity not layout-preserving)
Input limit: 10MB source file. Output limit: 8MB (before base64 encoding). Without X402_PRIVATE_KEY, only the free test endpoint is available.
Returns: base64-encoded output bytes with MIME type, or JSON array for csv type.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL of the file to convert (public, http/https, max 10MB) | |
| type | Yes | Conversion type: image (resize/reformat), csv (CSV to JSON), html_pdf (HTML to PDF), docx (DOCX to PDF) | |
| format | No | Output image format (only for type='image', default: jpeg) | |
| width | No | Target width in pixels (only for type='image', preserves aspect ratio if height omitted) | |
| height | No | Target height in pixels (only for type='image', preserves aspect ratio if width omitted) |