# Brand Protection ## Create new URL submissions `brand_protection.submit(BrandProtectionSubmitParams**kwargs) -> BrandProtectionSubmitResponse` **post** `/accounts/{account_id}/brand-protection/submit` Return new URL submissions ### Parameters - `account_id: str` ### Returns - `class BrandProtectionSubmitResponse: …` - `skipped_urls: Optional[List[Dict[str, object]]]` - `submitted_urls: Optional[List[Dict[str, object]]]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.brand_protection.submit( account_id="x", ) print(response.skipped_urls) ``` #### Response ```json { "skipped_urls": [ { "foo": "bar" } ], "submitted_urls": [ { "foo": "bar" } ] } ``` ## Read submitted URLs by ID `brand_protection.url_info(BrandProtectionURLInfoParams**kwargs) -> SyncSinglePage[BrandProtectionURLInfoResponse]` **get** `/accounts/{account_id}/brand-protection/url-info` Return submitted URLs based on ID ### Parameters - `account_id: str` ### Returns - `Dict[str, object]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.brand_protection.url_info( account_id="x", ) page = page.result[0] print(page) ``` #### Response ```json { "result": [ { "foo": "bar" } ] } ``` ## Domain Types ### Info - `class Info: …` - `categorizations: Optional[List[Categorization]]` List of categorizations applied to this submission. - `category: Optional[str]` Name of the category applied. - `verification_status: Optional[str]` Result of human review for this categorization. - `model_results: Optional[List[ModelResult]]` List of model results for completed scans. - `model_name: Optional[str]` Name of the model. - `model_score: Optional[float]` This is the score that is outputted by the model for this submission. - `rule_matches: Optional[List[RuleMatch]]` List of signatures that matched against site content found when crawling the URL. - `banning: Optional[bool]` For internal use. - `blocking: Optional[bool]` For internal use. - `description: Optional[str]` Description of the signature that matched. - `name: Optional[str]` Name of the signature that matched. - `scan_status: Optional[ScanStatus]` Status of the most recent scan found. - `last_processed: Optional[str]` Timestamp of when the submission was processed. - `scan_complete: Optional[bool]` For internal use. - `status_code: Optional[int]` Status code that the crawler received when loading the submitted URL. - `submission_id: Optional[int]` ID of the most recent submission. - `screenshot_download_signature: Optional[str]` For internal use. - `screenshot_path: Optional[str]` For internal use. - `url: Optional[str]` URL that was submitted. ### Submit - `class Submit: …` - `excluded_urls: Optional[List[ExcludedURL]]` URLs that were excluded from scanning because their domain is in our no-scan list. - `url: Optional[str]` URL that was excluded. - `skipped_urls: Optional[List[SkippedURL]]` URLs that were skipped because the same URL is currently being scanned. - `url: Optional[str]` URL that was skipped. - `url_id: Optional[int]` ID of the submission of that URL that is currently scanning. - `submitted_urls: Optional[List[SubmittedURL]]` URLs that were successfully submitted for scanning. - `url: Optional[str]` URL that was submitted. - `url_id: Optional[int]` ID assigned to this URL submission. Used to retrieve scanning results. ### Brand Protection Submit Response - `class BrandProtectionSubmitResponse: …` - `skipped_urls: Optional[List[Dict[str, object]]]` - `submitted_urls: Optional[List[Dict[str, object]]]` ### Brand Protection URL Info Response - `Dict[str, object]` # Queries ## Create new saved string queries `brand_protection.queries.create(QueryCreateParams**kwargs)` **post** `/accounts/{account_id}/brand-protection/queries` Return a success message after creating new saved string queries ### Parameters - `account_id: str` - `id: Optional[str]` - `scan: Optional[bool]` - `tag: Optional[str]` - `max_time: Optional[Union[str, datetime, null]]` - `min_time: Optional[Union[str, datetime, null]]` - `scan: Optional[bool]` - `string_matches: Optional[object]` - `tag: Optional[str]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) client.brand_protection.queries.create( account_id="x", ) ``` ## Delete saved string queries by ID `brand_protection.queries.delete(QueryDeleteParams**kwargs)` **delete** `/accounts/{account_id}/brand-protection/queries` Return a success message after deleting saved string queries by ID ### Parameters - `account_id: str` - `id: Optional[str]` - `scan: Optional[bool]` - `tag: Optional[str]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) client.brand_protection.queries.delete( account_id="x", ) ``` ## Create new saved string queries in bulk `brand_protection.queries.bulk(QueryBulkParams**kwargs)` **post** `/accounts/{account_id}/brand-protection/queries/bulk` Return a success message after creating new saved string queries in bulk ### Parameters - `account_id: str` - `queries: Optional[Iterable[Dict[str, object]]]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) client.brand_protection.queries.bulk( account_id="x", ) ``` # Matches ## Read matches for string queries by ID `brand_protection.matches.get(MatchGetParams**kwargs) -> MatchGetResponse` **get** `/accounts/{account_id}/brand-protection/matches` Return matches for string queries based on ID ### Parameters - `account_id: str` - `id: Optional[str]` - `include_domain_id: Optional[bool]` - `limit: Optional[int]` - `offset: Optional[int]` ### Returns - `class MatchGetResponse: …` - `matches: Optional[List[Dict[str, object]]]` - `total: Optional[int]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) match = client.brand_protection.matches.get( account_id="x", ) print(match.matches) ``` #### Response ```json { "matches": [ { "foo": "bar" } ], "total": 0 } ``` ## Download matches for string queries by ID `brand_protection.matches.download(MatchDownloadParams**kwargs) -> MatchDownloadResponse` **get** `/accounts/{account_id}/brand-protection/matches/download` Return matches as CSV for string queries based on ID ### Parameters - `account_id: str` - `id: Optional[str]` - `include_domain_id: Optional[bool]` - `limit: Optional[int]` - `offset: Optional[int]` ### Returns - `class MatchDownloadResponse: …` - `matches: Optional[List[Dict[str, object]]]` - `total: Optional[int]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.brand_protection.matches.download( account_id="x", ) print(response.matches) ``` #### Response ```json { "matches": [ { "foo": "bar" } ], "total": 0 } ``` ## Domain Types ### Match Get Response - `class MatchGetResponse: …` - `matches: Optional[List[Dict[str, object]]]` - `total: Optional[int]` ### Match Download Response - `class MatchDownloadResponse: …` - `matches: Optional[List[Dict[str, object]]]` - `total: Optional[int]` # Logos ## Create new saved logo queries from image files `brand_protection.logos.create(LogoCreateParams**kwargs) -> LogoCreateResponse` **post** `/accounts/{account_id}/brand-protection/logos` Return new saved logo queries created from image files ### Parameters - `account_id: str` - `match_type: Optional[str]` - `tag: Optional[str]` - `threshold: Optional[float]` - `image: Optional[FileTypes]` ### Returns - `class LogoCreateResponse: …` - `id: Optional[int]` - `tag: Optional[str]` - `upload_path: Optional[str]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) logo = client.brand_protection.logos.create( account_id="x", ) print(logo.id) ``` #### Response ```json { "id": 0, "tag": "tag", "upload_path": "upload_path" } ``` ## Delete saved logo queries by ID `brand_protection.logos.delete(strlogo_id, LogoDeleteParams**kwargs)` **delete** `/accounts/{account_id}/brand-protection/logos/{logo_id}` Return a success message after deleting saved logo queries by ID ### Parameters - `account_id: str` - `logo_id: str` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) client.brand_protection.logos.delete( logo_id="x", account_id="x", ) ``` ## Domain Types ### Logo Create Response - `class LogoCreateResponse: …` - `id: Optional[int]` - `tag: Optional[str]` - `upload_path: Optional[str]` # Logo Matches ## Read matches for logo queries by ID `brand_protection.logo_matches.get(LogoMatchGetParams**kwargs) -> LogoMatchGetResponse` **get** `/accounts/{account_id}/brand-protection/logo-matches` Return matches for logo queries based on ID ### Parameters - `account_id: str` - `limit: Optional[str]` - `logo_id: Optional[SequenceNotStr[str]]` - `offset: Optional[str]` ### Returns - `class LogoMatchGetResponse: …` - `matches: Optional[List[Dict[str, object]]]` - `total: Optional[int]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) logo_match = client.brand_protection.logo_matches.get( account_id="x", ) print(logo_match.matches) ``` #### Response ```json { "matches": [ { "foo": "bar" } ], "total": 0 } ``` ## Download matches for logo queries by ID `brand_protection.logo_matches.download(LogoMatchDownloadParams**kwargs) -> LogoMatchDownloadResponse` **get** `/accounts/{account_id}/brand-protection/logo-matches/download` Return matches as CSV for logo queries based on ID ### Parameters - `account_id: str` - `limit: Optional[str]` - `logo_id: Optional[SequenceNotStr[str]]` - `offset: Optional[str]` ### Returns - `class LogoMatchDownloadResponse: …` - `matches: Optional[List[Dict[str, object]]]` - `total: Optional[int]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.brand_protection.logo_matches.download( account_id="x", ) print(response.matches) ``` #### Response ```json { "matches": [ { "foo": "bar" } ], "total": 0 } ``` ## Domain Types ### Logo Match Get Response - `class LogoMatchGetResponse: …` - `matches: Optional[List[Dict[str, object]]]` - `total: Optional[int]` ### Logo Match Download Response - `class LogoMatchDownloadResponse: …` - `matches: Optional[List[Dict[str, object]]]` - `total: Optional[int]` # V2 # Queries ## Get queries `brand_protection.v2.queries.get(QueryGetParams**kwargs) -> QueryGetResponse` **get** `/accounts/{account_id}/cloudforce-one/v2/brand-protection/domain/queries` Get all saved brand protection queries for an account ### Parameters - `account_id: str` - `id: Optional[str]` ### Returns - `List[QueryGetResponseItem]` - `created: str` - `parameters: Optional[QueryGetResponseItemParameters]` - `string_matches: List[QueryGetResponseItemParametersStringMatch]` - `max_edit_distance: float` - `pattern: str` - `max_time: Optional[str]` - `min_time: Optional[str]` - `query_id: int` - `query_tag: str` - `scan: bool` - `updated: str` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) queries = client.brand_protection.v2.queries.get( account_id="x", ) print(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 - `List[QueryGetResponseItem]` - `created: str` - `parameters: Optional[QueryGetResponseItemParameters]` - `string_matches: List[QueryGetResponseItemParametersStringMatch]` - `max_edit_distance: float` - `pattern: str` - `max_time: Optional[str]` - `min_time: Optional[str]` - `query_id: int` - `query_tag: str` - `scan: bool` - `updated: str` # Matches ## List saved query matches `brand_protection.v2.matches.get(MatchGetParams**kwargs) -> 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 - `account_id: str` - `query_id: str` - `include_dismissed: Optional[str]` - `include_domain_id: Optional[str]` - `limit: Optional[str]` - `offset: Optional[str]` - `order: Optional[Literal["asc", "desc"]]` Sort order. Options: 'asc' (ascending) or 'desc' (descending) - `"asc"` - `"desc"` - `order_by: Optional[Literal["domain", "first_seen"]]` Column to sort by. Options: 'domain' or 'first_seen' - `"domain"` - `"first_seen"` ### Returns - `class MatchGetResponse: …` - `matches: List[Match]` - `dismissed: bool` - `domain: str` - `first_seen: str` - `public_scans: Optional[MatchPublicScans]` - `submission_id: str` - `scan_status: str` - `scan_submission_id: Optional[int]` - `source: Optional[str]` - `total: int` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) match = client.brand_protection.v2.matches.get( account_id="x", query_id="x", ) print(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 - `class MatchGetResponse: …` - `matches: List[Match]` - `dismissed: bool` - `domain: str` - `first_seen: str` - `public_scans: Optional[MatchPublicScans]` - `submission_id: str` - `scan_status: str` - `scan_submission_id: Optional[int]` - `source: Optional[str]` - `total: int` # Logos ## Insert logo query `brand_protection.v2.logos.create(LogoCreateParams**kwargs) -> 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 - `account_id: str` - `image_data: str` Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string. - `similarity_threshold: float` Minimum similarity score (0-1) required for visual matches - `tag: str` Unique identifier for the logo query - `search_lookback: Optional[bool]` If true, search historic scanned images for matches above the similarity threshold ### Returns - `class LogoCreateResponse: …` - `message: str` - `success: bool` - `query_id: Optional[int]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) logo = client.brand_protection.v2.logos.create( account_id="x", image_data="x", similarity_threshold=0, tag="x", ) print(logo.query_id) ``` #### Response ```json { "message": "message", "success": true, "query_id": 0 } ``` ## Delete logo query `brand_protection.v2.logos.delete(strquery_id, LogoDeleteParams**kwargs) -> 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 - `account_id: str` - `query_id: str` ### Returns - `class LogoDeleteResponse: …` - `message: str` - `success: bool` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) logo = client.brand_protection.v2.logos.delete( query_id="x", account_id="x", ) print(logo.message) ``` #### Response ```json { "message": "message", "success": true } ``` ## Get logo queries `brand_protection.v2.logos.get(LogoGetParams**kwargs) -> 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 - `account_id: str` - `id: Optional[str]` Optional query ID to retrieve a specific logo query - `download: Optional[str]` If true, include base64-encoded image data in the response ### Returns - `List[LogoGetResponseItem]` - `id: int` - `r2_path: str` - `similarity_threshold: float` - `tag: str` - `uploaded_at: Optional[str]` - `content_type: Optional[str]` MIME type of the image (only present when download=true) - `image_data: Optional[str]` Base64-encoded image data (only present when download=true) ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) logos = client.brand_protection.v2.logos.get( account_id="x", ) print(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 - `class LogoCreateResponse: …` - `message: str` - `success: bool` - `query_id: Optional[int]` ### Logo Delete Response - `class LogoDeleteResponse: …` - `message: str` - `success: bool` ### Logo Get Response - `List[LogoGetResponseItem]` - `id: int` - `r2_path: str` - `similarity_threshold: float` - `tag: str` - `uploaded_at: Optional[str]` - `content_type: Optional[str]` MIME type of the image (only present when download=true) - `image_data: Optional[str]` Base64-encoded image data (only present when download=true) # Logo Matches ## List logo matches `brand_protection.v2.logo_matches.get(LogoMatchGetParams**kwargs) -> 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 - `account_id: str` - `query_id: str` - `download: Optional[str]` - `limit: Optional[str]` - `offset: Optional[str]` - `order: Optional[Literal["asc", "desc"]]` Sort order. Options: 'asc' (ascending) or 'desc' (descending) - `"asc"` - `"desc"` - `order_by: Optional[Literal["matchedAt", "domain", "similarityScore"]]` Column to sort by. Options: 'matchedAt', 'domain', or 'similarityScore' - `"matchedAt"` - `"domain"` - `"similarityScore"` ### Returns - `class LogoMatchGetResponse: …` - `matches: List[Match]` - `id: int` - `matched_at: Optional[str]` - `query_id: int` - `similarity_score: float` - `url_scan_id: Optional[str]` - `content_type: Optional[str]` - `domain: Optional[str]` - `image_data: Optional[str]` - `total: int` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) logo_match = client.brand_protection.v2.logo_matches.get( account_id="x", query_id="x", ) print(logo_match.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 - `class LogoMatchGetResponse: …` - `matches: List[Match]` - `id: int` - `matched_at: Optional[str]` - `query_id: int` - `similarity_score: float` - `url_scan_id: Optional[str]` - `content_type: Optional[str]` - `domain: Optional[str]` - `image_data: Optional[str]` - `total: int`