Introducing News: 200M articles indexed live

Allow the sites you trust. Block the rest.

Access policies decide which websites your requests can reach. Blocked sites are refused, and nothing from them is returned or charged.

Powering agents and products with the world's data.

Super.com logo
Passionfroot logo
Zero logo
Mintlify logo
Chatwoot logo
Similarweb logo
Klarna logo
Ferndesk logo
DocsBot logo
Daily.dev logo
Sixtyfour logo
Comp AI logo
Squad logo

Allow a list, or block one.

A policy is one list of domains. Each domain covers its subdomains, and *.gov covers every .gov site.

Allowlist

Refuses every site you didn’t list.

"allowed_domains": ["arxiv.org", "*.gov"]
  • arxiv.orgOn the listallowed
  • export.arxiv.orgSubdomain of arxiv.orgallowed
  • data.census.govMatches *.govallowed
  • github.comNot on the listblocked
  • reddit.comNot on the listblocked

Blocklist

Refuses only the sites you list.

"blocked_domains": ["facebook.com", "tiktok.com"]
  • facebook.comOn the listblocked
  • m.facebook.comSubdomain of facebook.comblocked
  • tiktok.comOn the listblocked
  • github.comNot on the listallowed
  • instagram.comNot on the listallowed

Where a policy applies.

Requests can add policies of their own, but they can’t skip the ones on their API key or your account.

  • "applies_to": "request"

    The requests that list it

    Add its ID to policies on any request. Batches apply it to every page, and monitors to every run.

  • "applies_to": "api_keys"

    Every request from a key

    Hand an agent a key that can only reach the sites you choose, without changing its code.

  • "applies_to": "organization"

    Every request you make

    One rule for every request from your account, whichever key sends it.

When a site is blocked.

Every endpoint that reaches the web checks your policies, including redirects and embedded frames. Company and people data aren’t affected.

Scrape, Crawl, Map, Styleguide, Fonts, Brand, Prefetch
Refused with a 403. Crawl skips the blocked links it finds.
Search, Answers, News
Blocked results are removed. Answers never uses them as sources.
Batches
Blocked URLs are listed in invalid_urls and never run.
Monitors
A blocked target can’t be saved. If a policy blocks it later, runs fail.
A refused request returns a 403
{
  "error_code": "ACCESS_POLICY_DENIED",
  "message": "An access policy blocks gist.github.com.",
  "error_data": {
    "url": "https://gist.github.com/example",
    "denied_by": ["pol_81ab4d6e2f9c0a7b5e3d1c8f6a4b2e9d"]
  }
}

Fence in an agent’s key.

Attach a policy to the API key your agent uses, and every request it sends is checked, whatever its code asks for. Leave access_policies:write off that key so it can’t change its own limits.

Read the docs
cURL
POST /v1/access-policies
curl -X POST https://api.context.dev/v1/access-policies \
  -H "Authorization: Bearer $CONTEXT_DEV_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Agent sandbox",
    "allowed_domains": ["arxiv.org", "*.gov"],
    "applies_to": "api_keys",
    "api_key_ids": ["ctxt_keyid_4b7e2f9a1c8d4e6fa3b5c7d9e1f20a4b"]
  }'

A few things to know.

More details in the API documentation.

How do I turn on access policies?

Access policies are enabled per organization. Book a call or email support@context.dev. Until they’re on, the policy endpoints and any request that lists policies return 403 ACCESS_POLICIES_NOT_ENABLED.

Should I use an allowlist or a blocklist?

Allowlists are the strictest option, since anything you didn’t list is refused. A blocklist only covers the domains you list, so the same content on another website can still be reached.

Can I combine policies?

Yes. List several policies and a request only runs if every one of them allows the URL. A policy that allows github.com and another that blocks gist.github.com together allow GitHub without gists.

Do subdomains count?

Yes. Each domain covers its subdomains, so arxiv.org also covers export.arxiv.org, and *.gov covers every .gov site. Policies match domains, not paths.

Am I charged for blocked requests?

No. Content from a blocked website is never returned or charged.

Can a request skip an account or API key policy?

No. Policies that apply to your account or to an API key always run. A request can add more policies, but it can’t remove those.

Who can create and change policies?

Creating, updating, and deleting policies needs the access_policies:write permission, and listing them needs access_policies:read. Any key can use a policy in a request. Don’t give access_policies:write to a key you limit with a policy, since it could change its own limits.

When do changes take effect?

Right away, including for batches and monitors that are already running. A request that lists a deleted or unknown policy fails with a 400.

Can I manage policies from the dashboard?

Yes. Create, edit, and delete them on the Access policies page in your dashboard, or with the access policy API.

Let agents browse. On your terms.

Start with 1,000 free credits, then talk to us when you’re ready to turn on access policies.

1,000free credits

Every month. No credit card required.

Start for freeRead the docs