Skip to content

Upload Workspace Logo or Icon



POST /api/v1/workspace/upload_logo_image

Overview

Upload and overwrite the Logo or browser icon for the specified language in the current Workspace.

Before You Call and Usage Steps

  1. Prepare a PNG or ICO file with the correct content format, and select the target filename and language.
  2. Send a multipart request with a Key that has the workspace.setManage permission in the current Workspace. The file field is file, and the other two parameters go in the Query.
  3. After confirming content=true, obtain the valid address from content.logoUrl or content.faviconUrl in Current Workspace; keep the old file for rollback.

Use an OpenAPI Key that has the workspace.setManage permission in the current Workspace. The scope is the Workspace to which the current Key belongs. Passing another workspaceUUID in the Body is not supported.

Use multipart/form-data, with the file field name file; put filename and language in the URL Query. filename determines the target purpose (logo.png or favicon.ico), not the original file name; language determines the independent language version, defaulting to zh when omitted. The uploaded original file is validated only by extension png/ico and size, at most one file and 5 MiB; the actual image content is not checked, and no transcoding is performed. The caller must ensure the content format matches the target file.

Uploading again with the same Workspace/target name/language directly overwrites; the old file must be retained in advance to roll back. Files for other languages or the other purpose are not deleted. A successful true response does not return a URL; the actual valid address selected according to the access language can be read from content.logoUrl/faviconUrl in Current Workspace; uploading language does not change the Workspace default language. Details are cached for about 60 seconds, and the current cache key does not distinguish languages, so switching languages does not guarantee an immediate URL change; pages/browsers/CDNs may have caches, and an HTTP success should not be taken as meaning all nodes have refreshed their display. File writing is a file system operation, and failures do not provide database-style rollback.

Request Headers

Parameter Name Type Required Description
DF-API-KEY string Y OpenAPI authentication credential for the Workspace.
Example: <DF-API-KEY>
How to obtain or provide: Obtain an OpenAPI Key with permission for this operation from API Key Management in the target Workspace.

Query Request Parameters

Parameter Name Type Required Description
filename string Optional fixed target file name, default logo.png; only these two values are allowed. The purpose is not determined by the original uploaded file name.
Optional values: ['logo.png', 'favicon.ico']
Example: logo.png
How to obtain or provide: Use logo.png for the Logo and favicon.ico for the browser icon.
language string Optional; default zh. Different languages are stored independently; omitting it does not update all languages at the same time.
Optional values: ['zh', 'en', 'zh-hant', 'id', 'ja', 'ko']
Example: zh
How to obtain or provide: Select zh/en/zh-hant/id/ja/ko; it must match the client language.

File Parameters (multipart/form-data)

Parameter Name Type Required Description
file file Y Required single file; the original file extension must be png or ico (case-normalized), up to 5×1024×1024 bytes; pass a file stream, not Base64 or a JSON file path.
Single file size limit: 5M
File count limit: 1
Allowed file extensions: ['png', 'ico']
Example: @./company-logo.png
How to obtain or provide: Prepare a valid Logo/ICO file locally and replace the path with the actual file.

Additional Parameter Notes

Notes

  1. This endpoint uses a form request, and the file content is stored in the file field within the form.
  2. A single request supports only one file.
  3. Regardless of the original name of the uploaded file, the file is ultimately stored under the file name specified by the filename parameter.

Request Example

curl --request POST 'https://openapi.guance.com/api/v1/workspace/upload_logo_image?filename=logo.png&language=zh' \
  -H 'DF-API-KEY: <DF-API-KEY>' \
  -F 'file=@./company-logo.png'

Response

HTTP 200, application/json. The example below shows the main fields that can be read directly.

Field Type Description
content boolean Returns true when the file has been written; media content or an address is not returned.
{
  "code": 200,
  "content": true,
  "errorCode": "",
  "message": "",
  "success": true,
  "traceId": "TRACE-EXAMPLE"
}

Error Responses

See Public Error Definitions for authentication, rate limiting, and common request errors.

HTTP Status errorCode Trigger Condition Message or Response Description Handling
406 ft.ParameterValidationFailed A request field is missing, or a field value violates the declared validation conditions Parameter parsing failed Check the parameter position, field name, type, and value.
406 ft.UploadFailed The file obtained by the route is empty (normal missing-file cases are rejected first by declaration validation) No file uploaded Use the multipart field file and select a valid file.
500 ft.InternalServerError Directory creation, file saving, or subsequent response processing fails Internal error Check whether the file has been written and check permissions/disk space; retain traceId. Keep the old version before overwriting, as some files may already have changed on failure.

Feedback

Is this page helpful?