# V2 # Queries ## Get queries `client.brandProtection.v2.queries.get(QueryGetParamsparams, RequestOptionsoptions?): QueryGetResponse` **get** `/accounts/{account_id}/cloudforce-one/v2/brand-protection/domain/queries` Get all saved brand protection queries for an account ### Parameters - `params: QueryGetParams` - `account_id: string` Path param - `id?: string` Query param ### Returns - `QueryGetResponse = Array` - `created: string` - `parameters: Parameters | null` - `string_matches: Array` - `max_edit_distance: number` - `pattern: string` - `max_time?: string` - `min_time?: string` - `query_id: number` - `query_tag: string` - `scan: boolean` - `updated: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const queries = await client.brandProtection.v2.queries.get({ account_id: 'x' }); console.log(queries); ``` #### Response ```json [ { "created": "created", "parameters": { "string_matches": [ { "max_edit_distance": 0, "pattern": "x" } ], "max_time": "max_time", "min_time": "min_time" }, "query_id": 0, "query_tag": "query_tag", "scan": true, "updated": "updated" } ] ``` ## Domain Types ### Query Get Response - `QueryGetResponse = Array` - `created: string` - `parameters: Parameters | null` - `string_matches: Array` - `max_edit_distance: number` - `pattern: string` - `max_time?: string` - `min_time?: string` - `query_id: number` - `query_tag: string` - `scan: boolean` - `updated: string` # Matches ## List saved query matches `client.brandProtection.v2.matches.get(MatchGetParamsparams, RequestOptionsoptions?): MatchGetResponse` **get** `/accounts/{account_id}/cloudforce-one/v2/brand-protection/domain/matches` Get paginated list of domain matches for a specific brand protection query ### Parameters - `params: MatchGetParams` - `account_id: string` Path param - `query_id: string` Query param - `include_dismissed?: string` Query param - `include_domain_id?: string` Query param - `limit?: string` Query param - `offset?: string` Query param - `order?: "asc" | "desc"` Query param: Sort order. Options: 'asc' (ascending) or 'desc' (descending) - `"asc"` - `"desc"` - `orderBy?: "domain" | "first_seen"` Query param: Column to sort by. Options: 'domain' or 'first_seen' - `"domain"` - `"first_seen"` ### Returns - `MatchGetResponse` - `matches: Array` - `dismissed: boolean` - `domain: string` - `first_seen: string` - `public_scans: PublicScans | null` - `submission_id: string` - `scan_status: string` - `scan_submission_id: number | null` - `source: string | null` - `total: number` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const match = await client.brandProtection.v2.matches.get({ account_id: 'x', query_id: 'x' }); console.log(match.matches); ``` #### Response ```json { "matches": [ { "dismissed": true, "domain": "domain", "first_seen": "first_seen", "public_scans": { "submission_id": "submission_id" }, "scan_status": "scan_status", "scan_submission_id": 0, "source": "source" } ], "total": 0 } ``` ## Domain Types ### Match Get Response - `MatchGetResponse` - `matches: Array` - `dismissed: boolean` - `domain: string` - `first_seen: string` - `public_scans: PublicScans | null` - `submission_id: string` - `scan_status: string` - `scan_submission_id: number | null` - `source: string | null` - `total: number` # Logos ## Insert logo query `client.brandProtection.v2.logos.create(LogoCreateParamsparams, RequestOptionsoptions?): LogoCreateResponse` **post** `/accounts/{account_id}/cloudforce-one/v2/brand-protection/logo/queries` Create a new saved brand protection logo query for visual similarity matching ### Parameters - `params: LogoCreateParams` - `account_id: string` Path param - `image_data: string` Body param: Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string. - `similarity_threshold: number` Body param: Minimum similarity score (0-1) required for visual matches - `tag: string` Body param: Unique identifier for the logo query - `search_lookback?: boolean` Body param: If true, search historic scanned images for matches above the similarity threshold ### Returns - `LogoCreateResponse` - `message: string` - `success: boolean` - `query_id?: number` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const logo = await client.brandProtection.v2.logos.create({ account_id: 'x', image_data: 'x', similarity_threshold: 0, tag: 'x', }); console.log(logo.query_id); ``` #### Response ```json { "message": "message", "success": true, "query_id": 0 } ``` ## Delete logo query `client.brandProtection.v2.logos.delete(stringqueryId, LogoDeleteParamsparams, RequestOptionsoptions?): LogoDeleteResponse` **delete** `/accounts/{account_id}/cloudforce-one/v2/brand-protection/logo/queries/{query_id}` Delete a saved brand protection logo query. Returns 404 if the query ID doesn't exist. ### Parameters - `queryId: string` - `params: LogoDeleteParams` - `account_id: string` ### Returns - `LogoDeleteResponse` - `message: string` - `success: boolean` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const logo = await client.brandProtection.v2.logos.delete('x', { account_id: 'x' }); console.log(logo.message); ``` #### Response ```json { "message": "message", "success": true } ``` ## Get logo queries `client.brandProtection.v2.logos.get(LogoGetParamsparams, RequestOptionsoptions?): LogoGetResponse` **get** `/accounts/{account_id}/cloudforce-one/v2/brand-protection/logo/queries` Get all saved brand protection logo queries for an account. Optionally specify id to get a single query. Set download=true to include base64-encoded image data. ### Parameters - `params: LogoGetParams` - `account_id: string` Path param - `id?: string` Query param: Optional query ID to retrieve a specific logo query - `download?: string` Query param: If true, include base64-encoded image data in the response ### Returns - `LogoGetResponse = Array` - `id: number` - `r2_path: string` - `similarity_threshold: number` - `tag: string` - `uploaded_at: string | null` - `content_type?: string` MIME type of the image (only present when download=true) - `image_data?: string` Base64-encoded image data (only present when download=true) ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const logos = await client.brandProtection.v2.logos.get({ account_id: 'x' }); console.log(logos); ``` #### Response ```json [ { "id": 0, "r2_path": "r2_path", "similarity_threshold": 0, "tag": "tag", "uploaded_at": "uploaded_at", "content_type": "content_type", "image_data": "image_data" } ] ``` ## Domain Types ### Logo Create Response - `LogoCreateResponse` - `message: string` - `success: boolean` - `query_id?: number` ### Logo Delete Response - `LogoDeleteResponse` - `message: string` - `success: boolean` ### Logo Get Response - `LogoGetResponse = Array` - `id: number` - `r2_path: string` - `similarity_threshold: number` - `tag: string` - `uploaded_at: string | null` - `content_type?: string` MIME type of the image (only present when download=true) - `image_data?: string` Base64-encoded image data (only present when download=true) # Logo Matches ## List logo matches `client.brandProtection.v2.logoMatches.get(LogoMatchGetParamsparams, RequestOptionsoptions?): LogoMatchGetResponse` **get** `/accounts/{account_id}/cloudforce-one/v2/brand-protection/logo/matches` Get paginated list of logo matches for a specific brand protection logo query ### Parameters - `params: LogoMatchGetParams` - `account_id: string` Path param - `query_id: string` Query param - `download?: string` Query param - `limit?: string` Query param - `offset?: string` Query param - `order?: "asc" | "desc"` Query param: Sort order. Options: 'asc' (ascending) or 'desc' (descending) - `"asc"` - `"desc"` - `orderBy?: "matchedAt" | "domain" | "similarityScore"` Query param: Column to sort by. Options: 'matchedAt', 'domain', or 'similarityScore' - `"matchedAt"` - `"domain"` - `"similarityScore"` ### Returns - `LogoMatchGetResponse` - `matches: Array` - `id: number` - `matched_at: string | null` - `query_id: number` - `similarity_score: number` - `url_scan_id: string | null` - `content_type?: string` - `domain?: string | null` - `image_data?: string` - `total: number` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const logoMatch = await client.brandProtection.v2.logoMatches.get({ account_id: 'x', query_id: 'x', }); console.log(logoMatch.matches); ``` #### Response ```json { "matches": [ { "id": 0, "matched_at": "matched_at", "query_id": 0, "similarity_score": 0, "url_scan_id": "url_scan_id", "content_type": "content_type", "domain": "domain", "image_data": "image_data" } ], "total": 0 } ``` ## Domain Types ### Logo Match Get Response - `LogoMatchGetResponse` - `matches: Array` - `id: number` - `matched_at: string | null` - `query_id: number` - `similarity_score: number` - `url_scan_id: string | null` - `content_type?: string` - `domain?: string | null` - `image_data?: string` - `total: number`