Adds terms to a specified custom text library. You can use text libraries for text anti-spam. The effect of managing custom text libraries by using API operations is the same as that of managing custom text libraries in the Alibaba Cloud Content Moderation console.

Operation description

Operation: CreateKeyword

You can call this operation to add terms to a specified text library. For more information about how to construct an HTTP request, see Request structure. You can also select an existing HTTP request. For more information, see SDK overview.

Billing method: This operation is free of charge.

Request parameters

For more information about the common request parameters that must be included in all Content Moderation API requests, see Common parameters.

The following table describes the parameters in the request body.
Parameter Type Required Example Description
KeywordLibId String Yes 2147 The primary key ID of the text library.
Keywords StringArray Yes ["test"] The list of terms.

Response parameters

For more information about common response parameters that are returned by this operation, see Common response parameters.
Parameter Type Example Description
SuccessCount Integer 0 The number of terms that are added.
InvalidKeywordList StringArray ["test"] The list of invalid terms, which are the terms that failed to be added.

Examples

Sample requests
{
  "KeywordLibId": "2147",
  "Keywords": [
      "test"
  ]
}
Sample success responses
{
  "code": 200,
  "data": {
    "InvalidKeywordList": [
      "test"
    ],
    "SuccessCount": 0
  }
}