Stage an Artifact Asset
artifact-get_asset_upload_urlStep 1 of adding a LARGE asset (an image, font or media file) to an EXISTING artifact — anything over 256 KB, which is the most artifact-edit takes inline. Smaller files need no staging: send them to artifact-edit directly with encoding "base64".
Flow:
Call this with the sessionId and the filename: it returns assetUploadId, uploadUrl and uploadFields.
Upload the file with an HTTP POST of multipart/form-data to uploadUrl. Send EVERY key/value of uploadFields as a form field FIRST, then the file itself LAST, in a field named "file" — S3 ignores anything sent after the file part, so the order matters. Do not add a size or Content-Length field. Success is HTTP 204 with an empty body. With curl, uploadFields {"key": "abc", "policy": "xyz"} becomes: curl -X POST -F key=abc -F policy=xyz -F file=@/path/to/your-file.png
Call artifact-edit with a "write" change carrying assetUploadId instead of content, and the path the file should live at. Put the code that references it in the SAME edit, so both land in one commit.
Rules: one file per id, single use, 30 minutes to redeem it, 32 MB max — S3 rejects a larger body at step 2. Files over 10 MB are stored through Git LFS automatically: the commit carries a small pointer and .gitattributes gains the matching filter line, with no extra steps on your side. uploadFields carry the signature that authorizes the upload; treat them as a secret. If your host cannot make an HTTP request, use artifact-edit with encoding "base64" for a file that fits inline, or artifact-get_git_token to push the file with git.
Returns: success, assetUploadId, uploadUrl, uploadFields, expiresAt, maxBytes, nextSteps.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filename | Yes | The file you are uploading, e.g. "hero.png". Only its extension is read, to type the upload — the path the asset lands at is the one you pass to artifact-edit afterwards. | |
| sessionId | Yes | The artifact session id — the last path segment of the artifact URL (e.g. "mr25vsjppVtbMx" from https://app.agentgrid.io/artifacts/mr25vsjppVtbMx), or the id from artifact-create. |