All Products
Document Center


Last Updated: Jul 11, 2019


You can call this operation to add a watermark.

Note: Currently, the console supports image watermarks in the static format PNG and dynamic formats including GIF, APNG, and MOV.

Request parameters

Parameter Type Required Description
Action String Yes The operation that you want to perform. Set this parameter to AddWatermark.
Name String Yes The name of the watermark. You can only enter English letters and digits.
  • Length constraint: Maximum length of 128 bytes.
  • Encoding: UTF-8.
Type String Yes The type of the watermark. Valid values: Image and Text. Default value: Image. The value of WatermarkConfig varies, depending on the value of the Type parameter.
WatermarkConfig WatermarkConfig Yes The watermark configurations, such as the display position and effects. The value is a JSON-formatted string. The value of WatermarkConfig varies, depending on the value of the Type parameter.
FileUrl String No The OSS URL of the watermark file. This parameter is required for an image watermark.

Note: For more information about how to upload a watermark file, see CreateUploadAttachedMedia.

Response parameters

Parameter Type Description
RequestId String The ID of the request.
WatermarkInfo WatermarkInfo The watermark information.

API examples

Sample request{"Width":"55","Height":"55","Dx":"9","Dy":"9","ReferPos":"BottonLeft","Type":"Image"}

Sample response

JSON format

  • Text watermark
    "RequestId": "25818875-5F78-4A13-BEF6-D7393642CA58",
      "WatermarkInfo": {
          "Name": "Text watermark test",
          "CreationTime": "2018-11-07T09:05:52Z",
          "IsDefault": "NotDefault",
          "Type": "Text",
          "WatermarkId": "9bcc8bfadb843f475c109a2671d0df97",
          "WatermarkConfig": {
            "FontColor": "Blue",
            "FontSize": 80,
            "Content": "Watermark test"
  • Image watermark
   "RequestId": "25818875-5F78-4A13-BEF6-D7393642CA58",
      "Name": "Image watermark test",
      "CreationTime": "2018-11-06T08:03:17Z",
      "WatermarkId": "505e2e287ea49c40f8cecfddd386d384",
      "FileUrl": "",
      "IsDefault": "NotDefault",
      "Type": "Image",
      "WatermarkConfig": {
        "ReferPos": "BottomRight",
        "Type": "Image",
        "Height": "55",
        "Width": "55",
        "Dx": "8",
        "Dy": "8"

Error codes

This operation also returns common errors. For more information about errors common to all operations, see common errors.

Error code Error message HTTP status code Description
NoSuchResource The specified resource %s does not exist. 404 The error message returned because the user-related resource data does not exist, where %s indicates the specific resource information.

SDK examples

We recommend that you use a server SDK to call this operation. For more information about the sample code used to call this operation in various languages, see the following topics: