Render or slice a value for viewing
POST /Platform/dtypes/get-media
Render or slice a value for viewing. Returns media for a handle: a selected slice of it (pages, a time window) as its own handle, or a rendering of it you can look at.
To READ content -- find a value, quote a line, answer a question about
the text -- use get_content instead: it is exact, cheap, and returns
locators. Fetch only the part you need (range), never the whole
thing. This one dtype-agnostic operation loads the dtype, so format
and range are interpreted PER TYPE:
pdf--format=pdf(default) returns a PDF containing the selected pages (its own handle; the full document keeps its hash);png/jpegreturns one page IMAGE per page for LOOKING at layout, stamps, signatures, checkboxes, handwriting (~1k tokens each).range=[start_page, end_page]is 1-based and inclusive. Page count is already in the handle's descriptor; do not fetch pages to count them.audio--formatin {mp3, wav, ogg, flac} (default mp3);range[start_sec, end_sec]trims to that window -> a signed URL to the clip.image--formatin {png, jpeg} -> the image (omitted: as stored).tree--formatjson(the default) -> a signed URL to the value as a JSON file.- any other type takes no
format-> a signed URL to the stored value.
Returns {handle, parts} where parts is a list
of RenderedMedia JSON dicts.
Body parameters
ref: str. Stored dtype handle/hash (or, in a chat, the tool_call_id of the result).format: optional str. Output format, interpreted per dtype (see above). Omit for the type's default: pdfpdf(orpng|jpegfor page images); imagepng|jpeg; audiomp3|wav|ogg|flac.range: optional Union[str, List[float]]. Optional[start, end]. pdf -> 1-based inclusive page range (matching thepage, line:labels in the document text); audio ->[start_sec, end_sec]window. Also read when written as a text of the two numbers, such as"2-3", as inget_content.dpi: optional int. pdf only -- rasterization DPI (overrides the default 144 for sharper page images).markers_only: optional bool. When true, the response carries only each produced image's<attachment id="..."/>marker (a text part) instead of the image bytes, giving a forwardable reference without the base64 payload. Default false (return the image bytes).
Returns
GetMediaResponse
handle: str. Handle of the rendered value (a new handle for a PDF page selection).parts: optional List[dict]. RenderedMedia JSON dicts.
Example request
curl -X POST "https://api.hilus.ai/Platform/dtypes/get-media" \
-H "Authorization: Bearer $HILUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'