# Write knowledge file

Source: <https://everruns.com/docs/api/operations/write_knowledge_file/>

[Docs](https://everruns.com/docs/)/[API reference](https://everruns.com/docs/api/)/[Knowledge & memory](https://everruns.com/docs/api/groups/knowledge-memory/)/Write knowledge file

# Write knowledge file

Preview

Give agents persistent memory and versioned file collections. Manage sources, files and optional search indexes.

Public APIEverruns Cloud and self-hosted Platform

PUT`/v1/knowledge/{collection_id}/files`

See [authentication](https://everruns.com/docs/sre/runbooks/authentication/) for credentials and permissions.

## Parameters

### Path Parameters

**collection_id**

required

string

Knowledge collection

## Request Bodyrequired

Media typeapplication/json

An inline managed file; use the streaming upload endpoint for files over 8 MiB.

object

**content**

UTF-8 original content. Supply exactly one of `content` or `content_base64`.

string | null

**content_base64**

Base64 original bytes for binary files; mutually exclusive with `content`.

string | null

**indexable**

Optional per-file indexing policy; false retains the original without indexing it.

boolean | null

**metadata**

User annotations retained separately from parsed source/frontmatter metadata.

**mime_type**

Optional media type used for representation extraction; inferred when omitted.

string | null

**path**

required

Normalized absolute path within the collection, preserving its directory hierarchy.

string

**readable**

Optional agent-read policy. Managers can still download retained originals.

boolean | null

### Example generated

```json
{
  "content": "example",
  "content_base64": "example",
  "indexable": true,
  "metadata": "example",
  "mime_type": "example",
  "path": "example",
  "readable": true
}
```

## Responses

200Stored immutable file version

### 200

Stored immutable file version

Media typeapplication/json

### Example generated

```json
example
```

FetchcURL

Request

```js
const url = 'https://app.everruns.com/api/v1/knowledge/example/files';
const options = {
  method: 'PUT',
  headers: {'Content-Type': 'application/json'},
  body: '{"content":"example","content_base64":"example","indexable":true,"metadata":"example","mime_type":"example","path":"example","readable":true}'
};


try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

Request

```sh
curl --request PUT \
  --url https://app.everruns.com/api/v1/knowledge/example/files \
  --header 'Content-Type: application/json' \
  --data '{ "content": "example", "content_base64": "example", "indexable": true, "metadata": "example", "mime_type": "example", "path": "example", "readable": true }'
```

Additional language examples require JavaScript. The default request example is available above.

200

200 · Stored immutable file version

No response body example is declared for this status.

## Matching endpoints