---
title: UA Rules
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/python)

[Firewall](https://developers.cloudflare.com/api/python/resources/firewall)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# UA Rules

##### [List User Agent Blocking rules](https://developers.cloudflare.com/api/python/resources/firewall/subresources/ua_rules/methods/list)

firewall.ua\_rules.list(UARuleListParams\*\*kwargs) -> SyncV4PagePaginationArray\[[UARuleListResponse](<https://developers.cloudflare.com/api/python/resources/firewall#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_list_response%20%3E%20(schema)>)]

GET/zones/{zone\_id}/firewall/ua\_rules

##### [Get a User Agent Blocking rule](https://developers.cloudflare.com/api/python/resources/firewall/subresources/ua_rules/methods/get)

firewall.ua\_rules.get(strua\_rule\_id, UARuleGetParams\*\*kwargs) -> [UARuleGetResponse](<https://developers.cloudflare.com/api/python/resources/firewall#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_get_response%20%3E%20(schema)>)

GET/zones/{zone\_id}/firewall/ua\_rules/{ua\_rule\_id}

##### [Create a User Agent Blocking rule](https://developers.cloudflare.com/api/python/resources/firewall/subresources/ua_rules/methods/create)

firewall.ua\_rules.create(UARuleCreateParams\*\*kwargs) -> [UARuleCreateResponse](<https://developers.cloudflare.com/api/python/resources/firewall#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_create_response%20%3E%20(schema)>)

POST/zones/{zone\_id}/firewall/ua\_rules

##### [Update a User Agent Blocking rule](https://developers.cloudflare.com/api/python/resources/firewall/subresources/ua_rules/methods/update)

firewall.ua\_rules.update(strua\_rule\_id, UARuleUpdateParams\*\*kwargs) -> [UARuleUpdateResponse](<https://developers.cloudflare.com/api/python/resources/firewall#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_update_response%20%3E%20(schema)>)

PUT/zones/{zone\_id}/firewall/ua\_rules/{ua\_rule\_id}

##### [Delete a User Agent Blocking rule](https://developers.cloudflare.com/api/python/resources/firewall/subresources/ua_rules/methods/delete)

firewall.ua\_rules.delete(strua\_rule\_id, UARuleDeleteParams\*\*kwargs) -> [UARuleDeleteResponse](<https://developers.cloudflare.com/api/python/resources/firewall#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_delete_response%20%3E%20(schema)>)

DELETE/zones/{zone\_id}/firewall/ua\_rules/{ua\_rule\_id}

##### ModelsExpand Collapse

<details>

<summary>

class UARuleListResponse: …

</summary>

id: Optional\[str]

The unique identifier of the User Agent Blocking rule.

maxLength32

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_list_response%20%3E%20(schema)%20%3E%20(property)%20id">Link to this property</a>

<details>

<summary>

configuration: Optional\[Configuration]

The configuration object for the current rule.

</summary>

target: Optional\[str]

The configuration target for this rule. You must set the target to <code>ua</code> for User Agent Blocking rules.

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_list_response%20%3E%20(schema)%20%3E%20(property)%20configuration%20%3E%20(property)%20target">Link to this property</a>

value: Optional\[str]

The exact user agent string to match. This value will be compared to the received <code>User-Agent</code> HTTP header value.

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_list_response%20%3E%20(schema)%20%3E%20(property)%20configuration%20%3E%20(property)%20value">Link to this property</a>

</details>

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_list_response%20%3E%20(schema)%20%3E%20(property)%20configuration">Link to this property</a>

description: Optional\[str]

An informative summary of the rule.

maxLength1024

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_list_response%20%3E%20(schema)%20%3E%20(property)%20description">Link to this property</a>

<details>

<summary>

mode: Optional\[Literal\["block", "challenge", "js\_challenge", "managed\_challenge"]]

The action to apply to a matched request.

maxLength12

</summary>

One of the following:

"block"

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_list_response%20%3E%20(schema)%20%3E%20(property)%20mode%20%3E%20(member)%200">Link to this property</a>

"challenge"

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_list_response%20%3E%20(schema)%20%3E%20(property)%20mode%20%3E%20(member)%201">Link to this property</a>

"js\_challenge"

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_list_response%20%3E%20(schema)%20%3E%20(property)%20mode%20%3E%20(member)%202">Link to this property</a>

"managed\_challenge"

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_list_response%20%3E%20(schema)%20%3E%20(property)%20mode%20%3E%20(member)%203">Link to this property</a>

</details>

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_list_response%20%3E%20(schema)%20%3E%20(property)%20mode">Link to this property</a>

paused: Optional\[bool]

When true, indicates that the rule is currently paused.

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_list_response%20%3E%20(schema)%20%3E%20(property)%20paused">Link to this property</a>

</details>

[Link to this property](<#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_list_response%20%3E%20(schema)>)

<details>

<summary>

class UARuleGetResponse: …

</summary>

id: Optional\[str]

The unique identifier of the User Agent Blocking rule.

maxLength32

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_get_response%20%3E%20(schema)%20%3E%20(property)%20id">Link to this property</a>

<details>

<summary>

configuration: Optional\[Configuration]

The configuration object for the current rule.

</summary>

target: Optional\[str]

The configuration target for this rule. You must set the target to <code>ua</code> for User Agent Blocking rules.

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_get_response%20%3E%20(schema)%20%3E%20(property)%20configuration%20%3E%20(property)%20target">Link to this property</a>

value: Optional\[str]

The exact user agent string to match. This value will be compared to the received <code>User-Agent</code> HTTP header value.

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_get_response%20%3E%20(schema)%20%3E%20(property)%20configuration%20%3E%20(property)%20value">Link to this property</a>

</details>

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_get_response%20%3E%20(schema)%20%3E%20(property)%20configuration">Link to this property</a>

description: Optional\[str]

An informative summary of the rule.

maxLength1024

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_get_response%20%3E%20(schema)%20%3E%20(property)%20description">Link to this property</a>

<details>

<summary>

mode: Optional\[Literal\["block", "challenge", "js\_challenge", "managed\_challenge"]]

The action to apply to a matched request.

maxLength12

</summary>

One of the following:

"block"

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_get_response%20%3E%20(schema)%20%3E%20(property)%20mode%20%3E%20(member)%200">Link to this property</a>

"challenge"

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_get_response%20%3E%20(schema)%20%3E%20(property)%20mode%20%3E%20(member)%201">Link to this property</a>

"js\_challenge"

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_get_response%20%3E%20(schema)%20%3E%20(property)%20mode%20%3E%20(member)%202">Link to this property</a>

"managed\_challenge"

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_get_response%20%3E%20(schema)%20%3E%20(property)%20mode%20%3E%20(member)%203">Link to this property</a>

</details>

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_get_response%20%3E%20(schema)%20%3E%20(property)%20mode">Link to this property</a>

paused: Optional\[bool]

When true, indicates that the rule is currently paused.

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_get_response%20%3E%20(schema)%20%3E%20(property)%20paused">Link to this property</a>

</details>

[Link to this property](<#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_get_response%20%3E%20(schema)>)

<details>

<summary>

class UARuleCreateResponse: …

</summary>

id: Optional\[str]

The unique identifier of the User Agent Blocking rule.

maxLength32

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_create_response%20%3E%20(schema)%20%3E%20(property)%20id">Link to this property</a>

<details>

<summary>

configuration: Optional\[Configuration]

The configuration object for the current rule.

</summary>

target: Optional\[str]

The configuration target for this rule. You must set the target to <code>ua</code> for User Agent Blocking rules.

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_create_response%20%3E%20(schema)%20%3E%20(property)%20configuration%20%3E%20(property)%20target">Link to this property</a>

value: Optional\[str]

The exact user agent string to match. This value will be compared to the received <code>User-Agent</code> HTTP header value.

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_create_response%20%3E%20(schema)%20%3E%20(property)%20configuration%20%3E%20(property)%20value">Link to this property</a>

</details>

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_create_response%20%3E%20(schema)%20%3E%20(property)%20configuration">Link to this property</a>

description: Optional\[str]

An informative summary of the rule.

maxLength1024

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_create_response%20%3E%20(schema)%20%3E%20(property)%20description">Link to this property</a>

<details>

<summary>

mode: Optional\[Literal\["block", "challenge", "js\_challenge", "managed\_challenge"]]

The action to apply to a matched request.

maxLength12

</summary>

One of the following:

"block"

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_create_response%20%3E%20(schema)%20%3E%20(property)%20mode%20%3E%20(member)%200">Link to this property</a>

"challenge"

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_create_response%20%3E%20(schema)%20%3E%20(property)%20mode%20%3E%20(member)%201">Link to this property</a>

"js\_challenge"

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_create_response%20%3E%20(schema)%20%3E%20(property)%20mode%20%3E%20(member)%202">Link to this property</a>

"managed\_challenge"

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_create_response%20%3E%20(schema)%20%3E%20(property)%20mode%20%3E%20(member)%203">Link to this property</a>

</details>

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_create_response%20%3E%20(schema)%20%3E%20(property)%20mode">Link to this property</a>

paused: Optional\[bool]

When true, indicates that the rule is currently paused.

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_create_response%20%3E%20(schema)%20%3E%20(property)%20paused">Link to this property</a>

</details>

[Link to this property](<#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_create_response%20%3E%20(schema)>)

<details>

<summary>

class UARuleUpdateResponse: …

</summary>

id: Optional\[str]

The unique identifier of the User Agent Blocking rule.

maxLength32

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_update_response%20%3E%20(schema)%20%3E%20(property)%20id">Link to this property</a>

<details>

<summary>

configuration: Optional\[Configuration]

The configuration object for the current rule.

</summary>

target: Optional\[str]

The configuration target for this rule. You must set the target to <code>ua</code> for User Agent Blocking rules.

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_update_response%20%3E%20(schema)%20%3E%20(property)%20configuration%20%3E%20(property)%20target">Link to this property</a>

value: Optional\[str]

The exact user agent string to match. This value will be compared to the received <code>User-Agent</code> HTTP header value.

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_update_response%20%3E%20(schema)%20%3E%20(property)%20configuration%20%3E%20(property)%20value">Link to this property</a>

</details>

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_update_response%20%3E%20(schema)%20%3E%20(property)%20configuration">Link to this property</a>

description: Optional\[str]

An informative summary of the rule.

maxLength1024

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_update_response%20%3E%20(schema)%20%3E%20(property)%20description">Link to this property</a>

<details>

<summary>

mode: Optional\[Literal\["block", "challenge", "js\_challenge", "managed\_challenge"]]

The action to apply to a matched request.

maxLength12

</summary>

One of the following:

"block"

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_update_response%20%3E%20(schema)%20%3E%20(property)%20mode%20%3E%20(member)%200">Link to this property</a>

"challenge"

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_update_response%20%3E%20(schema)%20%3E%20(property)%20mode%20%3E%20(member)%201">Link to this property</a>

"js\_challenge"

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_update_response%20%3E%20(schema)%20%3E%20(property)%20mode%20%3E%20(member)%202">Link to this property</a>

"managed\_challenge"

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_update_response%20%3E%20(schema)%20%3E%20(property)%20mode%20%3E%20(member)%203">Link to this property</a>

</details>

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_update_response%20%3E%20(schema)%20%3E%20(property)%20mode">Link to this property</a>

paused: Optional\[bool]

When true, indicates that the rule is currently paused.

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_update_response%20%3E%20(schema)%20%3E%20(property)%20paused">Link to this property</a>

</details>

[Link to this property](<#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_update_response%20%3E%20(schema)>)

<details>

<summary>

class UARuleDeleteResponse: …

</summary>

id: Optional\[str]

The unique identifier of the User Agent Blocking rule.

maxLength32

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_delete_response%20%3E%20(schema)%20%3E%20(property)%20id">Link to this property</a>

<details>

<summary>

configuration: Optional\[Configuration]

The configuration object for the current rule.

</summary>

target: Optional\[str]

The configuration target for this rule. You must set the target to <code>ua</code> for User Agent Blocking rules.

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_delete_response%20%3E%20(schema)%20%3E%20(property)%20configuration%20%3E%20(property)%20target">Link to this property</a>

value: Optional\[str]

The exact user agent string to match. This value will be compared to the received <code>User-Agent</code> HTTP header value.

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_delete_response%20%3E%20(schema)%20%3E%20(property)%20configuration%20%3E%20(property)%20value">Link to this property</a>

</details>

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_delete_response%20%3E%20(schema)%20%3E%20(property)%20configuration">Link to this property</a>

description: Optional\[str]

An informative summary of the rule.

maxLength1024

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_delete_response%20%3E%20(schema)%20%3E%20(property)%20description">Link to this property</a>

<details>

<summary>

mode: Optional\[Literal\["block", "challenge", "js\_challenge", "managed\_challenge"]]

The action to apply to a matched request.

maxLength12

</summary>

One of the following:

"block"

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_delete_response%20%3E%20(schema)%20%3E%20(property)%20mode%20%3E%20(member)%200">Link to this property</a>

"challenge"

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_delete_response%20%3E%20(schema)%20%3E%20(property)%20mode%20%3E%20(member)%201">Link to this property</a>

"js\_challenge"

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_delete_response%20%3E%20(schema)%20%3E%20(property)%20mode%20%3E%20(member)%202">Link to this property</a>

"managed\_challenge"

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_delete_response%20%3E%20(schema)%20%3E%20(property)%20mode%20%3E%20(member)%203">Link to this property</a>

</details>

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_delete_response%20%3E%20(schema)%20%3E%20(property)%20mode">Link to this property</a>

paused: Optional\[bool]

When true, indicates that the rule is currently paused.

<a href="#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_delete_response%20%3E%20(schema)%20%3E%20(property)%20paused">Link to this property</a>

</details>

[Link to this property](<#(resource)%20firewall.ua_rules%20%3E%20(model)%20ua_rule_delete_response%20%3E%20(schema)>)