Get Started
Usage API
More information

POST api/2.0/files/{folderId}/file This function requires authentication

Description

Creates a new file in the specified folder with the title specified in the request.

Parameters
Name Description Type Example
folderId
sent in url
Folder ID string some text
title
sent in body
File title
Allowed values: the file must have one of the following extensions: DOCX, XLSX, PPTX
string some text
templateId
sent in body
Template file ID string some text
enableExternalExt
sent in body
Specifies whether to allow the creation of external extension files or not Bool value true
Remark

If a file extension is different from DOCX/XLSX/PPTX and refers to one of the known text, spreadsheet or presentation formats, it will be changed to DOCX/XLSX/PPTX accordingly. If the file extension is not specified or is unknown, the DOCX extension will be added to the file title.

Example
POST api/2.0/files/%22some+text%22/file
Host: yourportal.onlyoffice.com
Content-Type: application/json
Accept: application/json

{
  "title": "some text",
  "templateId": "some text",
  "enableExternalExt": true
}
Returns

New file information

Example Response

application/json

{
  "status": 0,
  "response": {
    "RootFolderType": 2,
    "UpdatedBy": {
      "Id": "00000000-0000-0000-0000-000000000000",
      "DisplayName": "Mike Zanyatski",
      "Title": "Manager",
      "AvatarSmall": "url to small avatar",
      "ProfileUrl": "\\/Products\\/People\\/Profile.aspx?user=administrator"
    },
    "Created": "2020-12-13T17:13:31.5902727Z",
    "CreatedBy": {
      "Id": "00000000-0000-0000-0000-000000000000",
      "DisplayName": "Mike Zanyatski",
      "Title": "Manager",
      "AvatarSmall": "url to small avatar",
      "ProfileUrl": "\\/Products\\/People\\/Profile.aspx?user=administrator"
    },
    "Updated": "2020-12-13T17:13:31.5902727Z",
    "ProviderItem": true,
    "ProviderKey": "1234d",
    "ProviderId": 1234,
    "FolderId": 12334,
    "Version": 3,
    "VersionGroup": 1,
    "ContentLength": "12.06 KB",
    "PureContentLength": 12345,
    "FileStatus": 2,
    "ViewUrl": "http:\\/\\/www.onlyoffice.com\\/viewfile?fileid=2221",
    "WebUrl": "http:\\/\\/www.onlyoffice.com\\/viewfile?fileid=2221",
    "FileType": 7,
    "FileExst": ".txt",
    "Comment": null,
    "Encrypted": true,
    "Id": 857864274,
    "Title": "Some titile.txt",
    "Access": 1,
    "Shared": false
  }
}

text/xml

<result>
  <status>0</status>
  <response>
    <RootFolderType>2</RootFolderType>
    <UpdatedBy>
      <Id>00000000-0000-0000-0000-000000000000</Id>
      <DisplayName>Mike Zanyatski</DisplayName>
      <Title>Manager</Title>
      <AvatarSmall>url to small avatar</AvatarSmall>
      <ProfileUrl>\/Products\/People\/Profile.aspx?user=administrator</ProfileUrl>
    </UpdatedBy>
    <Created>2020-12-13T17:13:31.5902727Z</Created>
    <CreatedBy>
      <Id>00000000-0000-0000-0000-000000000000</Id>
      <DisplayName>Mike Zanyatski</DisplayName>
      <Title>Manager</Title>
      <AvatarSmall>url to small avatar</AvatarSmall>
      <ProfileUrl>\/Products\/People\/Profile.aspx?user=administrator</ProfileUrl>
    </CreatedBy>
    <Updated>2020-12-13T17:13:31.5902727Z</Updated>
    <ProviderItem>True</ProviderItem>
    <ProviderKey>1234d</ProviderKey>
    <ProviderId>1234</ProviderId>
    <FolderId>12334</FolderId>
    <Version>3</Version>
    <VersionGroup>1</VersionGroup>
    <ContentLength>12.06 KB</ContentLength>
    <PureContentLength>12345</PureContentLength>
    <FileStatus>2</FileStatus>
    <ViewUrl>http:\/\/www.onlyoffice.com\/viewfile?fileid=2221</ViewUrl>
    <WebUrl>http:\/\/www.onlyoffice.com\/viewfile?fileid=2221</WebUrl>
    <FileType>7</FileType>
    <FileExst>.txt</FileExst>
    <Comment />
    <Encrypted>True</Encrypted>
    <Id>857864274</Id>
    <Title>Some titile.txt</Title>
    <Access>1</Access>
    <Shared>False</Shared>
  </response>
</result>