-
Notifications
You must be signed in to change notification settings - Fork 15
Add matching policies endpoints #210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
xvaier
merged 13 commits into
Flared:main
from
jacob-denis-flare:add-matching-policies-endpoints
Apr 10, 2026
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
836a720
docs(api): add documentation for new `matching_policies` endpoints
jacob-denis-flare 04cc286
docs(changelog): update for new `matching_policies` endpoints
jacob-denis-flare 4b5af06
docs(guide): add `create-identifier-with-matching-policies`
jacob-denis-flare 8daa52c
docs(changelog): update for new `create-identifier-with-matching-poli…
jacob-denis-flare 3b150d5
docs(guide): update `create-identifiers-with-matching-policies` sdk e…
jacob-denis-flare 5f3f1f3
docs(guide): better description for `create-identifiers-with-matching…
jacob-denis-flare f4af697
docs(api): add missing description for `clean_past_events`
jacob-denis-flare fe6c2e1
docs(changelog): update warning message
jacob-denis-flare 2959854
docs(snippets): add `beta-endpoint`
jacob-denis-flare 436adc4
docs(api): use beta snippet in `get-event`
jacob-denis-flare fd6da85
docs(api): make `matching_policies` beta
jacob-denis-flare fc51b18
docs(snippet): fix `beta-endpoint`
jacob-denis-flare e8e0f98
docs(api): update `get-matching-policy` title
jacob-denis-flare File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
3,411 changes: 3,086 additions & 325 deletions
3,411
docs/api-reference/spec/firework-v4-openapi.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| title: "Assign Policy (Beta)" | ||
| openapi: post /firework/v4/matching_policies/{policy_uuid}/assignments | ||
| --- | ||
|
|
||
| import BetaEndpoint from '/snippets/beta-endpoint.mdx' | ||
|
|
||
| <BetaEndpoint name="Assign Policy" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| title: "Create Matching Policy (Beta)" | ||
| openapi: post /firework/v4/matching_policies | ||
| --- | ||
|
|
||
| import BetaEndpoint from '/snippets/beta-endpoint.mdx' | ||
|
|
||
| <BetaEndpoint name="Create Matching Policy" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| title: "Delete Matching Policy (Beta)" | ||
| openapi: delete /firework/v4/matching_policies/{policy_uuid} | ||
| --- | ||
|
|
||
| import BetaEndpoint from '/snippets/beta-endpoint.mdx' | ||
|
|
||
| <BetaEndpoint name="Delete Matching Policy" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| title: "Retrieve Matching Policy (Beta)" | ||
| openapi: get /firework/v4/matching_policies/{policy_uuid} | ||
| --- | ||
|
|
||
| import BetaEndpoint from '/snippets/beta-endpoint.mdx' | ||
|
|
||
| <BetaEndpoint name="Retrieve Matching Policy" /> |
8 changes: 8 additions & 0 deletions
8
docs/api-reference/v4/endpoints/list-matching-policies-by-identifier-id.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| title: "List Matching Policies By Identifier Id (Beta)" | ||
| openapi: get /firework/v4/matching_policies/by_identifier_id/{identifier_id} | ||
| --- | ||
|
|
||
| import BetaEndpoint from '/snippets/beta-endpoint.mdx' | ||
|
|
||
| <BetaEndpoint name="List Matching Policies By Identifier Id" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| title: "List Matching Policies (Beta)" | ||
| openapi: get /firework/v4/matching_policies | ||
| --- | ||
|
|
||
| import BetaEndpoint from '/snippets/beta-endpoint.mdx' | ||
|
|
||
| <BetaEndpoint name="List Matching Policies" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| title: "List Policy Assignments (Beta)" | ||
| openapi: get /firework/v4/matching_policies/{policy_uuid}/assignments | ||
| --- | ||
|
|
||
| import BetaEndpoint from '/snippets/beta-endpoint.mdx' | ||
|
|
||
| <BetaEndpoint name="List Policy Assignments" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| title: "Unassign Policy (Beta)" | ||
| openapi: delete /firework/v4/matching_policies/{policy_uuid}/assignments | ||
| --- | ||
|
|
||
| import BetaEndpoint from '/snippets/beta-endpoint.mdx' | ||
|
|
||
| <BetaEndpoint name="Unassign Policy" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| title: "Update Matching Policy (Beta)" | ||
| openapi: put /firework/v4/matching_policies/{policy_uuid} | ||
| --- | ||
|
|
||
| import BetaEndpoint from '/snippets/beta-endpoint.mdx' | ||
|
|
||
| <BetaEndpoint name="Update Matching Policy" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| --- | ||
| title: 'Create And Assign Matching Policies to Identifiers' | ||
| --- | ||
| Identifiers (domains, keywords, identities, and other types) and Matching Policies (excluded_keywords, lucene_query and other types) can be created, updated and listed via the Management API. | ||
|
|
||
| Matching Policies are useful for customers who want precise control over which events appear in an Identifier’s feed, either by including or excluding events based on keywords, or by scoping results with a specific search query. | ||
|
|
||
| This guide covers how to create an identifier and apply a matching policy to it. | ||
|
|
||
| ## Steps | ||
| <Steps> | ||
|
|
||
| <Step title="Create an identifier"> | ||
| Use the | ||
| [Create Identifier <Icon icon="code" size={16} />](/api-reference/v2/endpoints/identifiers/post-fireworkv2assets) | ||
| endpoint to create an identifier. Apply filters to narrow down results to specific identifiers you want to match. | ||
| </Step> | ||
|
|
||
| <Step title="Create a matching policy"> | ||
| Use the | ||
| [Create Matching Policy <Icon icon="code" size={16} />](/api-reference/v4/endpoints/create-matching-policy) | ||
| endpoint to create a matching policy to precisely control which events should appear in the identifier's feed. | ||
| </Step> | ||
|
|
||
| <Step title="Assign the matching policy to the identifier"> | ||
| Use the | ||
| [Assign Policy <Icon icon="code" size={16} />](/api-reference/v4/endpoints/assign-policy) | ||
| endpoint to assign the matching policy to the identifier. | ||
| </Step> | ||
|
|
||
| </Steps> | ||
|
|
||
| ## End-to-end examples | ||
|
|
||
| <AccordionGroup> | ||
|
|
||
| <Accordion title="Python SDK Example"> | ||
| ```python | ||
| from flareio import FlareApiClient | ||
| from flareio.ratelimit import Limiter | ||
|
|
||
|
|
||
| api_client = FlareApiClient.from_env() | ||
|
|
||
| limiter_default = Limiter.from_seconds(0.25) | ||
|
|
||
| # 1. Create an Identifier | ||
| identifier_resp = api_client.post( | ||
| "/firework/v2/assets/", | ||
| json={ | ||
| "name": "scatterholt.com", | ||
| "type": "domain", | ||
| "search_types": [ | ||
| "forum_post", | ||
| ], | ||
| "data": {"type": "domain", "fqdn": "scatterholt.com"}, | ||
| "risks": [1, 2, 3, 4, 5], | ||
| }, | ||
| ) | ||
|
|
||
| identifier = identifier_resp.json()["asset"] | ||
| identifier_id = identifier["id"] | ||
|
|
||
| # Rate limiting (default). | ||
| limiter_default.tick() | ||
|
|
||
| # 2. Create a Matching Policy | ||
| matching_policy_resp = api_client.post( | ||
| "/firework/v4/matching_policies", | ||
| json={ | ||
| "name": "Terms to ignore", | ||
| "type": "EXCLUDED_KEYWORDS", | ||
| "value": {"keywords": ["term1", "term2", "term3"]}, | ||
| }, | ||
| ) | ||
| matching_policy = matching_policy_resp.json() | ||
| matching_policy_name = matching_policy["name"] | ||
| matching_policy_uuid = matching_policy["uuid"] | ||
|
|
||
| # Rate limiting (default). | ||
| limiter_default.tick() | ||
|
|
||
| # 3. Assign the matching policy to the identifier | ||
| api_client.post( | ||
| f"/firework/v4/matching_policies/{matching_policy_uuid}/assignments", | ||
| json={"identifier_ids": [identifier_id], "clean_past_events": False}, | ||
| ) | ||
|
|
||
| print( | ||
| f"Created identifier {identifier_id} with matching policy '{matching_policy_name}' assigned to it" | ||
| ) | ||
| ``` | ||
| </Accordion> | ||
|
|
||
| </AccordionGroup> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| <Note> | ||
| The {name} endpoint is still in beta and is subject to change. | ||
| </Note> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.