All Products
Search
Document Center

Drive and Photo Service:Online file editing

Last Updated:Jun 04, 2026

Edit Office files in your browser. Integrate online editing into your application with 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.

API workflow and sample code

1. API workflow

workflow

Note:

  • Call the API to obtain the editing URL and token, then open the editing page.

  • Tokens expire after a set period. Call the refresh API with office_refresh_token to obtain a new token.

  • Access the editing page using frontend technology. Use 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 users can 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. Valid for 30 minutes.

office_refresh_token

Yes

String

The refresh token. 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. Valid for 30 minutes.

office_refresh_token

Yes

String

The new refresh token. 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 editing page using frontend technology. Use 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) for file preview. With the IMM JavaScript SDK, replace token 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 for online editing?

Online editing requires file update permissions in both web and desktop clients.

2. Why can't I edit a file despite having edit permissions?

Check the following:

1. Verify online editing is enabled (value-added feature, disabled by default).

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

3. Verify the file size is under 200 MB.

4. Verify file upload settings with your administrator: in the Admin Console, go to Enterprise Customize > File Settings. Ensure the format is allowed and the size does not exceed the upload limit. Files violating these settings cannot be edited or saved online.