> ## Documentation Index
> Fetch the complete documentation index at: https://docs.browserbase.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update a Navigation Policy

> Update a navigation policy. Omitted fields keep their values; a supplied list replaces the stored list rather than adding to it. The change applies to sessions that start afterwards; running sessions keep the policy they started with.



## OpenAPI

````yaml patch /v1/navigation-policies/{id}
openapi: 3.0.0
info:
  title: Browserbase API
  description: Browserbase API for 3rd party developers
  version: v1
servers:
  - url: https://api.browserbase.com
    description: Public endpoint
    variables: {}
security:
  - BrowserbaseAuth: []
tags: []
paths:
  /v1/navigation-policies/{id}:
    patch:
      summary: Update a Navigation Policy
      description: >-
        Update a navigation policy. Omitted fields keep their values; a supplied
        list replaces the stored list rather than adding to it. The change
        applies to sessions that start afterwards; running sessions keep the
        policy they started with.
      operationId: NavigationPolicies_update
      parameters:
        - name: id
          in: path
          description: The navigation policy ID.
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  description: Display name. A policy's id identifies it, not its name.
                  type: string
                  maxLength: 128
                  minLength: 1
                description:
                  description: Free-form notes about the policy.
                  type: string
                  maxLength: 1024
                enabled:
                  description: >-
                    Whether the policy can be bound to new sessions. Running
                    sessions keep the policy they started with. A disabled
                    policy stays editable and can be re-enabled.
                  type: boolean
                defaultDecision:
                  description: >-
                    Decision for each of a domain's categories that has no
                    category rule. The strictest of a domain's category
                    decisions applies, and overrides take precedence.
                  type: string
                  enum:
                    - allow
                    - block
                allowedCategories:
                  description: >-
                    Navigation categories. Browserbase blocks a domain in any
                    blocked category, even if it is also in an allowed one.
                  type: array
                  items:
                    type: string
                    enum:
                      - adult
                      - ai-tools
                      - alcohol-tobacco
                      - business
                      - child-abuse
                      - communication
                      - dating
                      - drugs
                      - education
                      - entertainment
                      - finance
                      - gambling
                      - games
                      - government-military
                      - hacking
                      - hate
                      - health
                      - illegal-activity
                      - infrastructure
                      - kids
                      - lifestyle
                      - malware
                      - newly-registered
                      - news
                      - parked-inactive
                      - phishing-scams
                      - piracy
                      - proxy-anonymizer
                      - search-portal
                      - self-harm
                      - shopping
                      - social-media
                      - society-culture
                      - sports
                      - technology
                      - terrorism-extremism
                      - travel
                      - url-shortener
                      - violence
                      - weapons
                  uniqueItems: true
                blockedCategories:
                  description: >-
                    Navigation categories. Browserbase blocks a domain in any
                    blocked category, even if it is also in an allowed one.
                  type: array
                  items:
                    type: string
                    enum:
                      - adult
                      - ai-tools
                      - alcohol-tobacco
                      - business
                      - child-abuse
                      - communication
                      - dating
                      - drugs
                      - education
                      - entertainment
                      - finance
                      - gambling
                      - games
                      - government-military
                      - hacking
                      - hate
                      - health
                      - illegal-activity
                      - infrastructure
                      - kids
                      - lifestyle
                      - malware
                      - newly-registered
                      - news
                      - parked-inactive
                      - phishing-scams
                      - piracy
                      - proxy-anonymizer
                      - search-portal
                      - self-harm
                      - shopping
                      - social-media
                      - society-culture
                      - sports
                      - technology
                      - terrorism-extremism
                      - travel
                      - url-shortener
                      - violence
                      - weapons
                  uniqueItems: true
                unknownDomainBehavior:
                  description: >-
                    Decision for a domain, or one of its categories, that
                    Browserbase can't classify. It counts as one of the domain's
                    category decisions, so the strictest still applies.
                  type: string
                  enum:
                    - allow
                    - block
                domainOverrides:
                  description: >-
                    Per-host decisions that take precedence over category rules
                    and the default. Each host may appear once.
                  type: array
                  items:
                    additionalProperties: false
                    type: object
                    properties:
                      domain:
                        description: >-
                          Host the override applies to, for example
                          `example.com`. Matching is case-insensitive and covers
                          subdomains.
                        type: string
                        format: hostname
                        maxLength: 253
                        minLength: 1
                      decision:
                        description: Decision for navigations to this host.
                        type: string
                        enum:
                          - allow
                          - block
                    required:
                      - domain
                      - decision
                  maxItems: 500
              additionalProperties: false
              minProperties: 1
      responses:
        '200':
          description: The navigation policy after the update.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NavigationPolicy'
      x-codeSamples:
        - lang: javascript
          label: Node.js
          source: |-
            import Browserbase from "@browserbasehq/sdk";

            const bb = new Browserbase({
              apiKey: process.env.BROWSERBASE_API_KEY,
            });

            const policy = await bb.navigationPolicies.update("<policy-id>", {
              domainOverrides: [
                { domain: "internal.example.com", decision: "block" },
                { domain: "partner.example.net", decision: "allow" },
              ],
            });

            console.log(policy.domainOverrides);
        - lang: python
          label: Python
          source: |-
            import os

            from browserbase import Browserbase

            bb = Browserbase(api_key=os.environ["BROWSERBASE_API_KEY"])

            policy = bb.navigation_policies.update(
                "<policy-id>",
                domain_overrides=[
                    {"domain": "internal.example.com", "decision": "block"},
                    {"domain": "partner.example.net", "decision": "allow"},
                ],
            )

            print(policy.domain_overrides)
        - lang: bash
          label: cURL
          source: |-
            curl --request PATCH \
              https://api.browserbase.com/v1/navigation-policies/<policy-id> \
              --header 'Content-Type: application/json' \
              --header "X-BB-API-Key: $BROWSERBASE_API_KEY" \
              --data '{
                "domainOverrides": [
                  { "domain": "internal.example.com", "decision": "block" },
                  { "domain": "partner.example.net", "decision": "allow" }
                ]
              }'
components:
  schemas:
    NavigationPolicy:
      description: >-
        Rules for which domains a browser session may navigate to. Bind a policy
        to a session with `browserSettings.riskPolicyId`; Browserbase then
        allows or blocks each navigation by the policy's overrides, its category
        rules, and finally its default decision. A session keeps the policy as
        it was when the session started: edits, disables, and deletes apply to
        sessions that start afterwards. A policy checks navigations: page loads,
        iframes, popups, and each redirect. It doesn't check requests a page
        makes itself, such as scripts, images, and `fetch` calls. In a session
        that loads a Context, pages skip their service workers so that the
        policy checks every navigation.
      type: object
      properties:
        id:
          description: Unique identifier for the navigation policy.
          type: string
        projectId:
          description: The project the policy belongs to.
          type: string
        name:
          description: Display name. A policy's id identifies it, not its name.
          type: string
          maxLength: 128
          minLength: 1
        description:
          description: Free-form notes about the policy.
          type: string
          maxLength: 1024
        enabled:
          description: >-
            Whether the policy can be bound to new sessions. Running sessions
            keep the policy they started with. A disabled policy stays editable
            and can be re-enabled.
          type: boolean
        defaultDecision:
          description: >-
            Decision for each of a domain's categories that has no category
            rule. The strictest of a domain's category decisions applies, and
            overrides take precedence.
          type: string
          enum:
            - allow
            - block
        allowedCategories:
          description: >-
            Navigation categories. Browserbase blocks a domain in any blocked
            category, even if it is also in an allowed one.
          type: array
          items:
            type: string
            enum:
              - adult
              - ai-tools
              - alcohol-tobacco
              - business
              - child-abuse
              - communication
              - dating
              - drugs
              - education
              - entertainment
              - finance
              - gambling
              - games
              - government-military
              - hacking
              - hate
              - health
              - illegal-activity
              - infrastructure
              - kids
              - lifestyle
              - malware
              - newly-registered
              - news
              - parked-inactive
              - phishing-scams
              - piracy
              - proxy-anonymizer
              - search-portal
              - self-harm
              - shopping
              - social-media
              - society-culture
              - sports
              - technology
              - terrorism-extremism
              - travel
              - url-shortener
              - violence
              - weapons
          uniqueItems: true
        blockedCategories:
          description: >-
            Navigation categories. Browserbase blocks a domain in any blocked
            category, even if it is also in an allowed one.
          type: array
          items:
            type: string
            enum:
              - adult
              - ai-tools
              - alcohol-tobacco
              - business
              - child-abuse
              - communication
              - dating
              - drugs
              - education
              - entertainment
              - finance
              - gambling
              - games
              - government-military
              - hacking
              - hate
              - health
              - illegal-activity
              - infrastructure
              - kids
              - lifestyle
              - malware
              - newly-registered
              - news
              - parked-inactive
              - phishing-scams
              - piracy
              - proxy-anonymizer
              - search-portal
              - self-harm
              - shopping
              - social-media
              - society-culture
              - sports
              - technology
              - terrorism-extremism
              - travel
              - url-shortener
              - violence
              - weapons
          uniqueItems: true
        unknownDomainBehavior:
          description: >-
            Decision for a domain, or one of its categories, that Browserbase
            can't classify. It counts as one of the domain's category decisions,
            so the strictest still applies.
          type: string
          enum:
            - allow
            - block
        domainOverrides:
          description: >-
            Per-host decisions that take precedence over category rules and the
            default. Each host may appear once.
          type: array
          items:
            additionalProperties: false
            type: object
            properties:
              domain:
                description: >-
                  Host the override applies to, for example `example.com`.
                  Matching is case-insensitive and covers subdomains.
                type: string
                format: hostname
                maxLength: 253
                minLength: 1
              decision:
                description: Decision for navigations to this host.
                type: string
                enum:
                  - allow
                  - block
            required:
              - domain
              - decision
          maxItems: 500
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
      required:
        - id
        - projectId
        - name
        - description
        - enabled
        - defaultDecision
        - allowedCategories
        - blockedCategories
        - unknownDomainBehavior
        - domainOverrides
        - createdAt
        - updatedAt
  securitySchemes:
    BrowserbaseAuth:
      type: apiKey
      in: header
      name: X-BB-API-Key
      description: Your [Browserbase API Key](https://www.browserbase.com/settings).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.