Import a file
Adds a file to a project the user can edit, as an upload in awen does: from a public URL, from a file the user attached in ChatGPT (file), from text with a name, or from a file you sent after create_upload (upload_id). Drive takes files up to 512 MB, images up to 95 MB and any video, never programs. Only an MP4 opens as a video in awen: other formats save as plain files. Pass exactly one of url, file, text or upload_id. A file you made on this machine from awen files, such as a cutout, names them in derived_from. A memory's instructions are its own Memory.md, so no file named Memory.md can be added to a memory; the user edits them in awen.
Needs a key with awen:write. Costs 4 units of the key's rate limit.
apiKeyAuthorizationBearer <token>An API key from Settings → Connected apps → API keys, sent as Authorization: Bearer awen_sk_…. Keep it on a server: a request from a web page is refused.
Idempotency-Key?stringNames this request, for you and this organisation. The same key with the same arguments answers the first result and starts or saves nothing again; the same key with other arguments is another request. 1 to 128 letters, digits, ., _, : or -.
^[A-Za-z0-9._:-]+$1 <= length <= 128application/json- body
project_id*stringThe project's project_id.
^[A-Za-z0-9_-]+$1 <= length <= 128folder_id?|"root" (the default), or the entry_id of the folder to put the file in.
url?stringA public http(s) URL of the file itself, such as an image's own address. A web page is refused: open it and pass the URL of the image or file it shows.
length <= 4096text?stringText to save as a file (UTF-8, up to 1 MiB); its name's extension sets its type.
length <= 1048576upload_id?stringThe upload_id create_upload returned, once its command has sent the file.
^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$name?stringThe file's name. A name already taken in the folder gets a number, and the answer gives the final one. Required with text; otherwise the URL's or the attachment's name. An upload keeps the name given to create_upload.
^[^\x00]*$1 <= length <= 2083derived_from?array<>Up to 20 awen files this file was made from, such as the image you cut out or retouched on this machine: ids from a list, search or get_turn. awen records them as the file's lineage, as for a file made in awen.
1 <= items <= 20The operation's answer.
application/json- response
id*stringentry_id*stringmedia_id*stringrevision_id*string|nullkind*string"folder""image""video""canvas""three_d""whiteboard""file"folder_id*stringname*stringurl*stringcurl -X POST 'https://app.awen.ai/api/v1/import_file' \ -H 'Content-Type: application/json' \ -d '{ "project_id": "string"}'{ "id": "string", "entry_id": "string", "media_id": "string", "revision_id": "string", "kind": "folder", "folder_id": "string", "name": "string", "url": "string"}Prepare a file upload POST
Prepares the upload of a file you hold that has no public URL: a file the user attached that your code sandbox can read, or a file on this machine. 1) Measure it: its exact size in bytes and its SHA-256 in hex (wc -c < FILE; shasum -a 256 FILE or sha256sum FILE; on Windows, Get-FileHash -Algorithm SHA256). 2) Call this tool with the name it gets in the Drive, its size and its SHA-256. 3) Within 10 minutes, run the returned command with /path/to/file replaced by the file's path, inside its single quotes, with any ' in the path written as '\'', and change nothing else (your host may ask the user to approve it once). If your host cannot run it, ask the user to run it: never send the request another way. It fetches awen's upload script and sends the raw bytes to upload_host, and the upload completes only with the exact file you measured. If it stops at a refusal, next_steps says what to do for its code. Without a POSIX shell, send the same requests to upload_url with the authorization. 4) Within 30 minutes, call import_file with the same project_id and folder_id and this upload_id to place the file; an upload not placed by then is deleted. For several files, prepare every file, run every command, then place each upload with import_file: each keeps its own times. The command needs network access to script_host for the script, then to upload_host for the file. If curl cannot reach script_host it prints only its own error: ask the user to allow both hosts. Otherwise, when the command fails, its last line, starting with awen:, says what to do next. Drive takes files up to 512 MB, images up to 95 MB and any video, never programs. Only an MP4 opens as a video in awen: other formats save as plain files. Needs a key with awen:write. Costs 2 units of the key's rate limit.
Move files and folders POST
Moves files and folders of a project the user can edit into one folder, in a single call. Pass each item's entry_id from list_folder, never a media_id, and folder_id "root" for the project root or a folder's entry_id. A memory never moves inside another memory, and no other file named Memory.md moves into one: a memory reads its instructions only from its own Memory.md. Needs a key with awen:write. Costs 2 units of the key's rate limit.