API Reference - Universal Search Cache

Link: https://support.brilliantdirectories.com/support/solutions/articles/12000108127

← Back to API Reference | Getting Started

Universal Search Cache

The Universal Search Cache table stores temporary results from admin-side universal search queries, keyed by a hash of the search parameters, admin ID, and website ID. Cache entries expire after a set duration and are used to improve performance for repeated searches within an admin session. This is an internal system cache table with limited API exposure.

Model name in URL: universal_search_cache — DB table: universal_search_cache
Limited API availability: Only POST /api/v2/universal_search_cache/create and DELETE /api/v2/universal_search_cache/delete are functional. The GET /api/v2/universal_search_cache/get, GET /api/v2/universal_search_cache/get/{cache_id}, and PUT /api/v2/universal_search_cache/update endpoints listed in the API key permissions UI return HTTP 400 errors and are not currently supported. Use this model only when programmatically creating or removing cache entries; reads must be performed directly against the database table.

Create a Universal Search Cache Record

POST /api/v2/universal_search_cache/create

Inserts a new cache record. The cache_id, search_query, admin_id, and website_id fields are required because the primary key is a varchar (not auto-incrementing) and the table has NOT NULL constraints on these columns.

Required Fields

ParameterTypeDescription
cache_idstringRequired — unique cache key (typically an MD5 hash)
search_querystringRequired — the search query string
admin_idstringRequired — admin user identifier
website_idstringRequired — website identifier

Example Request

Copy
curl -X POST "https://www.yourdomain.com/api/v2/universal_search_cache/create" \
  -H "X-Api-Key: your-api-key-here" \
  -d "cache_id=a1b2c3d4e5f6" \
  -d "search_query=plumber+los+angeles" \
  -d "admin_id=1" \
  -d "website_id=12345"

Example Response

Copy
{
  "status": "success",
  "message": {
    "cache_id": "a1b2c3d4e5f6",
    "search_query": "plumber los angeles",
    "results_json": "{}",
    "admin_id": "1",
    "website_id": "12345",
    "expires_date": "2026-05-28 00:50:55",
    "created_date": "2026-05-27 19:50:55"
  }
}

Delete a Universal Search Cache Record

DELETE /api/v2/universal_search_cache/delete

Removes a cache record. The cache_id is required.

Example Request

Copy
curl -X DELETE "https://www.yourdomain.com/api/v2/universal_search_cache/delete" \
  -H "X-Api-Key: your-api-key-here" \
  -d "cache_id=a1b2c3d4e5f6"

Example Response

Copy
{
  "status": "success",
  "message": "universal_search_cache record was deleted"
}

The Universal Search Cache Object

FieldTypeDescription
cache_idstringMD5 hash used as the cache key (primary key component); max 32 characters
search_querystringThe search query string that generated this cache entry; max 500 characters
results_jsontextJSON-encoded search results stored in the cache
admin_idstringIdentifier of the admin user who performed the search (primary key component); max 50 characters
website_idstringWebsite ID the search was performed on (primary key component); max 50 characters
expires_datedatetimeDatetime when this cache entry expires and becomes invalid
created_datetimestampDatetime when this cache entry was created (auto-set on insert)