hostedContentFilterRules
Anti-Spam Rules. Rules binding inbound anti-spam policies to recipients. The hostedContentFilterRules entity set lives under /exchange/v1.0/hostedContentFilterRules in the Threat protection category.
| Fact | Value |
|---|---|
| Path | /exchange/v1.0/hostedContentFilterRules |
| Category | Threat protection |
| Tier | Tier 4, Threat protection |
| Read role | ThreatPolicy.Read.All (Community) |
| Write role | ThreatPolicy.ReadWrite.All (Enterprise) |
| Backing cmdlets | Get-HostedContentFilterRule, Set-HostedContentFilterRule, New-HostedContentFilterRule, Remove-HostedContentFilterRule, Enable-HostedContentFilterRule, Disable-HostedContentFilterRule |
Routes
Section titled “Routes”| Method | Path | Synopsis | Role | Plan |
|---|---|---|---|---|
| GET | /exchange/v1.0/hostedContentFilterRules |
List hostedContentFilterRules entries. | ThreatPolicy.Read |
Community |
| POST | /exchange/v1.0/hostedContentFilterRules |
Create a new hostedContentFilterRules entry. Body keys map 1:1 to the cmdlet’s parameter names (camelCased). Returns 201 + Location + the freshly-fetched entity. Use ?dryRun=true to map to -WhatIf without applying. | ThreatPolicy.ReadWrite |
Enterprise |
| GET | /exchange/v1.0/hostedContentFilterRules/{key} |
Get a single hostedContentFilterRules entry by Identity. | ThreatPolicy.Read |
Community |
| PATCH | /exchange/v1.0/hostedContentFilterRules/{key} |
Partial update of the hostedContentFilterRules at /hostedContentFilterRules/{key}. Only body fields present are passed to the cmdlet. Returns 200 + the post-Set entity (rename-aware re-fetch when name is in the body). |
ThreatPolicy.ReadWrite |
Enterprise |
| DELETE | /exchange/v1.0/hostedContentFilterRules/{key} |
Remove the hostedContentFilterRules at /hostedContentFilterRules/{key}. Returns 204 with no body. | ThreatPolicy.ReadWrite |
Enterprise |
| POST | /exchange/v1.0/hostedContentFilterRules/{key}/disable |
POST /hostedContentFilterRules/{key}/disable - bound action via Disable-HostedContentFilterRule. Returns 204. | ThreatPolicy.ReadWrite |
Enterprise |
| POST | /exchange/v1.0/hostedContentFilterRules/{key}/enable |
POST /hostedContentFilterRules/{key}/enable - bound action via Enable-HostedContentFilterRule. Returns 204. | ThreatPolicy.ReadWrite |
Enterprise |
GET /exchange/v1.0/hostedContentFilterRules
Section titled “GET /exchange/v1.0/hostedContentFilterRules”List hostedContentFilterRules entries.
Backing cmdlet: Get-HostedContentFilterRule. Role: ThreatPolicy.Read (Community).
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
state |
query | string | Server-side filter by rule enablement state (Get-HostedContentFilterRule -State). One of: Enabled | Disabled. |
List hostedContentFilterRules
Section titled “List hostedContentFilterRules”Stub auto-generated example for the hostedContentFilterRules collection. Backing cmdlet: Get-HostedContentFilterRule. Live-verify with ?$top=3&$select=Id,Name and replace the synthetic body before promoting to Tier 1.
GET /exchange/v1.0/hostedContentFilterRules?$top=3 HTTP/1.1Authorization: Bearer {token}HTTP/1.1 200 OK
{ "@odata.context": "http://localhost:5043/exchange/v1.0/$metadata#hostedContentFilterRules", "value": []}Notes: Illustrative example derived from the cmdlet documentation, not a live capture: field names are real, values are placeholders.
Related: GET /exchange/v1.0/hostedContentFilterRules/{key}
POST /exchange/v1.0/hostedContentFilterRules
Section titled “POST /exchange/v1.0/hostedContentFilterRules”Create a new hostedContentFilterRules entry. Body keys map 1:1 to the cmdlet’s parameter names (camelCased). Returns 201 + Location + the freshly-fetched entity. Use ?dryRun=true to map to -WhatIf without applying.
Backing cmdlet: New-HostedContentFilterRule. Role: ThreatPolicy.ReadWrite (Enterprise).
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
hostedContentFilterPolicy |
body | yes | ||
name |
body | yes | ||
comments |
body | |||
enabled |
body | |||
exceptIfRecipientDomainIs |
body | |||
exceptIfSentTo |
body | |||
exceptIfSentToMemberOf |
body | |||
priority |
body | |||
recipientDomainIs |
body | |||
sentTo |
body | |||
sentToMemberOf |
body | |||
dryRun |
query | bool (switch) |
Create rejected - missing required hostedContentFilterPolicy
Section titled “Create rejected - missing required hostedContentFilterPolicy”New-HostedContentFilterRule requires both name and hostedContentFilterPolicy. Omitting hostedContentFilterPolicy returns a 400 from the body-allowlist validator before the cmdlet runs.
POST /exchange/v1.0/hostedContentFilterRules HTTP/1.1Authorization: Bearer {token}Content-Type: application/json
{ "name": "exonaut-sample-hostedContentFilterRules"}HTTP/1.1 400 Bad RequestContent-Type: application/json
{ "error": { "code": "BadRequest", "message": "The required field 'hostedContentFilterPolicy' is required.", "target": "hostedContentFilterPolicy" }, "correlationId": "0HN7Q3K2V8A1B:00000003"}Notes: Doc-derived from Wiki + write-param allowlist; not live-captured. Body fields are Wiki-valid; values are illustrative.
Related: GET /exchange/v1.0/hostedContentFilterRules
Create a hosted content filter rule
Section titled “Create a hosted content filter rule”Creates a new anti-spam (hosted content filter) rule via New-HostedContentFilterRule, associating a HostedContentFilterPolicy with recipient conditions.
POST /exchange/v1.0/hostedContentFilterRules HTTP/1.1Authorization: Bearer {token}Content-Type: application/json
{ "name": "exonaut-sample-hostedContentFilterRules", "hostedContentFilterPolicy": "exonaut-sample-hostedContentFilterPolicy", "enabled": true, "comments": "EXONAUT sample anti-spam rule", "priority": 0, "recipientDomainIs": [ "contoso.com" ], "sentTo": [ "user@contoso.com" ]}HTTP/1.1 201 CreatedLocation: /exchange/v1.0/hostedContentFilterRules/exonaut-sample-hostedContentFilterRules
{ "Id": "exonaut-sample-hostedContentFilterRules", "Identity": "exonaut-sample-hostedContentFilterRules", "Name": "exonaut-sample-hostedContentFilterRules", "HostedContentFilterPolicy": "exonaut-sample-hostedContentFilterPolicy", "State": "Enabled", "Priority": 0, "Comments": "EXONAUT sample anti-spam rule", "RecipientDomainIs": [ "contoso.com" ], "SentTo": [ "user@contoso.com" ]}Notes: Doc-derived from Wiki + write-param allowlist; not live-captured. Body fields are Wiki-valid; values are illustrative.
Related: GET /exchange/v1.0/hostedContentFilterRules
GET /exchange/v1.0/hostedContentFilterRules/{key}
Section titled “GET /exchange/v1.0/hostedContentFilterRules/{key}”Get a single hostedContentFilterRules entry by Identity.
Backing cmdlet: Get-HostedContentFilterRule. Role: ThreatPolicy.Read (Community).
Get a single hostedContentFilterRules entry
Section titled “Get a single hostedContentFilterRules entry”Stub auto-generated example for GET /hostedContentFilterRules/{key}. Backing cmdlet: Get-HostedContentFilterRule with -Identity {key}. Returns the full entity body; 404 if the identity doesn’t resolve.
GET /exchange/v1.0/hostedContentFilterRules/{key} HTTP/1.1Authorization: Bearer {token}HTTP/1.1 200 OK
{ "@odata.context": "http://localhost:5043/exchange/v1.0/$metadata#hostedContentFilterRules/$entity"}Notes: Illustrative example derived from the cmdlet documentation, not a live capture: field names are real, values are placeholders.
Related: GET /exchange/v1.0/hostedContentFilterRules
PATCH /exchange/v1.0/hostedContentFilterRules/{key}
Section titled “PATCH /exchange/v1.0/hostedContentFilterRules/{key}”Partial update of the hostedContentFilterRules at /hostedContentFilterRules/{key}. Only body fields present are passed to the cmdlet. Returns 200 + the post-Set entity (rename-aware re-fetch when name is in the body).
Backing cmdlet: Set-HostedContentFilterRule. Role: ThreatPolicy.ReadWrite (Enterprise).
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
comments |
body | |||
exceptIfRecipientDomainIs |
body | |||
exceptIfSentTo |
body | |||
exceptIfSentToMemberOf |
body | |||
hostedContentFilterPolicy |
body | |||
name |
body | |||
priority |
body | |||
recipientDomainIs |
body | |||
sentTo |
body | |||
sentToMemberOf |
body | |||
dryRun |
query | bool (switch) |
Update a hosted content filter rule
Section titled “Update a hosted content filter rule”Partial update of a hosted content filter rule via Set-HostedContentFilterRule. Only the body fields present are passed to the cmdlet; returns 200 with the post-Set entity.
PATCH /exchange/v1.0/hostedContentFilterRules/{key} HTTP/1.1Authorization: Bearer {token}Content-Type: application/json
{ "priority": 1, "comments": "EXONAUT sample anti-spam rule (updated)", "recipientDomainIs": [ "contoso.com" ]}HTTP/1.1 200 OKContent-Type: application/json
{ "Id": "exonaut-sample-hostedContentFilterRules", "Identity": "exonaut-sample-hostedContentFilterRules", "Name": "exonaut-sample-hostedContentFilterRules", "HostedContentFilterPolicy": "exonaut-sample-hostedContentFilterPolicy", "State": "Enabled", "Priority": 1, "Comments": "EXONAUT sample anti-spam rule (updated)", "RecipientDomainIs": [ "contoso.com" ]}Notes: Doc-derived from Wiki + write-param allowlist; not live-captured. Body fields are Wiki-valid; values are illustrative.
Related: GET /exchange/v1.0/hostedContentFilterRules
DELETE /exchange/v1.0/hostedContentFilterRules/{key}
Section titled “DELETE /exchange/v1.0/hostedContentFilterRules/{key}”Remove the hostedContentFilterRules at /hostedContentFilterRules/{key}. Returns 204 with no body.
Backing cmdlet: Remove-HostedContentFilterRule. Role: ThreatPolicy.ReadWrite (Enterprise).
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
dryRun |
query | bool (switch) |
Delete a hosted content filter rule
Section titled “Delete a hosted content filter rule”Removes a hosted content filter rule via Remove-HostedContentFilterRule. Returns 204 with no body.
DELETE /exchange/v1.0/hostedContentFilterRules/{key} HTTP/1.1Authorization: Bearer {token}Content-Type: application/jsonHTTP/1.1 204 No ContentNotes: Doc-derived from Wiki + write-param allowlist; not live-captured. Body fields are Wiki-valid; values are illustrative.
Related: GET /exchange/v1.0/hostedContentFilterRules
POST /exchange/v1.0/hostedContentFilterRules/{key}/disable
Section titled “POST /exchange/v1.0/hostedContentFilterRules/{key}/disable”POST /hostedContentFilterRules/{key}/disable - bound action via Disable-HostedContentFilterRule. Returns 204.
Backing cmdlet: Disable-HostedContentFilterRule. Role: ThreatPolicy.ReadWrite (Enterprise).
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
dryRun |
query | bool (switch) |
Disable a hosted content filter rule
Section titled “Disable a hosted content filter rule”Sub-resource of the hosted content filter rule at GET /hostedContentFilterRules/{key} - disables the rule via Disable-HostedContentFilterRule. Returns 204.
POST /exchange/v1.0/hostedContentFilterRules/{key}/disable HTTP/1.1Authorization: Bearer {token}Content-Type: application/jsonHTTP/1.1 204 No ContentNotes: Doc-derived from Wiki + write-param allowlist; not live-captured. Body fields are Wiki-valid; values are illustrative.
Related: GET /exchange/v1.0/hostedContentFilterRules
POST /exchange/v1.0/hostedContentFilterRules/{key}/enable
Section titled “POST /exchange/v1.0/hostedContentFilterRules/{key}/enable”POST /hostedContentFilterRules/{key}/enable - bound action via Enable-HostedContentFilterRule. Returns 204.
Backing cmdlet: Enable-HostedContentFilterRule. Role: ThreatPolicy.ReadWrite (Enterprise).
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
dryRun |
query | bool (switch) |
Enable a hosted content filter rule
Section titled “Enable a hosted content filter rule”Sub-resource of the hosted content filter rule at GET /hostedContentFilterRules/{key} - enables the rule via Enable-HostedContentFilterRule. Returns 204.
POST /exchange/v1.0/hostedContentFilterRules/{key}/enable HTTP/1.1Authorization: Bearer {token}Content-Type: application/jsonHTTP/1.1 204 No ContentNotes: Doc-derived from Wiki + write-param allowlist; not live-captured. Body fields are Wiki-valid; values are illustrative.
Related: GET /exchange/v1.0/hostedContentFilterRules
?dryRun=true previews of any write stay on Community.

