Create a value of any dtype from a source or a file, store it, and return its handle
POST /Platform/dtypes/create
Create a value of any dtype from a source or a file, store it, and return its handle.
Pick the input by where the content is:
- a file the host attached for you, or any https URL to a file ->
file; - a public URL, a
data:URI, a handle or literal text ->source(URLs are fetched by the server; never read as a server path); - a small file whose bytes you hold ->
bytes_b64. Do not base64 large files: upload them through the uploads resource (a person without a shell can use an upload link from it) and pass the handle assource.
opts with its kind selects a generative path:
dtype="image",opts={"kind":"generate"}: generated image;dtype="audio",opts={"kind":"tts", ...}: speech;dtype="pdf",opts={"kind":"render"}: rendered pdf.
Any other dtype needs only source. For a credential:
- a credential a person already gave you ->
dtype="secret",sourcethe value; never repeat it. If they haven't given it, ask with an upload link for a secret instead. - the password of a website login -> also
opts={"sites": [...]}, the login'sorigins: a browser types it only on those sites, and only for a login with exactly those sites.
Body parameters
dtype: optional str. Target dtype name (e.g.pdf,image,markdown). Leave it out with a file to infer it from the media type or the content.source: optional str. Text, an http(s) URL, adata:URI or a handle. Fordtype="secret"it is always the value, even one shaped like a handle, and each call returns a new handle.bytes_b64: optional str. Base64-encoded raw bytes of a small file. Takes precedence oversource.file: optional FileRef or null. A file to download: the host's attachment, or any https URL with an id of your choosing. Pass it alone.opts: optional Union[ImageGenerateConfig, AudioTTSConfig, PdfRenderConfig, SecretSitesConfig]. Per-dtype config for a generative path. Say itskind; without one it is read as the config ofdtype. A field the config does not have is refused.
Returns
CreateResponse
handle: str. New dtype handle ("<dtype>-<hash>").dtype: str. Dtype name that was constructed.
Example request
curl -X POST "https://api.hilus.ai/Platform/dtypes/create" \
-H "Authorization: Bearer $HILUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'