---
title: "uploadFile"
---

> Documentation Index
> Fetch the complete documentation index at: https://agenthold.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# uploadFile

Path: agenthold API › files

`PUT /agents/{agentId}/files/content`

URL: `/api/v1/agents/{agentId}/files/content`

Create or replace a file (operator role). Missing parent directories are created.

## Authentication

Requires one of the following:

- `session`, apiKey, in cookie
- `token`, http bearer, header `Authorization`

## Path parameters

- `agentId` (`uploadFile.path.agentId`; string, required)

## Query parameters

- `path` (`uploadFile.query.path`; string, required)

## Request body (application/octet-stream)

_Required._

Type: `string`

- format: `binary`

## Example request

```text
string
```

## Code samples

### cURL

```bash
curl --request PUT \
  --url '<base-url>/api/v1/agents/<agentId>/files/content?path=string' \
  --header 'Content-Type: application/octet-stream' \
  --cookie 'agenthold_session=<agenthold_session>' \
  --data-raw 'string'
```

### TypeScript

```typescript
const url = '<base-url>/api/v1/agents/<agentId>/files/content?path=string';
const options = {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/octet-stream',
    cookie: 'agenthold_session=<agenthold_session>'
  },
  body: 'string'
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "<base-url>/api/v1/agents/<agentId>/files/content?path=string"

payload = "string"
headers = {
    "cookie": "agenthold_session=<agenthold_session>",
    "Content-Type": "application/octet-stream"
}

response = requests.put(url, data=payload, headers=headers)

print(response.text)
```

## Responses

### 204

Written.

### 400

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`uploadFile.response.400.error`; string, required)

### 403

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`uploadFile.response.403.error`; string, required)

### 404

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`uploadFile.response.404.error`; string, required)

### 409

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`uploadFile.response.409.error`; string, required)


Source: https://agenthold.dev/api/upload-file/index.md
