All Products
Search
Document Center

AI Guardrails:Get a list of text libraries

Last Updated:Mar 31, 2026

Queries the custom text libraries in your Content Moderation account. The results are consistent with the custom text libraries shown in the AI Guardrails console.

Usage notes

API operation: DescribeKeywordLib

To construct an HTTP request manually, see Request structure. To call this operation using a pre-built client, see SDK overview.

Billing: Free.

QPS limits

This operation is limited to 10 requests per second per account. Requests that exceed this limit are throttled.

Request parameters

For common request parameters, see Common parameters.

NameTypeRequiredExampleDescription
ServiceModuleStringYesopen_apiThe feature module of the text library. Set to open_api to query libraries used by the AI Guardrails API.

Response elements

For top-level response fields, see Response parameters.

The KeywordLibList field in the response body is an array. Each element contains the following fields:

NameTypeExampleDescription
IdInteger2147The ID of the text library.
ModifiedTimeString2018-09-04 14:17:56 +0800The time when the text library was last modified.
NameStringtest1sdkdkThe name of the text library.
CodeString710001The code of the text library. In the AI Guardrails console, the code appears on the Machine Review > Threat Detection Library page. In API operations, use Id to identify a text library, not Code.
CountString3The number of text entries in the text library.
CategoryStringBLACKThe category of the text library. Valid values: BLACK, WHITE, REVIEW. See the table below.
SourceStringMANUALThe source of the text library. Valid values: MANUAL (manually created), FEEDBACK (automatically created by AI Guardrails).
BizTypesStringArray["bizTypeA","bizTypeB"]The business scenarios associated with the text library. For details, see Create a business scenario.
ResourceTypeStringTEXTThe resource type of the library. Valid values: TEXT (text library), IMAGE (image library), VOICE (voice library).
LibTypeStringtextKeywordThe library type within each detection scenario. Valid values vary by scenario. See the table below.
MatchModeStringfuzzyThe match mode for text detection. Valid values: fuzzy (fuzzy match), precise (exact match).
EnableBooleantrueThe status of the text library. Valid values: true (enabled), false (disabled). To re-enable a disabled library, call the create text library operation. For more information, see Modify a text library.

Category values

ValueBehavior when a match is found
BLACKThe detected text is flagged as spam. Delete or restrict the content.
WHITEThe detected text is considered normal. Pass the content directly.
REVIEWThe detected text requires manual review.

LibType values by scenario

Detection scenarioLibType valueDescription
Text spam detectiontextKeywordKeyword library
Text spam detectionsimilarTextSimilar text library
Image advertisingtextKeywordImage keyword library
Voice spam detectionvoiceTextVoice keyword library

Examples

Request example

http(s)://green.cn-shanghai.aliyuncs.com/?Action=DescribeKeywordLib&ServiceModule=open_api&<Common request parameters>

Response example

{
  "requestId": "795D8871-4889-4C0F-A8B1-C7D2B990FF61",
  "data": {
    "TotalCount": 11,
    "KeywordLibList": [
      {
        "Name": "test1sdkdk",
        "Source": "MANUAL",
        "BizTypes": [],
        "Category": "BLACK",
        "ServiceModule": "open_api",
        "Count": 3,
        "ResourceType": "TEXT",
        "Id": 2147,
        "ModifiedTime": "2018-09-04 14:17:56 +0800",
        "Code": "710001",
        "LibType": "textKeyword",
        "MatchMode": "fuzzy",
        "Enable": "true"
      },
      {
        "Name": "Test001",
        "Source": "MANUAL",
        "BizTypes": [],
        "Category": "BLACK",
        "ServiceModule": "open_api",
        "Count": 3,
        "ResourceType": "VOICE",
        "Id": 2693,
        "ModifiedTime": "2018-09-03 17:11:04 +0800",
        "Code": "932001",
        "LibType": "voiceText",
        "MatchMode": "fuzzy",
        "Enable": "true"
      }
    ]
  },
  "code": 200,
  "success": true
}