Skip to main content
POST
Stores a file you send in the body as a new file in your private space. The response’s id is the new file’s file_id. Send exactly one of:
  • content with format: text, stored as plain text, Markdown or Word.
  • file_content: any file’s bytes, base64-encoded, at most 3 MB once decoded. Wordsmith stores the bytes as sent and reads the type from them. This suits tools that cannot PUT to an upload URL, such as a Power Automate flow. Upload larger files through the upload URL.
With content, format picks the file type: With content, Wordsmith adds the extension when file_name does not already end with it, ignoring case. "Summary" with docx is stored as Summary.docx. content is at most 1,000,000 bytes as UTF-8.

Authentication

Send an API key, or an OAuth access token with the files:write scope, as a bearer token in the Authorization header. A token without the scope gets 403 with "error": "insufficient_scope".

Body parameters

string
required
The file’s name, 1 to 255 characters. With content, the extension for format is added when the name does not end with it. With file_content, include the extension.
string
The file’s text, at most 1,000,000 bytes as UTF-8. Send exactly one of content and file_content.
string
Required with content, and refused with file_content. txt stores plain text, md stores Markdown, and docx converts the content from Markdown to a Word document.
string (base64)
Any file’s bytes, base64-encoded, at most 3 MB once decoded. Send exactly one of content and file_content. A file whose sensitivity label your organisation blocks is refused with 403.

Response

Returns 201 with the new file.
string (uuid)
The file’s id: the file_id other endpoints take.
string | null
The stored name, with the extension added if it was missing.
string | null
The file’s MIME type.
integer | null
Size in bytes.
string | null
When the file was created. ISO 8601 UTC.
object | null
The file’s sensitivity label from your organisation’s labelling system, such as Microsoft Purview: provider, name (null when Wordsmith can’t name the label) and is_protected (the label encrypts the file). null when the file has no label.

Errors

See Errors for the error format.