1. Overview
This page contains the APIs that are used to send content to CleanSpeak for moderation and filtering. Here are the APIs:
Note: Null values in JSON are not allowed on any of the CleanSpeak APIs. If you are looking to pass in a null value, simply omit it from your request instead. This will allow Passport to handle default values correctly. |
2. Moderate Content
This API is used to send new content to CleanSpeak to be moderated. To make updates to content that has already been sent into CleanSpeak use the Update Content API.
Like the Filter Content API the same filtering is performed on content sent to this API. The difference is that instead of returning all matches found in the content, the Application filter rules are first applied to determine what action should be taken. Using this API allows you to modify the filter behavior without changing the way you send content to the filter. This allows for a much more powerful integration.
Important At least one Application must be configured prior to sending content to the Moderate API. See the Applications setup page for details on configuring applications with the Management Interface or the Application API. |
Transient vs Persistent Content CleanSpeak will store all content whether it is transient or persistent so long as the Store Content? configuration is enabled for the Application. The difference in the two content types is whether the content is eligible for moderation. Moderation actions include placing the content in an Approval Queue or editing/deleting the content after it’s been published. Transient content is not be eligible for moderation but the user that generated the content can be moderated (actioned). The most common example of transient content is real-time chat, which disappears from the users' perspectives after a short amount of time. This type of content can’t be edited or deleted since it disappears so quickly. Also, the real-time nature of chat means it would never require pre-approval. Persistent content such as forum posts must include a content ID (UUID) in order for CleanSpeak to communicate content moderation events back to the client application with the Webhook System. |
2.1. Request
For Transient content, do not provide a unique identifier on the API request, CleanSpeak will generate this on your behalf.
POST /content/item/moderate
POST /api/content/item/moderate
For persistent content you will need to provide a unique identifier (UUID) on the API request. When using this API with persistent content you’ll need to first ensure your Application configuration is set to Persistent Content Type. If you have not done this the API request will fail with an error message indicating you have not yet configured your Application.
POST /content/item/moderate/{contentItemId}
POST /api/content/item/moderate/{contentItemId}
contentItemId [UUID] Required |
The Id of the Content Item. |
content [Object] Required |
The piece of content being moderated. |
||||||||||||||||||
content.applicationId [UUID] Required |
The Id of the application that corresponds to the content source. |
||||||||||||||||||
content.createInstant [Long] Required |
The instant that the content was generated. NOTE: this is represented as milliseconds since Epoch. |
||||||||||||||||||
content.location [String] Optional |
Specifies the location within the application that the content was generated. For example, you might use a chat room name, area Id for a game, or a thread Id for a forum. This parameter is used by CleanSpeak to display conversational views of content with the Context View feature. |
||||||||||||||||||
content.parts [Array] Required |
An array that contains one to many content parts. If your content only has a single part, such as a chat message, the array will only contain a single text entry. The reason you would send in multiple content parts within a single request is to ensure the moderation decision affects each part. For example, you may send in an image for moderation, the image has a title and a description field. You would send this to CleanSpeak with three content parts, the image and two text parts. If the content of the image title is rejected the entire content needs to be rejected wholesale, the title, description and the image. In this case it would make sense to treat all three parts as an atomic unit of content. If individual content parts are not related and can be rejected or approved separately then you should send them to CleanSpeak as separate requests. |
||||||||||||||||||
content.parts |
The content to be filtered. The content type will indicate what type of content is expected in this parameter. Content Types
|
||||||||||||||||||
content.parts |
The name of the content part. This value is optional an intended to better identify the context when you have more than one content part. For example this could be Title, Message Body or Image. |
||||||||||||||||||
content.parts |
The type of this content part. Possible values:
|
||||||||||||||||||
content.receiverDisplayName [String] Optional |
The display name of the user that received the content. This parameter should only be set if this piece of content was a private message between two users. |
||||||||||||||||||
content.receiverId [UUID] Optional |
The Id of the user that received of the content. This parameter should only be set if this piece of content was a private message between two users. |
||||||||||||||||||
content.senderDisplayName [String] Optional |
The display name (username or whatever is displayed to other users in the game/forum) that generated the content. |
||||||||||||||||||
content.senderId [UUID] Required |
The Id of the user that generated the content. This parameter is required so that CleanSpeak can analyze and associate the content with the user that generated it. |
||||||||||||||||||
moderation [String] Optional |
Tells CleanSpeak to forcibly put the content into a queue (Approval, User Alert or Content Alert). This overrides the configuration you have setup for the Application in the Management Interface.
|
{
"content": {
"applicationId": "f81d4fae-7dec-11d0-a765-00a0c91e6bf6",
"createInstant": 1625691361999,
"location": "threadId_42",
"parts": [
{
"content": "Smurf off",
"name": "Body",
"type": "text"
}
],
"senderDisplayName": "PapaSmurf",
"senderId": "f6d3df91-ed4b-48ad-810f-05a367d328c2"
}
}
2.2. Response
Code | Description |
---|---|
200 |
The request was successful. The response will contain a JSON body. |
400 |
The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. |
401 |
You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See Authentication. |
402 |
Your license has expired. The response will be empty. Contact sales@cleanspeak.com for assistance. |
500 |
There was an internal error. A stack trace is provided and logged in the CleanSpeak log files. The response will be empty. |
content [Object] |
The piece of content being moderated. |
||||||||||||
content.id [UUID] |
The id of the piece of content. This might have been passed in on the request or generated by CleanSpeak. |
||||||||||||
content.parts [Array] |
The list of parts of content. |
||||||||||||
content.parts[x].mediaFilterResult [Object] |
An object for displaying media filter results. This is only present if the application is configured to return filter matches. |
||||||||||||
content.parts[x].mediaFilterResult.alcoholConfidence [Float] |
The confidence that the image contains alcohol imagery. |
||||||||||||
content.parts[x].mediaFilterResult.drugsConfidence [Float] |
The confidence that the image contains drug imagery. |
||||||||||||
content.parts[x].mediaFilterResult.offensiveResults[x].offensiveConfidence [Float] |
The confidence that the image contains offensive content. |
||||||||||||
content.parts[x].mediaFilterResult.offensiveResults[x].offensiveTag [String] |
The tag for the type of offensive content. |
||||||||||||
content.parts[x].mediaFilterResult.offensiveResults[x].position [Float] |
The frame that the offensive content exists on. |
||||||||||||
content.parts[x].mediaFilterResult.partialNudityConfidence [Float] |
The confidence that the image contains partial nudity. |
||||||||||||
content.parts[x].mediaFilterResult.partialNudityTag [String] |
The associated tag for the type of partial nudity. |
||||||||||||
content.parts[x].mediaFilterResult.rawNudityConfidence [Float] |
The confidence that the image contains raw nudity. |
||||||||||||
content.parts[x].mediaFilterResult.scamConfidence [Float] |
The confidence that the image is a known scammer image. |
||||||||||||
content.parts[x].mediaFilterResult.weaponConfidence [Float] |
The confidence that the image contains weapon. |
||||||||||||
content.parts[x].name [String] |
The name of the part of the content. |
||||||||||||
content.parts[x].replacement [String] |
The replacement text generated by CleanSpeak after applying the filter rules to this part. |
||||||||||||
contentAction [String] |
The action that the client should take with the content. Possible values: Content Actions
|
||||||||||||
moderationAction [String] |
The action that was taken on the content. Possible values:
|
||||||||||||
stored [Boolean] |
This value indicates if the content was stored by CleanSpeak. |
{
"content": {
"id": "99f2c4e8-961a-4a34-b9b9-43fc3f3b43ec"
},
"contentAction": "allow",
"moderationAction": "generatesAlert",
"stored": true
}
{
"content": {
"id": "99f2c4e8-961a-4a34-b9b9-43fc3f3b43ec",
"parts" : [{
"name" : "body",
"replacement" : "**** off"
}]
},
"contentAction": "replace",
"moderationAction": "generatesAlert",
"stored": true
}
3. Update Content
This API is used to send updates to existing content to CleanSpeak to be moderated. Only persistent content can be updated in CleanSpeak.
Like the Filter Content API the same filtering is performed on content sent to this API. The difference is that instead of returning all matches found in the content, the Application filter rules are first applied to determine what action should be taken. Using this API allows you to modify the filter behavior without changing the way you send content to the filter. This allows for a much more powerful integration.
3.1. Request
You need to provide the unique identifier (UUID) of the content being updated on the API request.
PUT /content/item/moderate/{contentItemId}
PUT /api/content/item/moderate/{contentItemId}
contentItemId [UUID] Required |
The Id of the Content Item. |
content [Object] Required |
The piece of content being moderated. |
||||||||||||||||||
content.applicationId [UUID] Required |
The Id of the application that corresponds to the content source. |
||||||||||||||||||
content.createInstant [Long] Required |
The instant that the content was generated. NOTE: this is represented as milliseconds since Epoch. |
||||||||||||||||||
content.location [String] Optional |
Specifies the location within the application that the content was generated. For example, you might use a chat room name, area Id for a game, or a thread Id for a forum. This parameter is used by CleanSpeak to display conversational views of content with the Context View feature. |
||||||||||||||||||
content.parts [Array] Required |
An array that contains one to many content parts. If your content only has a single part, such as a chat message, the array will only contain a single text entry. The reason you would send in multiple content parts within a single request is to ensure the moderation decision affects each part. For example, you may send in an image for moderation, the image has a title and a description field. You would send this to CleanSpeak with three content parts, the image and two text parts. If the content of the image title is rejected the entire content needs to be rejected wholesale, the title, description and the image. In this case it would make sense to treat all three parts as an atomic unit of content. If individual content parts are not related and can be rejected or approved separately then you should send them to CleanSpeak as separate requests. |
||||||||||||||||||
content.parts |
The content to be filtered. The content type will indicate what type of content is expected in this parameter. Content Types
|
||||||||||||||||||
content.parts |
The name of the content part. This value is optional an intended to better identify the context when you have more than one content part. For example this could be Title, Message Body or Image. |
||||||||||||||||||
content.parts |
The type of this content part. Possible values:
|
||||||||||||||||||
content.receiverDisplayName [String] Optional |
The display name of the user that received the content. This parameter should only be set if this piece of content was a private message between two users. |
||||||||||||||||||
content.receiverId [UUID] Optional |
The Id of the user that received of the content. This parameter should only be set if this piece of content was a private message between two users. |
||||||||||||||||||
content.senderDisplayName [String] Optional |
The display name (username or whatever is displayed to other users in the game/forum) that generated the content. |
||||||||||||||||||
content.senderId [UUID] Required |
The Id of the user that generated the content. This parameter is required so that CleanSpeak can analyze and associate the content with the user that generated it. |
||||||||||||||||||
moderation [String] Optional |
Tells CleanSpeak to forcibly put the content into a queue (Approval, User Alert or Content Alert). This overrides the configuration you have setup for the Application in the Management Interface.
|
{
"content": {
"applicationId": "f81d4fae-7dec-11d0-a765-00a0c91e6bf6",
"createInstant": 1625691361999,
"location": "threadId_42",
"parts": [
{
"content": "Smurf off",
"name": "Body",
"type": "text"
}
],
"senderDisplayName": "PapaSmurf",
"senderId": "f6d3df91-ed4b-48ad-810f-05a367d328c2"
}
}
3.2. Response
Code | Description |
---|---|
200 |
The request was successful. The response will contain a JSON body. |
400 |
The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. |
401 |
You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See Authentication. |
402 |
Your license has expired. The response will be empty. Contact sales@cleanspeak.com for assistance. |
500 |
There was an internal error. A stack trace is provided and logged in the CleanSpeak log files. The response will be empty. |
content [Object] |
The piece of content being moderated. |
||||||||||||
content.id [UUID] |
The id of the piece of content. This might have been passed in on the request or generated by CleanSpeak. |
||||||||||||
content.parts [Array] |
The list of parts of content. |
||||||||||||
content.parts[x].mediaFilterResult [Object] |
An object for displaying media filter results. This is only present if the application is configured to return filter matches. |
||||||||||||
content.parts[x].mediaFilterResult.alcoholConfidence [Float] |
The confidence that the image contains alcohol imagery. |
||||||||||||
content.parts[x].mediaFilterResult.drugsConfidence [Float] |
The confidence that the image contains drug imagery. |
||||||||||||
content.parts[x].mediaFilterResult.offensiveResults[x].offensiveConfidence [Float] |
The confidence that the image contains offensive content. |
||||||||||||
content.parts[x].mediaFilterResult.offensiveResults[x].offensiveTag [String] |
The tag for the type of offensive content. |
||||||||||||
content.parts[x].mediaFilterResult.offensiveResults[x].position [Float] |
The frame that the offensive content exists on. |
||||||||||||
content.parts[x].mediaFilterResult.partialNudityConfidence [Float] |
The confidence that the image contains partial nudity. |
||||||||||||
content.parts[x].mediaFilterResult.partialNudityTag [String] |
The associated tag for the type of partial nudity. |
||||||||||||
content.parts[x].mediaFilterResult.rawNudityConfidence [Float] |
The confidence that the image contains raw nudity. |
||||||||||||
content.parts[x].mediaFilterResult.scamConfidence [Float] |
The confidence that the image is a known scammer image. |
||||||||||||
content.parts[x].mediaFilterResult.weaponConfidence [Float] |
The confidence that the image contains weapon. |
||||||||||||
content.parts[x].name [String] |
The name of the part of the content. |
||||||||||||
content.parts[x].replacement [String] |
The replacement text generated by CleanSpeak after applying the filter rules to this part. |
||||||||||||
contentAction [String] |
The action that the client should take with the content. Possible values: Content Actions
|
||||||||||||
moderationAction [String] |
The action that was taken on the content. Possible values:
|
||||||||||||
stored [Boolean] |
This value indicates if the content was stored by CleanSpeak. |
{
"content": {
"id": "99f2c4e8-961a-4a34-b9b9-43fc3f3b43ec"
},
"contentAction": "allow",
"moderationAction": "generatesAlert",
"stored": true
}
{
"content": {
"id": "99f2c4e8-961a-4a34-b9b9-43fc3f3b43ec",
"parts" : [{
"name" : "body",
"replacement" : "**** off"
}]
},
"contentAction": "replace",
"moderationAction": "generatesAlert",
"stored": true
}
4. Proxy Moderate Content
Available since |
This API is used exactly like the Moderate Content API except that its responses will be sent to a different destination with the exception of errors. If you need to update a piece of content then you can also use Proxy Update Content API which is the parallel for the Update Content API.
Important At least one Application must be configured prior to sending content to the Moderate API. See the Applications setup page for details on configuring applications with the Management Interface or the Application API. This application will also need to be configured for use with this API via the proxy configuration (this can be found either under moderation configuration if you are using the API or the advanced section if you are using the UI). |
Transient vs Persistent Content CleanSpeak will store all content whether it is transient or persistent so long as the Store Content? configuration is enabled for the Application. The difference in the two content types is whether the content is eligible for moderation. Moderation actions include placing the content in an Approval Queue or editing/deleting the content after it’s been published. Transient content is not be eligible for moderation but the user that generated the content can be moderated (actioned). The most common example of transient content is real-time chat, which disappears from the users' perspectives after a short amount of time. This type of content can’t be edited or deleted since it disappears so quickly. Also, the real-time nature of chat means it would never require pre-approval. Persistent content such as forum posts must include a content ID (UUID) in order for CleanSpeak to communicate content moderation events back to the client application with the Webhook System. |
4.1. Request
For Transient content, do not provide a unique identifier on the API request, CleanSpeak will generate this on your behalf.
POST /content/item/moderate/proxy
POST /api/content/item/moderate/proxy
For persistent content you will need to provide a unique identifier (UUID) on the API request. When using this API with persistent content you’ll need to first ensure your Application configuration is set to Persistent Content Type. If you have not done this the API request will fail with an error message indicating you have not yet configured your Application.
POST /content/item/moderate/proxy/{contentItemId}
POST /api/content/item/moderate/proxy/{contentItemId}
contentItemId [UUID] Required |
The Id of the Content Item. |
content [Object] Required |
The piece of content being moderated. |
||||||||||||||||||
content.applicationId [UUID] Required |
The Id of the application that corresponds to the content source. |
||||||||||||||||||
content.createInstant [Long] Required |
The instant that the content was generated. NOTE: this is represented as milliseconds since Epoch. |
||||||||||||||||||
content.location [String] Optional |
Specifies the location within the application that the content was generated. For example, you might use a chat room name, area Id for a game, or a thread Id for a forum. This parameter is used by CleanSpeak to display conversational views of content with the Context View feature. |
||||||||||||||||||
content.parts [Array] Required |
An array that contains one to many content parts. If your content only has a single part, such as a chat message, the array will only contain a single text entry. The reason you would send in multiple content parts within a single request is to ensure the moderation decision affects each part. For example, you may send in an image for moderation, the image has a title and a description field. You would send this to CleanSpeak with three content parts, the image and two text parts. If the content of the image title is rejected the entire content needs to be rejected wholesale, the title, description and the image. In this case it would make sense to treat all three parts as an atomic unit of content. If individual content parts are not related and can be rejected or approved separately then you should send them to CleanSpeak as separate requests. |
||||||||||||||||||
content.parts |
The content to be filtered. The content type will indicate what type of content is expected in this parameter. Content Types
|
||||||||||||||||||
content.parts |
The name of the content part. This value is optional an intended to better identify the context when you have more than one content part. For example this could be Title, Message Body or Image. |
||||||||||||||||||
content.parts |
The type of this content part. Possible values:
|
||||||||||||||||||
content.receiverDisplayName [String] Optional |
The display name of the user that received the content. This parameter should only be set if this piece of content was a private message between two users. |
||||||||||||||||||
content.receiverId [UUID] Optional |
The Id of the user that received of the content. This parameter should only be set if this piece of content was a private message between two users. |
||||||||||||||||||
content.senderDisplayName [String] Optional |
The display name (username or whatever is displayed to other users in the game/forum) that generated the content. |
||||||||||||||||||
content.senderId [UUID] Required |
The Id of the user that generated the content. This parameter is required so that CleanSpeak can analyze and associate the content with the user that generated it. |
||||||||||||||||||
moderation [String] Optional |
Tells CleanSpeak to forcibly put the content into a queue (Approval, User Alert or Content Alert). This overrides the configuration you have setup for the Application in the Management Interface.
|
{
"content": {
"applicationId": "f81d4fae-7dec-11d0-a765-00a0c91e6bf6",
"createInstant": 1625691361999,
"location": "threadId_42",
"parts": [
{
"content": "Smurf off",
"name": "Body",
"type": "text"
}
],
"senderDisplayName": "PapaSmurf",
"senderId": "f6d3df91-ed4b-48ad-810f-05a367d328c2"
}
}
4.2. Response
Code | Description |
---|---|
200 |
The request was successful. The response will be empty. |
400 |
The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. |
401 |
You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See Authentication. |
402 |
Your license has expired. The response will be empty. Contact sales@cleanspeak.com for assistance. |
500 |
There was an internal error. A stack trace is provided and logged in the CleanSpeak log files. The response will be empty. |
4.3. Forwarded Response
This will be forwarded using a POST
method to the destination configured in the application’s proxy configuration.
content [Object] |
The piece of content being moderated. |
||||||||||||
content.id [UUID] |
The id of the piece of content. This might have been passed in on the request or generated by CleanSpeak. |
||||||||||||
content.parts [Array] |
The list of parts of content. |
||||||||||||
content.parts[x].mediaFilterResult [Object] |
An object for displaying media filter results. This is only present if the application is configured to return filter matches. |
||||||||||||
content.parts[x].mediaFilterResult.alcoholConfidence [Float] |
The confidence that the image contains alcohol imagery. |
||||||||||||
content.parts[x].mediaFilterResult.drugsConfidence [Float] |
The confidence that the image contains drug imagery. |
||||||||||||
content.parts[x].mediaFilterResult.offensiveResults[x].offensiveConfidence [Float] |
The confidence that the image contains offensive content. |
||||||||||||
content.parts[x].mediaFilterResult.offensiveResults[x].offensiveTag [String] |
The tag for the type of offensive content. |
||||||||||||
content.parts[x].mediaFilterResult.offensiveResults[x].position [Float] |
The frame that the offensive content exists on. |
||||||||||||
content.parts[x].mediaFilterResult.partialNudityConfidence [Float] |
The confidence that the image contains partial nudity. |
||||||||||||
content.parts[x].mediaFilterResult.partialNudityTag [String] |
The associated tag for the type of partial nudity. |
||||||||||||
content.parts[x].mediaFilterResult.rawNudityConfidence [Float] |
The confidence that the image contains raw nudity. |
||||||||||||
content.parts[x].mediaFilterResult.scamConfidence [Float] |
The confidence that the image is a known scammer image. |
||||||||||||
content.parts[x].mediaFilterResult.weaponConfidence [Float] |
The confidence that the image contains weapon. |
||||||||||||
content.parts[x].name [String] |
The name of the part of the content. |
||||||||||||
content.parts[x].replacement [String] |
The replacement text generated by CleanSpeak after applying the filter rules to this part. |
||||||||||||
contentAction [String] |
The action that the client should take with the content. Possible values: Content Actions
|
||||||||||||
moderationAction [String] |
The action that was taken on the content. Possible values:
|
||||||||||||
stored [Boolean] |
This value indicates if the content was stored by CleanSpeak. |
{
"content": {
"id": "99f2c4e8-961a-4a34-b9b9-43fc3f3b43ec"
},
"contentAction": "allow",
"moderationAction": "generatesAlert",
"stored": true
}
{
"content": {
"id": "99f2c4e8-961a-4a34-b9b9-43fc3f3b43ec",
"parts" : [{
"name" : "body",
"replacement" : "**** off"
}]
},
"contentAction": "replace",
"moderationAction": "generatesAlert",
"stored": true
}
5. Proxy Update Content
Available since |
This API is used to send updates to existing content to CleanSpeak to be moderated. Only persistent content can be updated in CleanSpeak.
Like the Filter Content API the same filtering is performed on content sent to this API. The difference is that instead of returning all matches found in the content, the Application filter rules are first applied to determine what action should be taken. Using this API allows you to modify the filter behavior without changing the way you send content to the filter. This allows for a much more powerful integration.
5.1. Request
You need to provide the unique identifier (UUID) of the content being updated on the API request.
PUT /content/item/moderate/proxy/{contentItemId}
PUT /api/content/item/moderate/proxy/{contentItemId}
contentItemId [UUID] Required |
The Id of the Content Item. |
content [Object] Required |
The piece of content being moderated. |
||||||||||||||||||
content.applicationId [UUID] Required |
The Id of the application that corresponds to the content source. |
||||||||||||||||||
content.createInstant [Long] Required |
The instant that the content was generated. NOTE: this is represented as milliseconds since Epoch. |
||||||||||||||||||
content.location [String] Optional |
Specifies the location within the application that the content was generated. For example, you might use a chat room name, area Id for a game, or a thread Id for a forum. This parameter is used by CleanSpeak to display conversational views of content with the Context View feature. |
||||||||||||||||||
content.parts [Array] Required |
An array that contains one to many content parts. If your content only has a single part, such as a chat message, the array will only contain a single text entry. The reason you would send in multiple content parts within a single request is to ensure the moderation decision affects each part. For example, you may send in an image for moderation, the image has a title and a description field. You would send this to CleanSpeak with three content parts, the image and two text parts. If the content of the image title is rejected the entire content needs to be rejected wholesale, the title, description and the image. In this case it would make sense to treat all three parts as an atomic unit of content. If individual content parts are not related and can be rejected or approved separately then you should send them to CleanSpeak as separate requests. |
||||||||||||||||||
content.parts |
The content to be filtered. The content type will indicate what type of content is expected in this parameter. Content Types
|
||||||||||||||||||
content.parts |
The name of the content part. This value is optional an intended to better identify the context when you have more than one content part. For example this could be Title, Message Body or Image. |
||||||||||||||||||
content.parts |
The type of this content part. Possible values:
|
||||||||||||||||||
content.receiverDisplayName [String] Optional |
The display name of the user that received the content. This parameter should only be set if this piece of content was a private message between two users. |
||||||||||||||||||
content.receiverId [UUID] Optional |
The Id of the user that received of the content. This parameter should only be set if this piece of content was a private message between two users. |
||||||||||||||||||
content.senderDisplayName [String] Optional |
The display name (username or whatever is displayed to other users in the game/forum) that generated the content. |
||||||||||||||||||
content.senderId [UUID] Required |
The Id of the user that generated the content. This parameter is required so that CleanSpeak can analyze and associate the content with the user that generated it. |
||||||||||||||||||
moderation [String] Optional |
Tells CleanSpeak to forcibly put the content into a queue (Approval, User Alert or Content Alert). This overrides the configuration you have setup for the Application in the Management Interface.
|
{
"content": {
"applicationId": "f81d4fae-7dec-11d0-a765-00a0c91e6bf6",
"createInstant": 1625691361999,
"location": "threadId_42",
"parts": [
{
"content": "Smurf off",
"name": "Body",
"type": "text"
}
],
"senderDisplayName": "PapaSmurf",
"senderId": "f6d3df91-ed4b-48ad-810f-05a367d328c2"
}
}
5.2. Response
Code | Description |
---|---|
200 |
The request was successful. The response will be empty. |
400 |
The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. |
401 |
You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See Authentication. |
402 |
Your license has expired. The response will be empty. Contact sales@cleanspeak.com for assistance. |
500 |
There was an internal error. A stack trace is provided and logged in the CleanSpeak log files. The response will be empty. |
5.3. Forwarded Response
This will be forwarded using a POST
method to the destination configured in the application’s proxy configuration.
content [Object] |
The piece of content being moderated. |
||||||||||||
content.id [UUID] |
The id of the piece of content. This might have been passed in on the request or generated by CleanSpeak. |
||||||||||||
content.parts [Array] |
The list of parts of content. |
||||||||||||
content.parts[x].mediaFilterResult [Object] |
An object for displaying media filter results. This is only present if the application is configured to return filter matches. |
||||||||||||
content.parts[x].mediaFilterResult.alcoholConfidence [Float] |
The confidence that the image contains alcohol imagery. |
||||||||||||
content.parts[x].mediaFilterResult.drugsConfidence [Float] |
The confidence that the image contains drug imagery. |
||||||||||||
content.parts[x].mediaFilterResult.offensiveResults[x].offensiveConfidence [Float] |
The confidence that the image contains offensive content. |
||||||||||||
content.parts[x].mediaFilterResult.offensiveResults[x].offensiveTag [String] |
The tag for the type of offensive content. |
||||||||||||
content.parts[x].mediaFilterResult.offensiveResults[x].position [Float] |
The frame that the offensive content exists on. |
||||||||||||
content.parts[x].mediaFilterResult.partialNudityConfidence [Float] |
The confidence that the image contains partial nudity. |
||||||||||||
content.parts[x].mediaFilterResult.partialNudityTag [String] |
The associated tag for the type of partial nudity. |
||||||||||||
content.parts[x].mediaFilterResult.rawNudityConfidence [Float] |
The confidence that the image contains raw nudity. |
||||||||||||
content.parts[x].mediaFilterResult.scamConfidence [Float] |
The confidence that the image is a known scammer image. |
||||||||||||
content.parts[x].mediaFilterResult.weaponConfidence [Float] |
The confidence that the image contains weapon. |
||||||||||||
content.parts[x].name [String] |
The name of the part of the content. |
||||||||||||
content.parts[x].replacement [String] |
The replacement text generated by CleanSpeak after applying the filter rules to this part. |
||||||||||||
contentAction [String] |
The action that the client should take with the content. Possible values: Content Actions
|
||||||||||||
moderationAction [String] |
The action that was taken on the content. Possible values:
|
||||||||||||
stored [Boolean] |
This value indicates if the content was stored by CleanSpeak. |
{
"content": {
"id": "99f2c4e8-961a-4a34-b9b9-43fc3f3b43ec"
},
"contentAction": "allow",
"moderationAction": "generatesAlert",
"stored": true
}
{
"content": {
"id": "99f2c4e8-961a-4a34-b9b9-43fc3f3b43ec",
"parts" : [{
"name" : "body",
"replacement" : "**** off"
}]
},
"contentAction": "replace",
"moderationAction": "generatesAlert",
"stored": true
}
6. Filter Content
This API is used to send content to CleanSpeak to be filtered. Content sent to this API is not persisted by CleanSpeak and does not use the CleanSpeak Application filter rules. To use Application filter rules and other more advanced features of CleanSpeak see Moderate Content.
This API should be avoided unless you have a very specific need to only perform filtering and want all of the filter matches back. For most situations, the Moderate Content API should be used instead. |
6.1. Request
POST /content/item/filter
POST /api/content/item/filter
blacklist [Object] Optional |
Object that defines the blacklist filter options. |
blacklist.dictionaryTags [Array<String>] Optional |
A list of dictionary tags to apply to the filter. Any tags added here will allow dictionary entries with the same tag to behave as a whitelist if there is an EXACT match on the word. |
blacklist.disabled [Boolean] Optional defaults to |
This parameter disables the blacklist filter completely. No blacklist matches will be returned and the replacement value will not contain replacements for blacklist matches. When this parameter is set to |
blacklist.ignorableCharacters [String] Optional defaults to |
Set this parameter to a list of characters the filter can skip over to find a match. Only the letters
Specifically, this feature will catch any blacklist word even if separated by a single character on this list. Example: |
blacklist.locales [Array<String>] Optional |
This parameter specifies the locales that blacklist filter matches must have in order to be included in the response. When this parameter is omitted all matches will be returned regardless of locale. See Locales. |
blacklist.minimumSeverity [String] Optional |
This parameter specifies the minimum severity that blacklist filter matches must have to be included in the response. When this parameter is omitted all matches will be returned regardless of severity. Possible values:
|
blacklist.tags [Array<String>] Optional Available since 3.12.0 |
This parameter specifies the tags that blacklist filter matches must have to be included in the response. |
content [String] Required |
The message body to be filtered. |
characters [Array<String>] Optional |
This parameter specifies the individual characters to find within the content string.
|
contentType [String] Optional defaults to |
This parameter specifies the content type. When this parameter is omitted the API will default to
Prior to version 3.19.0, the content type was auto-detected when then content type was not specified. |
emails [Object] Optional |
Object that defines the email filter options. |
emails.disabled [Boolean] Optional defaults to |
This parameter disables the email filter completely. No email matches will be returned and the replacement value will not contain replacements for email matches. When this parameter is set to |
emails.domainQuality [Array] Optional |
The list of domain quality configurations for the Email filter. Providing domain quality you may override the default behavior. CleanSpeak already adjusts domain scores of domain names that are also dictionary words such as
|
emails.domainQuality |
This parameter is the name of the domain. For example, for the |
emails.domainQuality |
This parameter sets the initial quality score for the specified domain. This value may be between |
emails.maximumMatchLength [Integer] Optional defaults to 50 |
This parameter specifies the maximum length that a match can be in order to be considered an email. If the match length is greater than the maximum match length the match will be ignored. |
emails.minimumQuality [Double] Optional |
This parameters specifies the minimum quality score that email matches must have to be included in the response and replaced in the replacement value. |
emails.spacePenalty [Double] Optional defaults to -0.05 |
This parameter specifies a penalty applied to the quality score if the match contains any spaces. For example, |
ml.disabled [Boolean] Optional defaults to |
This parameter disables the Machine Learning filter completely. When this parameter is set to |
ml.locales [Array<String>] Optional Available since 4.0.0 |
This parameter supplies which locales/languages the Machine Learning models should be utilized with. When this parameter is omitted, language auto detection is attempted. See Locales. |
ml.minimumSeverity [String] Optional Available since 4.0.0 |
This parameter specifies the minimum severity that Machine Learning matches must have to be included in the response. When this parameter is omitted all matches will be returned regardless of severity. Possible values:
|
ml.models [List<String>] Required Available since 4.0.0 |
Which ML models to pass content through. Valid options are
|
phoneNumbers [Object] Optional |
Object that defines the phone number filter options. |
phoneNumbers.disabled [Boolean] Optional defaults to |
This parameter disables the phone number filter completely. No phone number matches will be returned and the replacement value will not contain replacements for phone number matches. When this parameter is set to |
phoneNumbers.maximumMatchLength [Integer] Optional defaults to 20 |
This parameter specifies the maximum length that a match can be in order to be considered an phone number. If the match length is greater than the maximum match length the match will be ignored. |
phoneNumbers.minimumMatchLength [Integer] Optional defaults to 7 |
This parameter specifies the minimum length that a match can be in order to be considered a phone number. The default value covers most world wide phone number formats. |
phoneNumbers.minimumQuality [Double] Optional |
This parameters specifies the minimum quality score that phone number matches must have to be included in the response and replaced in the replacement value. |
phoneNumbers.separatorPenalty [Double] Optional defaults to -0.02 |
This parameter specifies a penalty that is applied to the quality score for a match if it contains any type of separator other than a dash or parenthesis. For example, |
phoneNumbers.spacePenalty [Double] Optional defaults to -0.02 |
This parameter specifies a penalty that is applied to the quality score for a match if it contains one or more spaces. For example, |
phoneNumbers.wordPenalty [Double] Optional defaults to -0.03 |
This parameter specifies a penalty that is applied to the quality score for a match if it contains any words rather than digits. For example, |
replaceChar [String] Optional defaults to * |
The character that is used during a replace operation. |
unicode [Object] Optional Available since 3.22.0 |
Object that defines the unicode filter options. |
unicode.disabled [Boolean] Optional defaults to |
This parameter disables the unicode filter completely. No unicode matches will be returned if this is set to |
unicode.ranges [List<String>] Optional defaults to a provided config Available since 3.22.0 |
The list of unicode ranges to disallow in content. Each range is a string of two json style unicode escapes separated by a dash. Be sure to escape the slash or else you will be sending a unicode character instead of an escaped unicode character code.
|
usernames [Object] Optional |
Object that defines the username filter options. |
usernames.disabled [Boolean] Optional defaults to |
This parameter disables the username filter completely. No username matches will be returned and the replacement value will not contain replacements for username matches. When this parameter is set to |
usernames.scheme [String] Required |
The username filter scheme to use during this filter request. |
urls [Object] Optional |
Object that defines the url filter options. |
urls.disabled [Boolean] Optional defaults to |
This parameter disables the url filter completely. No url matches will be returned and the replacement value will not contain replacements for url matches. When this parameter is set to |
urls.domainQuality [Array] Optional |
The list of domain quality configurations for the url filter. Providing domain quality you may override the default behavior. CleanSpeak already adjusts domain scores of domain names that are also dictionary words such as
|
urls.domainQuality |
This parameter is the name of the domain. For example, for the |
urls.domainQuality |
This parameter sets the initial quality score for the specified domain. This value may be between |
urls.maximumMatchLength [Boolean] Optional defaults to 50 |
This parameter specifies the maximum length that a match can be in order to be considered a url. If the match length is greater than the maximum match length the match will be ignored. |
urls.minimumQuality [Double] Optional |
This parameters specifies the minimum quality score that url matches must have to be included in the response and replaced in the replacement value. |
urls.spacePenalty [Double] Optional defaults to |
This parameter specifies a penalty that is applied to the quality score for a match if it contains one or more spaces. For example, |
words [Array<String>] Optional |
This parameter specifies the individual words to find within the content string. Generally words that should be filtered should be added to your blacklist. This parameter allows you to find matches without modifying your list.
|
whitelist [Boolean] Optional defaults to |
This parameter enables the Whitelist filter. This parameter is unique in that when enabled by setting this parameter to |
{
"blacklist": {
"ignorableCharacters": "qxz",
"locales": [
"en"
],
"minimumSeverity": "medium",
"tags": [
"Vulgarity",
"Sexual"
]
},
"content": "fuck A bill at test.net 332-999 eight767 abcd my address\u0000",
"characters": [
"A",
"3"
],
"contentType": "text",
"emails": {
"domainQuality": [
{
"domain": "net",
"quality": "0.8"
},
{
"domain": "xyz",
"quality": "0.1"
}
],
"maximumMatchLength": "100",
"spacePenalty": "-0.2"
},
"ml": {
"disabled": false,
"models": ["insult", "profanity"]
},
"phoneNumbers": {
"maximumMatchLength": "20",
"minimumMatchLength": "3",
"separatorPenalty": "-0.3",
"spacePenalty": "-0.1",
"wordPenalty": "-0.3"
},
"replaceChar": "x",
"unicode": {
"ranges": [
"\\u0000-\\u0001"
]
},
"urls": {
"domainQuality": [
{
"domain": "net",
"quality": "0.8"
},
{
"domain": "xyz",
"quality": "0.1"
}
],
"maximumMatchLength": "50",
"spacePenalty": "-0.2"
},
"words": [
"abcd",
"competitor"
]
}
6.2. Response
Code | Description |
---|---|
200 |
The request was successful. The response will contain a JSON body. |
400 |
The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. |
401 |
You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See Authentication. |
402 |
Your license has expired. The response will be empty. Contact sales@cleanspeak.com for assistance. |
500 |
There was an internal error. A stack trace is provided and logged in the CleanSpeak log files. The response will be empty. |
matches [Array] |
The array of matches returned by the filter request. |
||
matches.indices [Array<Integer>] Available since 3.22.0 |
A list of integer offsets of illegal unicode characters. These characters were defined on input or are part of a default configuration.
This field will only be present on a |
||
matches |
The length of the filter match. |
||
matches |
The starting index of the match into the original content string. For example, consider the following string |
||
matches |
The locale of the match. This value returned will be the ISO 639-1 two letter language code followed by an optional underscore and a ISO 3166-1 alpha-2 country code. |
||
matches |
If the match is of the type |
||
matches |
If the match is of the type |
||
matches |
The quality score of the match. Blacklist matches will always return with a value of 1.0. Email, phone numbers and URL matches will return with a value between 0.0 - 1.0. See Quality Score. |
||
matches |
If the match is of the type
|
||
matches |
The type of the match. This will correspond to the filter types that were enabled and configured in the request. Possible values are:
|
||
matches |
A list of Blacklist or Machine Learning Tags that a match contains. Machine Learning tags will be prefixed by |
||
matches |
A whitelist result status.
|
||
matches |
The array of meta matches returned by the filter request. Meta matches are returned when the Consider the following example content.
Notice this content contains a URL match inside of a BBCode attribute, this match is considered a meta match. |
||
replacement [String] |
The original message with all matches replaced by a replacement character. If a replacement character was not specified on the request the default replacement character will be used.
Assuming
|
{
"matches": [
{
"blacklistResult": "basic",
"length": 4,
"locale": "en",
"matched": "fuck",
"quality": 1.0,
"root": "fuck",
"severity": "severe",
"start": 0,
"tags": [
"Vulgarity"
],
"type": "blacklist"
},
{
"blacklistResult": "basic",
"length": 3,
"locale": "en",
"matched": "fuc",
"quality": 1.0,
"root": "fuk",
"severity": "severe",
"start": 0,
"tags": [
"Vulgarity"
],
"type": "blacklist"
},
{
"blacklistResult": "basic",
"length": 1,
"quality": 1.0,
"start": 5,
"type": "characters"
},
{
"blacklistResult": "basic",
"length": 16,
"quality": 0.8,
"start": 7,
"type": "emails"
},
{
"blacklistResult": "basic",
"length": 8,
"quality": 1.0,
"start": 15,
"type": "urls"
},
{
"blacklistResult": "basic",
"length": 16,
"quality": 0.6,
"start": 24,
"type": "phoneNumbers"
},
{
"blacklistResult": "basic",
"length": 1,
"quality": 1.0,
"start": 24,
"type": "characters"
},
{
"blacklistResult": "basic",
"length": 1,
"quality": 1.0,
"start": 25,
"type": "characters"
},
{
"blacklistResult": "basic",
"length": 4,
"quality": 1.0,
"start": 41,
"type": "words"
},
{
"locale": "en",
"quality": 1.0,
"severity": "severe",
"tags": [
"ML Profanity"
],
"type": "ml"
},
{
"indices": [
56
],
"quality": 1.0,
"type": "unicode"
}
],
"metaMatches": []
}
7. Flagging Content
This API is used to flag content that has already been sent into CleanSpeak. Flagged content will be queued for a moderator to review in the Content Alert queue.
For example, this API may be used to allow users to flag a forum post for inappropriate content or to flag reviews as containing irrelevant content.
7.1. Request
POST /content/item/flag/{contentItemId}
POST /api/content/item/flag/{contentItemId}
contentItemId [UUID] Required |
The Id of the User Content Item to be flagged. |
flag [Object] Required |
The flag object. |
flag.comment [String] Optional |
An optional description to provide additional details for the reason the content was flagged. |
flag.createInstant [Long] Required |
The instants the flag event occurred. |
flag.reason [String] Optional |
A free-form text field that can be used to indicate the reason the content was flagged.
For example, you may use reasons such as |
flag.reporterId [UUID] Required |
The Id of the reporting user. |
{
"flag": {
"comment": "this content is really not appropriate for children",
"createInstant": 1474496312000,
"reason": "pornography",
"reporterId": "91303ce2-ee40-48e7-98dc-354c051d0b78"
}
}
7.2. Response
Code | Description |
---|---|
200 |
The request was successful. The response will be empty. |
400 |
The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. |
401 |
You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See Authentication. |
402 |
Your license has expired. The response will be empty. Contact sales@cleanspeak.com for assistance. |
404 |
The object you requested doesn’t exist. The response will be empty. |
500 |
There was an internal error. A stack trace is provided and logged in the CleanSpeak log files. The response will be empty. |
8. Batch Filter Content
Available Since Version 3.6.0 |
This API is used to send multiple pieces of content to CleanSpeak to be filtered. It primarily uses the same API structure as the Filter Content API except that the content is an array instead of an object.
This API can be called synchronously or asynchronously. If the |
8.1. Request
POST /content/item/batch-filter
POST /api/content/item/batch-filter
blacklist [Object] Optional |
Object that defines the blacklist filter options. |
blacklist.disabled [Boolean] Optional defaults to |
This parameter disables the blacklist filter completely. No blacklist matches will be returned and the replacement value will not contain replacements for blacklist matches. When this parameter is set to |
blacklist.locales [Array<String>] Optional |
This parameter specifies the locales that blacklist filter matches must have in order to be included in the response. When this parameter is omitted all matches will be returned regardless of locale. See Locales. |
blacklist.minimumSeverity [String] Optional |
This parameter specifies the minimum severity that blacklist filter matches must have to be included in the response. When this parameter is omitted all matches will be returned regardless of severity. Possible values:
|
blacklist.tags [Array<String>] Optional |
This parameter specifies the tags that blacklist filter matches must have to be included in the response. |
callbackHeaders [Object] Optional |
The key-value pair Object that contains HTTP headers that are included by CleanSpeak when it sends the response to the |
callbackURL [String] Optional |
Indicates that the batch request should be processed asynchronously and that CleanSpeak should send the response to this URL. |
contentItems [Array<String>] Required |
The individual pieces of content to be filtered. |
characters [Array<String>] Optional |
This parameter specifies the individual characters to find within the content string.
|
contentType [String] Optional |
This parameter specifies the content type. When this parameter is omitted the API will attempt to identify the content as one of the supported content types. Possible values:
|
emails [Object] Optional |
Object that defines the email filter options. |
emails.disabled [Boolean] Optional defaults to |
This parameter disables the email filter completely. No email matches will be returned and the replacement value will not contain replacements for email matches. When this parameter is set to |
emails.domainQuality [Array] Optional |
The list of domain quality configurations for the Email filter. Providing domain quality you may override the default behavior. CleanSpeak already adjusts domain scores of domain names that are also dictionary words such as
|
emails.domainQuality |
This parameter is the name of the domain. For example, for the |
emails.domainQuality |
This parameter sets the initial quality score for the specified domain. This value may be between |
emails.maximumMatchLength [Integer] Optional defaults to 50 |
This parameter specifies the maximum length that a match can be in order to be considered an email. If the match length is greater than the maximum match length the match will be ignored. |
emails.minimumQuality [Double] Optional |
This parameters specifies the minimum quality score that email matches must have to be included in the response and replaced in the replacement value. |
emails.spacePenalty [Double] Optional defaults to -0.05 |
This parameter specifies a penalty applied to the quality score if the match contains any spaces. For example, |
phoneNumbers [Object] Optional |
Object that defines the phone number filter options. |
phoneNumbers.disabled [Boolean] Optional defaults to |
This parameter disables the phone number filter completely. No phone number matches will be returned and the replacement value will not contain replacements for phone number matches. When this parameter is set to |
phoneNumbers.maximumMatchLength [Integer] Optional defaults to 20 |
This parameter specifies the maximum length that a match can be in order to be considered an phone number. If the match length is greater than the maximum match length the match will be ignored. |
phoneNumbers.minimumMatchLength [Integer] Optional defaults to 7 |
This parameter specifies the minimum length that a match can be in order to be considered a phone number. The default value covers most world wide phone number formats. |
phoneNumbers.minimumQuality [Double] Optional |
This parameters specifies the minimum quality score that phone number matches must have to be included in the response and replaced in the replacement value. |
phoneNumbers.separatorPenalty [Double] Optional defaults to -0.02 |
This parameter specifies a penalty that is applied to the quality score for a match if it contains any type of separator other than a dash or parenthesis. For example, |
phoneNumbers.spacePenalty [Double] Optional defaults to -0.02 |
This parameter specifies a penalty that is applied to the quality score for a match if it contains one or more spaces. For example, |
phoneNumbers.wordPenalty [Double] Optional defaults to -0.03 |
This parameter specifies a penalty that is applied to the quality score for a match if it contains any words rather than digits. For example, |
replaceChar [Boolean] Optional defaults to * |
The character that is used during a replace operation. |
unicode [Object] Optional Available since 3.22.0 |
Object that defines the unicode filter options. |
unicode.disabled [Boolean] Optional defaults to |
This parameter disables the unicode filter completely. No unicode matches will be returned if this is set to |
unicode.ranges [List<String>] Optional defaults to a provided config Available since 3.22.0 |
The list of unicode ranges to disallow in content. Each range is a string of two json style unicode escapes separated by a dash. Be sure to escape the slash or else you will be sending a unicode character instead of an escaped unicode character code.
|
usernames [Object] Optional |
Object that defines the username filter options. |
usernames.disabled [Boolean] Optional defaults to |
This parameter disables the username filter completely. No username matches will be returned and the replacement value will not contain replacements for username matches. When this parameter is set to |
usernames.scheme [String] Required |
The username filter scheme to use during this filter request. |
urls [Object] Optional |
Object that defines the url filter options. |
urls.disabled [Boolean] Optional defaults to |
This parameter disables the url filter completely. No url matches will be returned and the replacement value will not contain replacements for url matches. When this parameter is set to |
urls.domainQuality [Array] Optional |
The list of domain quality configurations for the url filter. Providing domain quality you may override the default behavior. CleanSpeak already adjusts domain scores of domain names that are also dictionary words such as
|
urls.domainQuality |
This parameter is the name of the domain. For example, for the |
urls.domainQuality |
This parameter sets the initial quality score for the specified domain. This value may be between |
urls.maximumMatchLength [Boolean] Optional defaults to 50 |
This parameter specifies the maximum length that a match can be in order to be considered a url. If the match length is greater than the maximum match length the match will be ignored. |
urls.minimumQuality [Double] Optional |
This parameters specifies the minimum quality score that url matches must have to be included in the response and replaced in the replacement value. |
urls.spacePenalty [Double] Optional defaults to |
This parameter specifies a penalty that is applied to the quality score for a match if it contains one or more spaces. For example, |
words [Array<String>] Optional |
This parameter specifies the individual words to find within the content string. Generally words that should be filtered should be added to your blacklist. This parameter allows you to find matches without modifying your list.
|
whitelist [Boolean] Optional defaults to |
This parameter enables the Whitelist filter. This parameter is unique in that when enabled by setting this parameter to |
{
"content": [
"fuck A bill at test.net 332-999 eight767 abcd my address\u0000",
"another piece of content",
"and another piece of content"
],
"characters": [
"A",
"3"
],
"contentType": "text",
"emails": {
"domainQuality": [
{
"domain": "net",
"quality": "0.8"
},
{
"domain": "xyz",
"quality": "0.1"
}
],
"maximumMatchLength": "100",
"spacePenalty": "-0.2"
},
"phoneNumbers": {
"maximumMatchLength": "20",
"minimumMatchLength": "3",
"separatorPenalty": "-0.3",
"spacePenalty": "-0.1",
"wordPenalty": "-0.3"
},
"replaceChar": "x",
"unicode": {
"ranges": [
"\\u0000-\\u0001"
]
},
"urls": {
"domainQuality": [
{
"domain": "net",
"quality": "0.8"
},
{
"domain": "xyz",
"quality": "0.1"
}
],
"maximumMatchLength": "50",
"spacePenalty": "-0.2"
},
"words": [
"abcd",
"competitor"
]
}
8.2. Response
Code | Description |
---|---|
200 |
The request was successful. The response will contain a JSON body. |
400 |
The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. |
401 |
You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See Authentication. |
402 |
Your license has expired. The response will be empty. Contact sales@cleanspeak.com for assistance. |
500 |
There was an internal error. A stack trace is provided and logged in the CleanSpeak log files. The response will be empty. |
results [Array] |
The array of results, one for each piece of content in the request, ordered. |
results |
The array of matches returned by the filter request. |
results |
A list of integer offsets of illegal unicode characters. These characters were defined on input or are part of a default configuration.
This field will only be present on a |
results |
The length of the filter match. |
results |
The starting index of the match into the original content string. For example, consider the following string |
results |
The locale of the match. This value returned will be the ISO 639-1 two letter language code followed by an optional underscore and a ISO 3166-1 alpha-2 country code. |
results |
If the match is of the type |
results |
If the match is of the type |
results |
The quality score of the match. Blacklist matches will always return with a value of 1.0. Email, phone numbers and URL matches will return with a value between 0.0 - 1.0. See Quality Score. |
results |
If the match is of the type
|
results |
The type of the match. This will correspond to the filter types that were enabled and configured in the request. Possible values are:
|
results |
A list of Blacklist Tags that a match contains. |
results |
A whitelist result status.
|
results |
The array of meta matches returned by the filter request. Meta matches are returned when the Consider the following example content.
Notice this content contains a URL match inside of a BBCode attribute, this match is considered a meta match. |
results |
The original message with all matches replaced by a replacement character. If a replacement character was not specified on the request the default replacement character will be used.
Assuming |
{
"results": [
{
"matches": [
{
"length": 4,
"locale": "en",
"matched": "fuck",
"quality": 1.0,
"root": "fuck",
"severity": "severe",
"start": 0,
"tags": [
"Vulgarity"
],
"type": "blacklist"
},
{
"length": 1,
"quality": 1.0,
"start": 5,
"type": "characters"
},
{
"length": 16,
"quality": 0.8,
"start": 7,
"type": "emails"
},
{
"length": 8,
"quality": 1.0,
"start": 15,
"type": "urls"
},
{
"length": 16,
"quality": 0.6,
"start": 24,
"type": "phoneNumbers"
},
{
"length": 1,
"quality": 1.0,
"start": 24,
"type": "characters"
},
{
"length": 1,
"quality": 1.0,
"start": 25,
"type": "characters"
},
{
"length": 4,
"quality": 1.0,
"start": 41,
"type": "words"
},
{
"length": 7,
"locale": "en",
"matched": "adress",
"quality": 1.0,
"root": "address",
"severity": "medium",
"start": 49,
"tags": [
"PII"
],
"type": "blacklist"
},
{
"indices": [
57
],
"quality": 1.0,
"type": "unicode"
}
],
"replacement": "xxxx x xxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxx xxxx my xxxxxxx"
},
{
"replacement": "another piece of content"
},
{
"replacement": "and another piece of content"
}
]
}
9. Batch Moderate Content
Available Since Version 3.6.0 |
This API is used to send multiple pieces of content to CleanSpeak to be moderated. It primarily uses the same API structure as the Moderate Content and Update Content APIs with a few differences:
-
For persistent content, the id of each piece of content is in the request rather than on the URL
-
For transient content, the results come back in the response in the same as they were passed into the request
-
The
moderation
parameter in the request is applied to each piece of content
This API can be called synchronously or asynchronously. If the |
9.1. Request
For new content, you must use the POST request:
POST /content/item/batch-moderate
POST /api/content/item/batch-moderate
For updating content, you must use the PUT request:
PUT /content/item/batch-moderate
PUT /api/content/item/batch-moderate
callbackHeaders [Object] Optional |
The key-value pair Object that contains HTTP headers that are included by CleanSpeak when it sends the response to the |
||||||||||||||||||
callbackURL [String] Optional |
Indicates that the batch request should be processed asynchronously and that CleanSpeak should send the response to this URL. |
||||||||||||||||||
contentItems [Array] Required |
The list of the content being moderated. |
||||||||||||||||||
contentItems |
The Id of the application that corresponds to the content source. |
||||||||||||||||||
contentItems |
The instant that the content was generated. |
||||||||||||||||||
contentItems |
The Id for the piece of content (only required if the application for this piece of content is configured to moderate persistent content). |
||||||||||||||||||
contentItems |
Specifies the location within the application that the content was generated. For example, you might use a chat room name, area Id for a game, or a thread Id for a forum. This parameter is used by CleanSpeak to display conversational views of content with the Context View feature. |
||||||||||||||||||
contentItems |
An array that contains one to many content parts. If your content only has a single part, such as a chat message, the array will only contain a single text entry. The reason you would send in multiple content parts within a single request is to ensure the moderation decision affects each part. For example, you may send in an image for moderation, the image has a title and a description field. You would send this to CleanSpeak with three content parts, the image and two text parts. If the content of the image title is rejected the entire content needs to be rejected wholesale, the title, description and the image. In this case it would make sense to treat all three parts as an atomic unit of content. If individual content parts are not related and can be rejected or approved separately then you should send them to CleanSpeak as separate requests. |
||||||||||||||||||
contentItems |
The content to be filtered. The content type will indicate what type of content is expected in this parameter. Content Types
|
||||||||||||||||||
contentItems |
The name of the content part. This value is optional an intended to better identify the context when you have more than one content part. For example this could be Title, Message Body or Image. |
||||||||||||||||||
contentItems |
The type of this content part. Possible values:
|
||||||||||||||||||
contentItems |
The display name of the user that received the content. This parameter should only be set if this piece of content was a private message between two users. |
||||||||||||||||||
contentItems |
The Id of the user that received of the content. This parameter should only be set if this piece of content was a private message between two users. |
||||||||||||||||||
contentItems |
The display name (username or whatever is displayed to other users in the game/forum) that generated the content. |
||||||||||||||||||
contentItems |
The Id of the user that generated the content. This parameter is required so that CleanSpeak can analyze and associate the content with the user that generated it. |
||||||||||||||||||
moderation [String] Optional |
Tells CleanSpeak to forcibly put all the content into a queue (Approval, User Alert or Content Alert). This overrides the configuration you have setup for the Application in the Management Interface.
|
{
"contentItems": [
{
"applicationId": "f81d4fae-7dec-11d0-a765-00a0c91e6bf6",
"createInstant": 1625691361999,
"location": "threadId_42",
"parts": [
{
"content": "Hi",
"name": "Body",
"type": "text"
}
],
"senderDisplayName": "PapaSmurf",
"senderId": "f6d3df91-ed4b-48ad-810f-05a367d328c2"
},
{
"applicationId": "f81d4fae-7dec-11d0-a765-00a0c91e6bf6",
"createInstant": 1625691362012,
"location": "threadId_42",
"parts": [
{
"content": "Smurf off",
"name": "Body",
"type": "text"
}
],
"senderDisplayName": "PapaSmurf",
"senderId": "f6d3df91-ed4b-48ad-810f-05a367d328c2"
}
]
}
9.2. Response
Code | Description |
---|---|
200 |
The request was successful. The response will contain a JSON body. |
400 |
The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. |
401 |
You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See Authentication. |
402 |
Your license has expired. The response will be empty. Contact sales@cleanspeak.com for assistance. |
500 |
There was an internal error. A stack trace is provided and logged in the CleanSpeak log files. The response will be empty. |
results [Array] |
The results for each piece of content that was moderated. |
||||||||||||
results |
The id of the piece of content. This might have been passed in on the request or generated by CleanSpeak. |
||||||||||||
results |
The list of parts of content. |
||||||||||||
results |
The name of the part of the content. |
||||||||||||
results |
The replacement text generated by CleanSpeak after applying the filter rules to this part. |
||||||||||||
results |
The action that the client should take with the content. Possible values: Content Actions
|
||||||||||||
results |
The action that was taken on the content. Possible values:
|
||||||||||||
results |
This value indicates if the content was stored by CleanSpeak. |
{
"results": [
{
"content": {
"id": "99f2c4e8-961a-4a34-b9b9-43fc3f3b43ec"
},
"contentAction": "allow",
"moderationAction": "generatesAlert",
"stored": true
},
{
"content": {
"id": "99f2c4e8-961a-4a34-b9b9-43fc3f3b43ed",
"parts": [
{
"name": "body",
"replacement": "**** off"
}
]
},
"contentAction": "replace",
"moderationAction": "generatesAlert",
"stored": true
}
]
}