# Brand Protection ## Create new URL submissions `client.brandProtection.submit(BrandProtectionSubmitParamsparams, RequestOptionsoptions?): BrandProtectionSubmitResponse` **post** `/accounts/{account_id}/brand-protection/submit` Return new URL submissions ### Parameters - `params: BrandProtectionSubmitParams` - `account_id: string` ### Returns - `BrandProtectionSubmitResponse` - `skipped_urls?: Array>` - `submitted_urls?: Array>` ### 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 response = await client.brandProtection.submit({ account_id: 'x' }); console.log(response.skipped_urls); ``` #### Response ```json { "skipped_urls": [ { "foo": "bar" } ], "submitted_urls": [ { "foo": "bar" } ] } ``` ## Read submitted URLs by ID `client.brandProtection.urlInfo(BrandProtectionURLInfoParamsparams, RequestOptionsoptions?): SinglePage` **get** `/accounts/{account_id}/brand-protection/url-info` Return submitted URLs based on ID ### Parameters - `params: BrandProtectionURLInfoParams` - `account_id: string` ### Returns - `BrandProtectionURLInfoResponse = Record` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const brandProtectionURLInfoResponse of client.brandProtection.urlInfo({ account_id: 'x', })) { console.log(brandProtectionURLInfoResponse); } ``` #### Response ```json { "result": [ { "foo": "bar" } ] } ``` ## Domain Types ### Info - `Info` - `categorizations?: Array` List of categorizations applied to this submission. - `category?: string` Name of the category applied. - `verification_status?: string` Result of human review for this categorization. - `model_results?: Array` List of model results for completed scans. - `model_name?: string` Name of the model. - `model_score?: number` This is the score that is outputted by the model for this submission. - `rule_matches?: Array` List of signatures that matched against site content found when crawling the URL. - `banning?: boolean` For internal use. - `blocking?: boolean` For internal use. - `description?: string` Description of the signature that matched. - `name?: string` Name of the signature that matched. - `scan_status?: ScanStatus` Status of the most recent scan found. - `last_processed?: string` Timestamp of when the submission was processed. - `scan_complete?: boolean` For internal use. - `status_code?: number` Status code that the crawler received when loading the submitted URL. - `submission_id?: number` ID of the most recent submission. - `screenshot_download_signature?: string` For internal use. - `screenshot_path?: string` For internal use. - `url?: string` URL that was submitted. ### Submit - `Submit` - `excluded_urls?: Array` URLs that were excluded from scanning because their domain is in our no-scan list. - `url?: string` URL that was excluded. - `skipped_urls?: Array` URLs that were skipped because the same URL is currently being scanned. - `url?: string` URL that was skipped. - `url_id?: number` ID of the submission of that URL that is currently scanning. - `submitted_urls?: Array` URLs that were successfully submitted for scanning. - `url?: string` URL that was submitted. - `url_id?: number` ID assigned to this URL submission. Used to retrieve scanning results. ### Brand Protection Submit Response - `BrandProtectionSubmitResponse` - `skipped_urls?: Array>` - `submitted_urls?: Array>` ### Brand Protection URL Info Response - `BrandProtectionURLInfoResponse = Record` # Queries ## Create new saved string queries `client.brandProtection.queries.create(QueryCreateParamsparams, RequestOptionsoptions?): void` **post** `/accounts/{account_id}/brand-protection/queries` Return a success message after creating new saved string queries ### Parameters - `params: QueryCreateParams` - `account_id: string` Path param - `id?: string` Query param - `body_scan?: boolean` Body param - `body_tag?: string` Body param - `max_time?: string | null` Body param - `min_time?: string | null` Body param - `string_matches?: unknown` Body param ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); await client.brandProtection.queries.create({ account_id: 'x' }); ``` ## Delete saved string queries by ID `client.brandProtection.queries.delete(QueryDeleteParamsparams, RequestOptionsoptions?): void` **delete** `/accounts/{account_id}/brand-protection/queries` Return a success message after deleting saved string queries by ID ### Parameters - `params: QueryDeleteParams` - `account_id: string` Path param - `id?: string` Query param - `scan?: boolean` Query param - `tag?: string` Query param ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); await client.brandProtection.queries.delete({ account_id: 'x' }); ``` ## Create new saved string queries in bulk `client.brandProtection.queries.bulk(QueryBulkParamsparams, RequestOptionsoptions?): void` **post** `/accounts/{account_id}/brand-protection/queries/bulk` Return a success message after creating new saved string queries in bulk ### Parameters - `params: QueryBulkParams` - `account_id: string` Path param - `queries?: Array>` Body param ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); await client.brandProtection.queries.bulk({ account_id: 'x' }); ``` # Matches ## Read matches for string queries by ID `client.brandProtection.matches.get(MatchGetParamsparams, RequestOptionsoptions?): MatchGetResponse` **get** `/accounts/{account_id}/brand-protection/matches` Return matches for string queries based on ID ### Parameters - `params: MatchGetParams` - `account_id: string` Path param - `id?: string` Query param - `include_domain_id?: boolean` Query param - `limit?: number` Query param - `offset?: number` Query param ### Returns - `MatchGetResponse` - `matches?: Array>` - `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.matches.get({ account_id: 'x' }); console.log(match.matches); ``` #### Response ```json { "matches": [ { "foo": "bar" } ], "total": 0 } ``` ## Download matches for string queries by ID `client.brandProtection.matches.download(MatchDownloadParamsparams, RequestOptionsoptions?): MatchDownloadResponse` **get** `/accounts/{account_id}/brand-protection/matches/download` Return matches as CSV for string queries based on ID ### Parameters - `params: MatchDownloadParams` - `account_id: string` Path param - `id?: string` Query param - `include_domain_id?: boolean` Query param - `limit?: number` Query param - `offset?: number` Query param ### Returns - `MatchDownloadResponse` - `matches?: Array>` - `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 response = await client.brandProtection.matches.download({ account_id: 'x' }); console.log(response.matches); ``` #### Response ```json { "matches": [ { "foo": "bar" } ], "total": 0 } ``` ## Domain Types ### Match Get Response - `MatchGetResponse` - `matches?: Array>` - `total?: number` ### Match Download Response - `MatchDownloadResponse` - `matches?: Array>` - `total?: number` # Logos ## Create new saved logo queries from image files `client.brandProtection.logos.create(LogoCreateParamsparams, RequestOptionsoptions?): LogoCreateResponse` **post** `/accounts/{account_id}/brand-protection/logos` Return new saved logo queries created from image files ### Parameters - `params: LogoCreateParams` - `account_id: string` Path param - `match_type?: string` Query param - `tag?: string` Query param - `threshold?: number` Query param - `image?: Uploadable` Body param ### Returns - `LogoCreateResponse` - `id?: number` - `tag?: string` - `upload_path?: 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 logo = await client.brandProtection.logos.create({ account_id: 'x' }); console.log(logo.id); ``` #### Response ```json { "id": 0, "tag": "tag", "upload_path": "upload_path" } ``` ## Delete saved logo queries by ID `client.brandProtection.logos.delete(stringlogoId, LogoDeleteParamsparams, RequestOptionsoptions?): void` **delete** `/accounts/{account_id}/brand-protection/logos/{logo_id}` Return a success message after deleting saved logo queries by ID ### Parameters - `logoId: string` - `params: LogoDeleteParams` - `account_id: 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 }); await client.brandProtection.logos.delete('x', { account_id: 'x' }); ``` ## Domain Types ### Logo Create Response - `LogoCreateResponse` - `id?: number` - `tag?: string` - `upload_path?: string` # Logo Matches ## Read matches for logo queries by ID `client.brandProtection.logoMatches.get(LogoMatchGetParamsparams, RequestOptionsoptions?): LogoMatchGetResponse` **get** `/accounts/{account_id}/brand-protection/logo-matches` Return matches for logo queries based on ID ### Parameters - `params: LogoMatchGetParams` - `account_id: string` Path param - `limit?: string` Query param - `logo_id?: Array` Query param - `offset?: string` Query param ### Returns - `LogoMatchGetResponse` - `matches?: Array>` - `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.logoMatches.get({ account_id: 'x' }); console.log(logoMatch.matches); ``` #### Response ```json { "matches": [ { "foo": "bar" } ], "total": 0 } ``` ## Download matches for logo queries by ID `client.brandProtection.logoMatches.download(LogoMatchDownloadParamsparams, RequestOptionsoptions?): LogoMatchDownloadResponse` **get** `/accounts/{account_id}/brand-protection/logo-matches/download` Return matches as CSV for logo queries based on ID ### Parameters - `params: LogoMatchDownloadParams` - `account_id: string` Path param - `limit?: string` Query param - `logo_id?: Array` Query param - `offset?: string` Query param ### Returns - `LogoMatchDownloadResponse` - `matches?: Array>` - `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 response = await client.brandProtection.logoMatches.download({ account_id: 'x' }); console.log(response.matches); ``` #### Response ```json { "matches": [ { "foo": "bar" } ], "total": 0 } ``` ## Domain Types ### Logo Match Get Response - `LogoMatchGetResponse` - `matches?: Array>` - `total?: number` ### Logo Match Download Response - `LogoMatchDownloadResponse` - `matches?: Array>` - `total?: number` # 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`