# Upload an artifact

Deprecated

POST

/v1/artifacts

```sh
curl --request POST \
  --url https://example.com/v1/artifacts \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form file=@file \
  --form name=example \
  --form contentType=example \
  --form 'tags="example"' \
  --form ownerRunId=2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \
  --form projectId=example \
  --form expectedHash=example \
  --form forRun=true
```

Use `files.create`. Removed in 0.9.0.

Multipart upload. `file` part carries the bytes; other form fields carry metadata (`name`, `contentType`, `tags` (JSON), `ownerRunId`, `projectId`, `expectedHash`, `forRun`). Framework computes sha256 and returns it in `BlobMeta.hash`. If `expectedHash` was supplied and diverges, response is `400 blob-hash-mismatch`. Content-type sniffing is NOT performed server-side — the framework trusts the caller. The artifact belongs to its owner run’s project, else `projectId`, else the project the caller’s API key is limited to, else the workspace’s default project; uploading needs `write` there, and a key limited to a project uploads into that project only. A person with `run` there and no `write` may upload a file that names no `ownerRunId`: an input for a run they start, which they may download again. Such an upload is always `forRun`. The runtime limits what one person uploads that way in a workspace in 24 hours, by default to 1 GiB and 1,000 files: past it, the upload is `429 upload-limit-reached`, saying when it fits. A `forRun` upload is deleted once the server’s unused-upload time has passed (24 hours by default) unless a run that names it in its input has started by then; until one does, `BlobMeta.expiresAt` says when. An upload over the runtime’s cap (default 100 MiB) is `413 artifact-too-large`. One that the workspace’s storage limit has no room for is `403 storage-limit-reached`, and nothing is stored.

## Authorizations

- **[bearerAuth](https://docs.kindgi.com/v0.8.0/reference/api.md#bearerauth)**

## Parameters

### Header Parameters

**Idempotency-Key**

string

\>= 1 characters

Caller-supplied idempotency key, scoped to the caller: the same key from someone else in the workspace is their own request (from 0.1.5). Retries with the same key return the original response byte-identical (per `docs/API-ROUTE-CONVENTIONS.md` §3.1). A retry sent while the first request still runs is answered `409 idempotency-key-in-flight` with `Retry-After`, on a runtime whose store holds keys (from 0.1.5); retry after it, and you get the first request’s answer. An answer that carries a secret (a new API key or public run token, a session token, a generated signing secret) isn’t kept: a retry gets `409 idempotency-key-replay-withheld`, with the first request’s status and when it succeeded (from 0.1.5). A request whose key store can’t be read before it runs is answered `503 idempotency-store-unavailable` with `Retry-After`: nothing ran, so retry with the same key (from 0.3.0).

## Request Bodyrequired

multipart/form-data

Multipart form. `file` is the byte stream (required). Other fields are optional metadata: `name` (defaults to file part filename), `contentType` (defaults to file part MIME), `tags` (JSON-encoded object), `ownerRunId` (RunId string), `expectedHash` (sha256 hex, framework rejects on mismatch), `forRun` (`true` for an input to a run that hasn’t started).

object

**file**

required

string format: binary

**name**

string

**contentType**

string

**tags**

JSON-encoded `Record<string, string>` — parsed server-side.

string

**ownerRunId**

string format: uuid

**projectId**

The project it belongs to, when there’s no `ownerRunId` (with one, the run’s project, and this must agree). Default: the workspace’s default project.

string

**expectedHash**

Caller-computed sha256, hex-encoded, lowercase. Framework verifies + rejects on mismatch with `blob-hash-mismatch` (400).

string

/^\[0-9a-f]{64}$/

**forRun**

`true` for an input to a run that hasn’t started. It’s deleted once the server’s unused-upload time has passed (24 hours by default) unless a run that names it in its input has started by then; the answer’s `expiresAt` says when. Not with `ownerRunId`. An upload by someone who may run here but not write is always `forRun`. Default: `false`, and the file stays until it’s deleted.

string

Allowed values: true false

## Responses

### 201

Upload accepted; metadata returned.

application/json

object

**blobId**

required

ArtifactId — opaque branded string (a UUID).

string

**tenantId**

required

string format: uuid

**name**

required

Caller-supplied filename or logical name.

string

**contentType**

required

MIME type as declared by the uploader. Framework does NOT sniff content-type server-side.

string

**size**

required

Byte length of the persisted body.

integer

**hash**

required

Sha256 of the body, hex-encoded, lowercase (64 chars).

string

/^\[0-9a-f]{64}$/

**tags**

required

Free-form caller-supplied labels. Filterable on list via `?tag.<key>=<value>`.

object

**_key_**

additional properties

string

**ownerRunId**

Optional back-ref to the RunId that produced this blob.

string format: uuid

**projectId**

The project the artifact belongs to: its owner run’s, else the upload’s `projectId`, else the workspace’s default project. Reading it needs `read` there; deleting it, `write`. Absent on blobs stored before projects were recorded.

string

**createdBy**

Who uploaded it: `user:<id>` or `service_account:<id>`.

string

**createdAt**

required

string format: date-time

**expiresAt**

When this upload for a run is deleted if no run that names it in its input has started by then. Present only on a `forRun` upload whose run hasn’t started; once one starts, it’s gone, and the file stays until it’s deleted.

string format: date-time

**bucket**

The bucket of the blob’s S3-compatible address (`/s3/{bucket}/{key}`). Present, with `key`, when the server’s storage gives the blob one: an object put through `/s3` has the bucket and key it was put under, and an upload through `POST /v1/artifacts` conventionally has bucket `artifacts` and its `blobId` as the key.

string

**key**

The key of the blob’s S3-compatible address (`/s3/{bucket}/{key}`). Present, with `bucket`, when the server’s storage gives the blob one.

string

**fileId**

The file these bytes are a version of, on a runtime that keeps file versions (`/v1/files`). A blob stored before it kept them is version 1 of a file with its own id.

string

**version**

Which version of `fileId` these bytes are. Set with `fileId`. Bytes two versions share name the lowest: the one that stored them.

integer

\>= 1

##### Examplegenerated

```json
{
  "blobId": "example",
  "tenantId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
  "name": "example",
  "contentType": "example",
  "size": 1,
  "hash": "example",
  "tags": {
    "additionalProperty": "example"
  },
  "ownerRunId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
  "projectId": "example",
  "createdBy": "example",
  "createdAt": "2026-04-15T12:00:00Z",
  "expiresAt": "2026-04-15T12:00:00Z",
  "bucket": "example",
  "key": "example",
  "fileId": "example",
  "version": 1
}
```

### 400

Malformed multipart body, bad tag JSON, a `forRun` that isn’t `true` or `false` or comes with `ownerRunId`, hash mismatch, declared size mismatch, or a `projectId` that isn’t the owner run’s.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 401

Missing / malformed / expired / revoked bearer token.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 403

No `write` on the project, and no `run` there for an upload of the caller’s own that names no run (`permission-denied`); the caller’s API key is limited to another project (`key-project-mismatch`); or the workspace’s storage limit has no room for the file (`storage-limit-reached`; `details.storageMiB`, `usedBytes` and `neededBytes` say how much).

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 404

No such owner run (`run-not-found`).

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 409

Idempotency-Key was reused with a different body, or resource-state conflict. Or `idempotency-key-in-flight` (with `Retry-After`): a request with the same `Idempotency-Key` still runs, so this one wasn’t run; send it again after `Retry-After` to get that request’s answer.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

#### Headers

**Retry-After**

integer

\>= 1

Whole seconds to wait before sending the request again, at least 1. Sent with the codes the answer names as sending it, so it may be absent.

### 413

Over the upload cap (`artifact-too-large`; `details.maxBytes` says how much).

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 429

An upload passing on `run` alone, past what one person may upload that way in the window (`upload-limit-reached`). `details` carries the limit (`maxBytes`, `maxFiles`), what’s used (`usedBytes`, `usedFiles`), `windowSeconds` and `retryAt`; `Retry-After` says when this upload fits. Nothing is stored. Or `rate-limit-exceeded` with `details.limit: "api-requests"`, on a runtime that sets workspace limits (Kindgi Cloud): this workspace’s limit on API requests a minute is reached, so the request wasn’t run; `Retry-After` says when to send it again.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

#### Headers

**Retry-After**

integer

\>= 1

Whole seconds to wait before sending the request again, at least 1. Sent with the codes the answer names as sending it, so it may be absent.

### 500

Server error (unmapped domain code or framework crash).

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

### 503

The `Idempotency-Key` store (`idempotency-store-unavailable`) or the authorization store (`authz-backend-unavailable`) couldn’t be reached before the request ran, or the database was too busy for its authorization check (`database-busy`), so nothing was changed; `Retry-After` (whole seconds) says when to try again with the same key. Or `tenant-state-unavailable` (with `Retry-After`), on a runtime serving many workspaces: the workspace’s state couldn’t be read, so nothing was changed.

application/json

object

**error**

required

object

**code**

required

Stable machine-readable discriminant. Values match domain error codes (see `docs/API-ROUTE-CONVENTIONS.md` §4.3).

string

**message**

required

string

**details**

Optional, kind-specific.

object

**_key_**

additional properties

any

**requestId**

required

Server-assigned request id; also echoed via `X-Request-Id` header.

string

##### Examplegenerated

```json
{
  "error": {
    "code": "example",
    "message": "example",
    "details": {},
    "requestId": "example"
  }
}
```

#### Headers

**Retry-After**

integer

\>= 1

Whole seconds to wait before sending the request again, at least 1. Sent with the codes the answer names as sending it, so it may be absent.

## See also

- [`GET /v1/artifacts`: List artifact metadata](https://docs.kindgi.com/v0.8.0/reference/api/operations/artifactslist.md)
- [Files and versions](https://docs.kindgi.com/v0.8.0/concepts/files-and-versions.md)
- [Kindgi 0.1.10](https://docs.kindgi.com/v0.8.0/releases/0.1.10.md)
- [Kindgi 0.1.8](https://docs.kindgi.com/v0.8.0/releases/0.1.8.md)
- [Error code `artifact-too-large`](https://docs.kindgi.com/v0.8.0/reference/errors.md#artifact-too-large)
- [Error code `authz-backend-unavailable`](https://docs.kindgi.com/v0.8.0/reference/errors.md#authz-backend-unavailable)
- [Error code `database-busy`](https://docs.kindgi.com/v0.8.0/reference/errors.md#database-busy)
- [Error code `idempotency-key-in-flight`](https://docs.kindgi.com/v0.8.0/reference/errors.md#idempotency-key-in-flight)
- [Error code `idempotency-store-unavailable`](https://docs.kindgi.com/v0.8.0/reference/errors.md#idempotency-store-unavailable)
- [Error code `key-project-mismatch`](https://docs.kindgi.com/v0.8.0/reference/errors.md#key-project-mismatch)
- [Error code `permission-denied`](https://docs.kindgi.com/v0.8.0/reference/errors.md#permission-denied)
- [Error code `rate-limit-exceeded`](https://docs.kindgi.com/v0.8.0/reference/errors.md#rate-limit-exceeded)
- [Error code `run-not-found`](https://docs.kindgi.com/v0.8.0/reference/errors.md#run-not-found)
- [Error code `storage-limit-reached`](https://docs.kindgi.com/v0.8.0/reference/errors.md#storage-limit-reached)
- [Error code `tenant-state-unavailable`](https://docs.kindgi.com/v0.8.0/reference/errors.md#tenant-state-unavailable)
- [Error code `upload-limit-reached`](https://docs.kindgi.com/v0.8.0/reference/errors.md#upload-limit-reached)
- [Every error code](https://docs.kindgi.com/v0.8.0/reference/errors.md)
