Prepare a file upload
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.
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.
application/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 the file goes in.
name*stringThe file's name in the Drive, with the extension that sets its type, as in an upload in awen.
^[^\x00]*$1 <= length <= 2083size_bytes*integerThe file's exact size in bytes.
1 <= value <= 536870912sha256*stringThe SHA-256 of the whole file, in hex.
^[0-9A-Fa-f]{64}$The operation's answer.
application/json- response
upload_id*stringexpires_at*stringplace_within_minutes*numberupload_host*stringscript_host*stringupload_url*stringauthorization*stringpart_size*numberpart_count*numbercommand*stringnext_steps*array<>curl -X POST 'https://app.awen.ai/api/v1/create_upload' \ -H 'Content-Type: application/json' \ -d '{ "project_id": "string", "name": "string", "size_bytes": 1, "sha256": "string"}'{ "upload_id": "string", "expires_at": "string", "place_within_minutes": 0, "upload_host": "string", "script_host": "string", "upload_url": "string", "authorization": "string", "part_size": 0, "part_count": 0, "command": "string", "next_steps": [ { "codes": [ "string" ], "instruction": "string" } ]}Create a project POST
Creates an awen project at the top of the user's Projects, with its first conversation, as New project does in awen. Use it only when the user asks for a project or has none that fits, never one per request. Without a name it is Untitled and takes its name from the first message. Pass the returned project_id to create_folder, import_file or start_conversation, and the returned conversation_id to create_with_awen for the first turn, so the project keeps no empty conversation. Needs a key with awen:write. Costs 2 units of the key's rate limit.
Import a file POST
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.