Files, artifacts and downloads
Pass authorized, verifiable Artifact references, distinguishing business input fields, input files, output files and temporary download capabilities.
Get files into execution
A JSON document_handle or URL is business input, not an automatically authorized platform file. Upload a ready Artifact, then include its ID in input_artifact_ids.
File → POST /api/v1/artifacts → READY
READY Artifact ID → CreateInvocation.input_artifact_ids
Finished Invocation → output_artifact_ids → download receipt → bytesCreation needs artifacts:write; reads/downloads need artifacts:read and project access. For pre-task uploads, supply the workspace project's policy_scope_id, not invented Task/Run IDs.
Upload input
artifact.json demonstrates Base64 content. Replace its project, filename, media type and bytes, and persist one idempotency key per logical upload.
curl --fail-with-body https://api.orbitspace.dev/api/v1/artifacts \
-H "Authorization: Bearer $ORBITSPACE_ACCESS_TOKEN" \
-H 'Content-Type: application/json' \
--data-binary @artifact.jsoncontent is standard Base64 of raw bytes, not a path, data URL or double-encoded JSON string. An optional lowercase SHA-256 must match. Same-key identical uploads recover the same object; changed bytes need a new key. Only ARTIFACT_STATUS_READY is eligible as normal input.
The public content API accepts up to 32 MiB per file, subject to stricter deployment policy. Workspace synchronization uses its own protocol. Upload success does not establish model support for that media type; tools, Environment and model must actually support the work.
Attach to an Invocation
{
"input": {"text":"Review the attached proposal."},
"input_artifact_ids": ["READY_ARTIFACT_ID"],
"idempotency_key": "review-with-file-job-001"
}The service schema must still accept the input object. Mentioning a file ID in a prompt does not independently authorize or transfer it.
Downloads have two requests
Authenticated GET /api/v1/artifacts/{id}/download returns JSON with url, expires_at, checksum_sha256, size_bytes and content_type. Fetch that capability URL for bytes. size_bytes is a decimal string; use bounded conversion or BigInt.
Authorize the Artifact against the user's Invocation/Goal before proxying it. Do not forward the application Bearer token to the capability URL. Keep the short-lived URL out of logs, persistent job records and analytics.
Runnable download function
Use download-artifact.mjs with the example client:
import { downloadArtifact } from './download-artifact.mjs';
// api is the quickstart OrbitSpaceAPI; first authorize the user's business job.
const result = await downloadArtifact(api, invocationId, artifactId, './report.bin');
console.log(result.bytes, result.contentType);It checks output ownership, destination, byte bounds and SHA-256, and refuses to overwrite a file. It targets deployments whose capability origin matches the API. A self-hosted alternate download origin needs an operator-reviewed allowlist, never an arbitrary remote URL.
Lifecycle
Retention, deletion and permission changes can make a file unavailable. Reload state after failure and obtain a new receipt after expiry. Interrupted or invalid transfers must fail; returning receipt JSON with HTTP 200 is not a successful file download.