Skip to content

Remove Redis Keys API – Bulk Delete Keys & Invalidate Cache in API Maker

Overview

The Remove Redis Key(s) API lets you delete single or multiple Redis keys with one request—perfect for cache invalidation, ending sessions, or removing temporary data in API Maker.

API Endpoint

POST /api/system-api/{user-path}/remove-redis-key
Content-Type: application/json

Parameters Explained

Field Type Required Description
keys string or array Yes Redis keys to be deleted

Step-by-Step Integration Example

  1. Identify stale/session/cache keys to be removed.

  2. Call the removeRedisKeys API with the key list.

  3. Confirm success via the API response or Redis monitoring tools.

  4. Optionally re-populate cache using setRedisKey.

Example Requests Body Payload

Delete a single key:

{
    "keys": "session_user123"
}

Delete multiple keys:

{
    "keys": [
        "Key_Name_1",
        "Key_Name_2"
    ]
}

Example Success Response

Success:

{
    "success": true,
    "statusCode": 200,
    "data": true
}

Example Usage in Scripts

For Single Key:

await g.sys.cache.removeKey("Key_Name_1");

For Multiple Keys:

await g.sys.cache.removeKey(["Key_Name_1", "Key_Name_2"]);

Bulk Delete and Performance Notes

  • For huge key sets, split deletes into batches (recommended ≤1,000 keys per call).

  • Non-existent keys are skipped without error.

  • Wildcards are not supported to avoid accidental or unintentional deletion of any redis content.

Best Practices

  • Use arrays to remove multiple keys in one call.

  • Use consistent key naming conventions for easy updates and deletions.

  • Pair with getRedisKey and setRedisKey for better cache lifecycle management.

  • Use hooks to automatically clear cache after updates.

  • Review API Maker logs to debug deletion issues.

Debugging Tips

  • Verify your Redis connection settings in API Maker.

  • Ensure key names exactly match.

  • Check Redis cluster configuration if using a distributed setup.

  • Use API Maker logs to trace deletion requests.


FAQ

Q: What if the key doesn’t exist?
A: No error—such keys are simply skipped.

Q: Can I delete thousands of keys at once?
A: Yes, but batch large sets to optimize performance.

Q: Can it be used in workflows?
A: Yes, it’s fully supported in API Maker workflows and custom APIs.