---
title: "Write a skill file"
description: "Add a file to one of your skills, or replace the file at that path. The\nrequest body is the file's bytes. Each write is a version in its history."
---

> Documentation Index
> Fetch the complete documentation index at: https://truememory-docs.mvstg.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: AI Gateway API › Skills

`PUT /skills/{skill_id}/files/{file_path}`

Add a file to one of your skills, or replace the file at that path. The
request body is the file's bytes. Each write is a version in its history.

## Authentication

- `HTTPBearer`, http, header `Authorization`

## Path parameters

- `skill_id` (`write_skill_file.path.skill_id`; string, required)
  - format `uuid`
- `file_path` (`write_skill_file.path.file_path`; string, required) — Path in the skill folder, e.g. `references/method.md`.

## Header parameters

- `X-On-Behalf-Of` (`write_skill_file.header.X-On-Behalf-Of`; any of, optional)
  - any of: `string`, `null`
- `X-External-User-Id` (`write_skill_file.header.X-External-User-Id`; any of, optional)
  - any of: `string`, `null`
- `X-App-Id` (`write_skill_file.header.X-App-Id`; any of, optional)
  - any of: `string`, `null`

## Request body

_Required._

## Example request

```text
string
```

## Code samples

### cURL

```bash
curl --request PUT \
  --url 'https://truememory-api.mvstg.com/skills/<skill_id>/files/<file_path>' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/octet-stream' \
  --data-raw 'string'
```

### TypeScript

```typescript
const url = 'https://truememory-api.mvstg.com/skills/<skill_id>/files/<file_path>';
const options = {
  method: 'PUT',
  headers: {'Content-Type': 'application/octet-stream', Authorization: 'Bearer <token>'},
  body: 'string'
};

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

### Python

```python
import requests

url = "https://truememory-api.mvstg.com/skills/<skill_id>/files/<file_path>"

payload = "string"
headers = {
    "Content-Type": "application/octet-stream",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 200

Successful Response

#### Example

```json
{
  "path": "string",
  "sha256": "string",
  "size": 0,
  "content_type": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z"
}
```

- `path` (`write_skill_file.response.200.path`; string, required) — Path in the skill folder, e.g. `references/method.md`.
- `sha256` (`write_skill_file.response.200.sha256`; string, required) — Hex SHA-256 of the file's bytes.
- `size` (`write_skill_file.response.200.size`; integer, required) — Size in bytes.
- `content_type` (`write_skill_file.response.200.content_type`; string, required)
- `created_at` (`write_skill_file.response.200.created_at`; string, required)
  - format `date-time`
- `updated_at` (`write_skill_file.response.200.updated_at`; string, required) — When this path last got different bytes.
  - format `date-time`

### 422

Validation Error

#### Example

```json
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}
```

- `detail` (`write_skill_file.response.422.detail`; array<object>, optional)
  - `loc` (`write_skill_file.response.422.detail.loc`; array<any of>, required)
    - any of: `string`, `integer`
  - `msg` (`write_skill_file.response.422.detail.msg`; string, required)
  - `type` (`write_skill_file.response.422.detail.type`; string, required)
  - `input` (`write_skill_file.response.422.detail.input`; unknown, optional)
  - `ctx` (`write_skill_file.response.422.detail.ctx`; object, optional)


Source: https://truememory-docs.mvstg.com/api/skills/files/update/index.md
