Custom Index (Remove)

Sync Request

POST https://api.hivemoderation.com/api/v1/custom_index/{custom_index_id}/remove/sync

Sends a request to remove an item from the specified custom index. The synchronous endpoint keeps the HTTP request open until the request completes, then sends the results directly in the response message.


Example Request

curl -X POST https://api.hivemoderation.com/api/v1/custom_index/{custom_index_id}/remove/sync \
  -H "Authorization: token <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "custom_index_item_id": "5RgNW8ZGUQxn5Pgklh3AhV_828bc2f3-a604-4856-bd2f-e8fec93b7a25_121_350fc92b8db1062fddcfafaaa0d12493615c31a71089d3104ccd06686961e9cb"
  }'

Headers

HeaderTypeRequiredDescription
AuthorizationStringYesAPI key from Hive Moderation Dashboard (per-application).
Content-TypeStringYesSubmit JSON data in the request body.

Request Body Parameters

Parameter (* required)TypeDescription
custom_index_id *StringID of the custom index to add the item to. This value should go in the URL path.
custom_index_item_id *StringPublicly accessible URL for the media to be sent.

Sync Response

Response Fields

FieldTypeAlways ReturnedDescription
task_idStringYesTask ID for the add request.
custom_index_item_idStringYesID for the custom index item created.
messageStringYesStatus message.

Example Responses

Example Success (200 OK)

{
  "task_id": "db416d21-3924-11f1-9b98-05973c9d24f9",
  "custom_index_item_id": "2bM21a29PFBc9vB5xxKoHL_e2aa8d0b-9ff1-4f57-88e9-3fc3e748623e_2_e30523ae589f61d9bea4d6b2da969373a8e8ac3af67312fb90f51e2f5da2086e",
  "message": "Media successfully removed from the index"
}

Example Error Response (400 Bad Request)

{
  "error": true,
  "status": 400,
  "error_code": "INVALID_CUSTOM_INDEX_ITEM",
  "message": "This Custom Index Item (2bM21a29PFBc9vB5xxKoHL_e2aa8d0b-9ff1-4f57-88e9-3fc3e748623e_3_60e622f9ab7e9f9a5de2afe344ff0d98502b488dfecd9b8c0ba7b7390cda8ad3) does not exist",
  "show_alert": false
}

Async Request

POST https://api.hivemoderation.com/api/v1/custom_index/{custom_index_id}/remove/async

Removes an item from a custom index. The asynchronous endpoint immediately sends a response acknowledging receipt of the request, along with a unique task_id. It then closes the connection. Once the task is completed, Hive will send a POST request to the provided callback_url containing the completed task's results.


Example Request

curl -X POST https://api.hivemoderation.com/api/v1/custom_index/{custom_index_id}/remove/async \
  -H "Authorization: token <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "custom_index_item_id": "5RgNW8ZGUQxn5Pgklh3AhV_828bc2f3-a604-4856-bd2f-e8fec93b7a25_121_350fc92b8db1062fddcfafaaa0d12493615c31a71089d3104ccd06686961e9cb",
    "callback_url": "my-callback-url.com"
  }'

Headers

HeaderTypeRequiredDescription
AuthorizationStringYesAPI key from Hive Moderation Dashboard (per-application).
Content-TypeStringYesSubmit JSON data in the request body.

Request Body Parameters

The async endpoint has all the same parameters as the sync endpoint, plus the following:

ParameterTypeRequiredDescription
callback_urlStringNoURL to receive callback when task completes.

Async Response

An async request will immediately return a response to the user. This will be a response to let the user know that the request has been received (or if an error occurred). After the async task is completed, another response will be sent to the callback_url provided in the initial request. This response will be identical to the sync task's response, which will indicate details about the custom index item id, task id, and API response message.


Response Fields

FieldTypeAlways ReturnedDescription
task_idStringYesTask ID for the add request.
custom_index_item_idStringYesID of the custom index item.
messageStringYesStatus message.

Example Responses

Example Success (200 OK)

{
  "task_id": "bb5bfd91-3924-11f1-9437-2b2a3631b20e",
  "custom_index_item_id": "2bM21a29PFBc9vB5xxKoHL_e2aa8d0b-9ff1-4f57-88e9-3fc3e748623e_3_60e622f9ab7e9f9a5de2afe344ff0d98502b488dfecd9b8c0ba7b7390cda8ad3",
  "message": "We received your task (remove item from index)."
}

Example Error Response (400 Bad Request)

{
  "error": true,
  "status": 400,
  "error_code": "PARAM_REQUIRED",
  "message": "custom_index_item_id is required.",
  "show_alert": false
}

Common Errors

Status CodeBehavior
400Missing required parameter or invalid index ID.
500Unable to remove custom index.