Upload a Session file
This example uses the Session and application credential from Integrate applications with the Session API, with a localreport.pdf. Upload returns an id; save it and reference it as file_id in structured input. Files are limited to 16 MiB and belong to the current Session. Another Session cannot reference them directly.
Check that the Session supports file storage and file input. Upload sends raw file bytes rather than a multipart form:
file_input first.
An upload retry must preserve its key, filename, content type, and bytes. Use a new key when any of these changes. Percent-encode non-ASCII characters in X-File-Name using UTF-8. Upload stores the file; interpreting PDF, image, or audio content depends on the model and tools.
Download and deliver
UseGET /files to list uploaded inputs. Downloading content still requires Session read access; the URL is not a public permanent link.
items and next_offset. Use a non-null next offset in the next request until it becomes null.
POST /artifacts, a body of {"file_id":"RETURNED_FILE_ID"}, and an idempotency key. Artifacts may also reference accessible external HTTPS resources. Read the actual artifact from the snapshot or /artifacts and follow its file reference. Do not construct a download URL from a path guessed in an Agent reply.
Register an uploaded, verified result file as a Managed artifact. RESULT_FILE_ID must be an actual file ID in this Session. Publication records the deliverable; it does not read or generate a working-directory file.
Register an external HTTPS artifact
Register an external HTTPS artifact
Use
uri for an external reference, without file_id. Substitute a real HTTPS address the recipient can access. Publication neither copies the file into Service nor grants access./artifacts, then download through /turns/{turnId}/artifacts/{artifactId}. Verify content, version, and access permissions; a completed task alone does not establish a correct deliverable. See Document verification and In-product delivery.
Download a Team or Workflow task artifact
Download a Team or Workflow task artifact
The following download route is for task artifacts reported by Teams and Workflows. Read the list first, then set
TURN_ARTIFACT_ID to an actual artifact ID. It belongs to a different resource from the Managed artifact above.