# List files

GET

/v1/files

```sh
curl --request GET \
  --url 'https://example.com/v1/files?limit=25' \
  --header 'Authorization: Bearer <token>'
```

Cursor-paginated, newest change first. Each file with its Latest (no bytes). Deleted files aren’t listed. Filters: `?ownerRunId=`, `?projectId=`, `?contentType=` (Latest’s, exactly). With authorization on, only files in projects the caller can read are listed; with `?ownerRunId=` of a run of the caller’s own (one that acts for them), `run` on the project is enough too. On a runtime that doesn’t keep files, `/v1/files` isn’t served (`404 route-not-found`).

## Authorizations

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

## Parameters

### Query Parameters

**limit**

integer

default: 25 >= 1 <= 100

1..100. Default 25.

**cursor**

string

Where the previous page ended: its `nextCursor`, as it came. A runtime that seals cursors takes one only for the same list, filters and caller, within a day; otherwise `400 bad-input`, and the list starts again without it. Absent → first page.

**ownerRunId**

string format: uuid

Only the files whose version 1 this run made.

**projectId**

string format: uuid

Only one project’s files (its id, a UUID).

**contentType**

string

Only the files whose Latest has this type, exactly.

## Responses

### 200

A page of files.

application/json

object

**data**

required

Array\<object>

A file the runtime keeps, with every edit as a version, and its Latest: the highest version that isn’t deleted.

object

**fileId**

required

The file’s id: the `blobId` of its version 1’s bytes, which names the file through every later version.

string

**tenantId**

required

string format: uuid

**projectId**

The project it belongs to. Reading it needs `read` there, or `run` for a file of the caller’s own; changing it needs `write`.

string

**name**

required

Its name: Latest’s.

string

**createdBy**

Who made version 1: `user:<id>` or `service_account:<id>`.

string

**ownerRunId**

The run that made version 1, when one did.

string format: uuid

**latestVersion**

required

integer

\>= 1

**highestVersion**

required

The highest number it has had, deleted versions included.

integer

\>= 1

**pinnedVersions**

required

Its pinned versions, lowest first.

Array\<integer>

**latest**

required

One version of a file. Numbers start at 1, only grow, and are never reused. A deleted or purged version keeps its record, so the runs that used it still name it.

object

**fileId**

required

The file’s id: the `blobId` of its version 1’s bytes, which names the file through every later version.

string

**version**

required

integer

\>= 1

**blobId**

required

The stored bytes. Two versions of one file can share them.

string

**name**

required

The file’s name when this version was made.

string

**contentType**

required

MIME type, as the writer declared it.

string

**size**

required

integer

**hash**

required

Sha256 of the bytes, hex-encoded, lowercase.

string

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

**tags**

required

Labels the writer gave this version.

object

**_key_**

additional properties

string

**parentVersion**

Latest when this version was made. Absent on version 1.

integer

\>= 1

**restoredFrom**

The version a restore copied the bytes of.

integer

\>= 1

**madeVia**

required

How it was made: a person’s or a key’s upload, a restore, a run’s tool, or a run’s model.

string

Allowed values: upload restore tool model

**createdBy**

Who made it: `user:<id>` or `service_account:<id>`, or `run:<id>` for a run’s tool or model.

string

**runId**

The run that made it, when one did.

string format: uuid

**callKey**

The run’s tool call that made it.

string

**toolId**

The tool that made it.

string

**createdAt**

required

string format: date-time

**supersededAt**

When a newer version replaced it as Latest. Absent on Latest: when Latest is deleted, the version that’s Latest again has none.

string format: date-time

**pin**

A version’s keep mark: it can’t be deleted, and retention never purges it.

object

**by**

required

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

string

**at**

required

string format: date-time

**reason**

string

**deletedAt**

string format: date-time

**purgedAt**

When retention dropped its bytes (the `file_version` domain). Its number, hash, size and maker stay.

string format: date-time

**createdAt**

required

string format: date-time

**updatedAt**

required

When its newest version was made, or its Latest last moved.

string format: date-time

**nextCursor**

string

**hasMore**

required

boolean

##### Example

```json
{
  "data": [
    {
      "latest": {
        "madeVia": "upload"
      }
    }
  ]
}
```

### 400

`ownerRunId` or `projectId` is not an id (a UUID).

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"
  }
}
```

### 429

`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.

### 503

The database was too busy to answer in time (`database-busy`), or the authorization store couldn’t be reached (`authz-backend-unavailable`); `Retry-After` (whole seconds) says when to try 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.

## See also

- [`POST /v1/files`: Create a file](https://docs.kindgi.com/v0.7.0/reference/api/operations/filescreate.md)
- [Files and versions](https://docs.kindgi.com/v0.7.0/concepts/files-and-versions.md)
- [Error code `authz-backend-unavailable`](https://docs.kindgi.com/v0.7.0/reference/errors.md#authz-backend-unavailable)
- [Error code `database-busy`](https://docs.kindgi.com/v0.7.0/reference/errors.md#database-busy)
- [Error code `rate-limit-exceeded`](https://docs.kindgi.com/v0.7.0/reference/errors.md#rate-limit-exceeded)
- [Every error code](https://docs.kindgi.com/v0.7.0/reference/errors.md)
