NylorunDocsBeta
Runtime APIArtifacts

Upload a file as a new artifact

POST
/v1/artifacts

Streams the body to the Object store in one request, up to the Tenant's per-file limit and within its total; a body past either stores nothing (413 limit_exceeded). Its Content-Type is the file's media type (default: from the name). Acting for a person, the artifact belongs to one of their sessions. A session's artifact appears in its history as artifact.created.

Authorization

headerAuthorizationBearer <token>

An application key of the Tenant (PUT /v1/tenant/keys/{keyId}), or Studio's key, derived from the admin key. With Nylorun-Subject and Nylorun-Scopes, it acts for that person, narrowed to those scopes. Never accepted from a browser (Origin).

Query Parameters

name*string

The file's name, e.g. brief.pdf

sessionId?string

The session it belongs to

label?|array<string>

key=value; repeat it for several labels

Header Parameters

Nylorun-Protocol*string

The protocol version, 8

Nylorun-Subject?string

The person an application key acts for

Nylorun-Scopes?string

The subject's space-separated scopes; required with a subject

Request Body

The file's bytes; Content-Type is its media type

body*file*/*
Formatbinary

Response Body

The artifact and its first version

application/json
  1. response
artifact*
version*
import { createClient } from "@nylorun/agents";const client = await createClient();const artifact = await client.artifacts.upload(report, {  name: "report.pdf",  sessionId: "ses_123",});
{  "artifact": {    "artifactId": "string",    "kind": "file",    "name": "string",    "contentType": "string",    "sessionId": "string",    "latestVersion": 1,    "labels": {      "property1": "string",      "property2": "string"    },    "createdAt": "string",    "updatedAt": "string",    "versions": [      {        "version": 1,        "size": 0,        "sha256": "string",        "contentType": "string",        "source": "upload",        "createdAt": "string"      }    ]  },  "version": {    "version": 1,    "size": 0,    "sha256": "string",    "contentType": "string",    "source": "upload",    "createdAt": "string"  }}