Convert text or structured data that you already have as a string - JSON, YAML, CSV, HTML, Markdown or plain text - into Markdown or another format. Use this for inline content; for a file (PDF, Word, PowerPoint, Excel, Jupyter notebook, SRT/VTT subtitles) use convert_file, and for a web address use convert_url instead.
Parameters:
- input (required): the content as a plain string, not base64. Empty or whitespace-only input returns an empty result.
- source_format (default auto): with auto the format is detected in this order: SRT/VTT subtitles, JSON (a Jupyter notebook if it has cells and nbformat), HTML, CSV/TSV (at least two rows with the same number of columns, two or more), YAML, Markdown, and otherwise text. Because text only converts to markdown or html, an undetected table or data document fails for other targets - set source_format explicitly in that case.
- target_format (default markdown): must differ from the source, including the detected one - Markdown input with the default target fails, so pick e.g. html or text. Allowed targets per source: json -> yaml, csv, markdown, html, text, excel, docx; yaml -> json, csv, markdown, html, text, excel, docx; csv -> json, yaml, markdown, html, text, excel, docx; markdown -> json, yaml, csv, html, text, excel, docx; html -> markdown, text; text -> markdown, html; detected notebooks and subtitles -> markdown. Converting Markdown to json, yaml, csv or excel uses its first table, else key: value lines or lists. An unsupported pair returns an error that names both formats.
- pretty_json (default false): only relevant for target_format json, and currently has no effect - JSON output is always indented with two spaces. Ignored for other targets.
Returns the converted content as text. excel and docx output is a binary file, returned as an embedded resource (base64 blob with its MIME type) instead of text.
Read-only: nothing is stored, and the same input always gives the same output. Requires a slim-down API key or OAuth token; rate-limited per account (default 60 calls per minute).