---
title: "Create or replace a OneDrive text file as the calling member"
method: PUT
path: "/v1/capabilities/microsoft-365/drive-files"
tags: ["Capability Sources"]
---

# Create or replace a OneDrive text file as the calling member

`PUT /v1/capabilities/microsoft-365/drive-files`

Creates or replaces a bounded UTF-8 text file at a path in the calling member's OneDrive.

## Request body

- Microsoft365DriveFileWriteBody
  - `path` string, required
  - `content` string, required

## Response `200`

OneDrive file written.

- Microsoft365DriveFileWriteResponse
  - `ok` true, required
  - `file` Microsoft365DriveItem, required
    - `id` string, required
    - `name` string, required
    - `size` number, nullable, required
    - `modifiedTime` string, required
    - `webUrl` string, required
    - `mimeType` string, required
    - `kind` 'file' | 'folder' | 'unknown', required

## Other responses

- `401` — The caller must be signed in.
- `409` — The calling member has not connected their Microsoft account or is missing permission.
- `502` — Microsoft Graph rejected the request.

---

[API](https://skmtc.net/openworklabs/apis/den-api.md) · [All operations](https://skmtc.net/openworklabs/apis/den-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/openworklabs/den-api/versions/805150503452/schema)
