All Products
Search
Document Center

Drive and Photo Service:Online file editing

Last Updated:Feb 27, 2026

Edit Office files directly in your browser. Integrate online editing into your applications using Drive and Photo Service APIs.

Usage notes

  • Online file editing is a value-added service, disabled by default. Contact us to enable it. For pricing, see Value-added billable items.

  • Supported file formats:

    Spreadsheet

    Text document

    Presentation

    ET, XLS, XLT, XLSX, XLSM, XLTX, XLTM, CSV

    DOC, DOCX, TXT, DOT, WPS, WPT, DOTX, DOCM, DOTM, RTF

    PPT, PPTX, PPTM, PPSX, PPSM, PPS, POTX, POTM, DPT, DPS

  • Up to 365 users can collaboratively edit a file. Performance may degrade above 50 concurrent users.

  • Maximum file size: 200 MB.

  • Collaboration history retained for 180 days.

Process and sample code of API calls

1. Process of API calls

版本

Note:

  • Call an operation to obtain the online editing URL and token, then use them to access the online editing page.

  • Tokens expire after a validity period. Call the refresh API operation using the office_refresh_token parameter to obtain a new token.

  • Access the online editing page using frontend technology. We recommend using the JavaScript SDK provided by Drive and Photo Service. For more information, see the getOfficeEditUrl and refreshOfficeEditToken methods in the documentation of SDK for JavaScript.

2. Obtain an online editing URL

POST /v2/file/get_office_edit_url

Request parameters

Parameter

Position

Type

Required

Description

Authorization

header

String

The access token.

x-share-token

header

String

The share token for shared files. If specified, the Authorization parameter is not required.

drive_id

body

String

No

The drive ID. Mutually exclusive with share_id. Specify one of them.

share_id

body

String

No

The share ID for shared files. If specified, drive_id cannot be specified.

file_id

body

String

Yes

The ID of the file to edit.

option

body

JSON

No

Options to control file editing.

Parameters in the option request parameter

Parameter

Position

Type

Required

Description

copy

body

Boolean

No

Whether to allow users to copy file content.

readonly

body

Boolean

No

Whether the file is read-only. Set to false for online editing.

Response parameters

Parameter

Required

Type

Description

edit_url

Yes

String

The online editing URL.

office_access_token

Yes

String

The access token, which is valid for 30 minutes.

office_refresh_token

Yes

String

The refresh token, which is valid for one day.

Sample request

{
	"drive_id": "testDriveId",
	"file_id": "testFileId",
	"option": {
		"readonly": false,
		"copy": true
	}
}

Sample response

{
	"edit_url": "testEditUrl",
	"office_access_token": "testOfficeAccessToken",
	"office_refresh_token": "testOfficeRefreshToken"
}

3. Refresh the online editing token

POST /v2/file/refresh_office_edit_token

Request parameters

Parameter

Position

Type

Required

Description

Authorization

header

String

The access token.

x-share-token

header

String

The share token for shared files. If specified, the Authorization parameter is not required.

share_id

body

String

No

The share ID for shared files.

office_access_token

body

String

Yes

The access token.

office_refresh_token

body

String

Yes

The refresh token.

Response parameters

Parameter

Required

Type

Description

office_access_token

Yes

String

The new access token, which is valid for 30 minutes.

office_refresh_token

Yes

String

The new refresh token, which is valid for one day.

Sample request

{
	"office_access_token": "testOfficeAccessToken",
	"office_refresh_token": "testOfficeRefreshToken"
}

Sample response

{
	"office_access_token": "testOfficeAccessToken",
	"office_refresh_token": "testOfficeRefreshToken"
}

4. Access the online editing page

Access the online editing page using frontend technology. We recommend using the JavaScript SDK provided by Drive and Photo Service. For more information, see the documentation of the SDK for JavaScript.

Alternatively, use Alibaba Cloud Intelligent Media Management (IMM) file preview. When using the IMM JavaScript SDK, replace token retrieval operations with Drive and Photo Service API calls: use get_office_edit_url to obtain tokens and refresh_office_edit_token to refresh them. For more information, see the IMM User Guide.

FAQ

1. What permissions are required to edit files online?

Online file editing in the web and desktop clients requires update permissions on files.

2. Why can't I edit a file even though I have online editing permissions?

Troubleshoot using these steps:

1. Online file editing is a value-added feature. Verify this feature is enabled.

2. Verify the file format is supported for online editing.

3. Verify the file size is under 200 MB.

4. Contact your Drive and Photo Service administrator to verify file upload settings: In the Admin Console, go to Enterprise Customize > File Settings. Ensure the file format is allowed for upload and the file size does not exceed the single file upload limit. Files that violate these settings cannot be edited or saved online.