Part of the AI Coding Harness Guide — environment design for coding agents in production.

Claude Code Queries the Public Overpass API: Block It or Use Your Own Server#

Published by

Asked for OpenStreetMap data, Claude Code writes an Overpass query and, with no endpoint set, sends it to the public overpass-api.de server that is meant for human mappers. Claude Code has no Overpass setting to change. Block the host for shell commands with sandbox.network.deniedDomains, deny the WebFetch tool to it, or run your own Overpass instance and name it in CLAUDE.md.[1]

Why Claude Code reaches overpass-api.de#

Overpass is the query API for OpenStreetMap. The public instance at overpass-api.de is a shared service run for people who edit the map. Claude Code has no built-in OpenStreetMap tool and no setting that names an Overpass server. When a prompt asks a geospatial question such as "how many coffee shops are in this city, from OSM", the model writes an Overpass QL query itself and fetches it, either through the WebFetch tool or through a shell command such as curl or wget that it runs with Bash. The default host in most public examples, and the one the model falls back to, is overpass-api.de. This is the behavior reported in issue #110292: the public server, built for occasional human use, takes automated load it was not sized for.

Because nothing in Claude Code points the query anywhere, the fix is not a toggle. You either stop the request from leaving for that host, or you give the model a different host to use.

Block the public server#

For shell commands: sandbox.network.deniedDomains#

When Claude Code runs a command in its sandbox, the sandbox network layer decides which hosts the command may reach. sandbox.network.deniedDomains is a list of hosts to refuse. A denied connection is answered with a 403, so a curl or wget to the host fails instead of loading the server. Add the Overpass host to settings.json:

{
  "sandbox": {
    "enabled": true,
    "network": {
      "deniedDomains": ["overpass-api.de", "*.overpass-api.de"]
    }
  }
}

An entry takes an optional :port suffix (for example overpass-api.de:443) to restrict it to one port, and a bare "*" denies every host. A denied entry can carry a message the model sees, keyed by the exact entry string in deniedDomainReasons:

{
  "sandbox": {
    "network": {
      "deniedDomains": ["overpass-api.de"],
      "deniedDomainReasons": {
        "overpass-api.de": "The public Overpass API is for human mappers. Use the self-hosted endpoint named in CLAUDE.md."
      }
    }
  }
}

The key must match a deniedDomains entry exactly, so a reason keyed to overpass-api.de does not cover the entry *.overpass-api.de. Entries without a reason report a generic "host is on the deny list". This control governs sandboxed shell commands; it does not cover the WebFetch tool, which fetches through Claude Code itself.

For the WebFetch tool: a permissions.deny rule#

The WebFetch tool takes its own permission rules, written in domain form rather than as a URL. A deny rule stops WebFetch from loading the host:

{
  "permissions": {
    "deny": ["WebFetch(domain:overpass-api.de)", "WebFetch(domain:*.overpass-api.de)"]
  }
}

The domain: prefix is required; a full URL in the rule is rejected. A *. wildcard matches subdomains. This rule covers only WebFetch. A Bash permission rule will not reliably close the shell path, because a Bash rule matches the start of the command, so it cannot catch a host that sits in the middle of a curl line or a different fetcher such as wget or a Python script. Use the sandbox deny list or a hook for shell commands.

One rule for both paths: a PreToolUse hook#

A PreToolUse hook sees every tool call before it runs and can refuse it after reading its input, which covers WebFetch and Bash with one rule and needs no sandbox. Return permissionDecision: "deny" when the call targets the host:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "WebFetch|Bash",
        "hooks": [{ "type": "command", "command": "python3 ~/.claude/block-overpass.py" }]
      }
    ]
  }
}

The script reads the tool input on stdin and denies a match:

import json, sys
data = json.load(sys.stdin)
blob = json.dumps(data.get("tool_input", {}))
if "overpass-api.de" in blob:
    print(json.dumps({
        "hookSpecificOutput": {
            "hookEventName": "PreToolUse",
            "permissionDecision": "deny",
            "permissionDecisionReason": "The public Overpass API is for human mappers. Use the self-hosted endpoint in CLAUDE.md."
        }
    }))

A PreToolUse hook's permissionDecision accepts allow, deny or ask, and permissionDecisionReason is the text shown for the decision. When several hooks disagree, deny wins.

Keep using OSM: point Claude at your own endpoint#

Blocking the host stops the queries but also stops the answers. To keep OpenStreetMap as a data source without loading the public server, run your own Overpass instance, or use a paid provider that expects automated traffic, and tell Claude to use that host. Overpass ships as a Docker image, so a local instance for a region extract is a reasonable setup for repeated work. Then add a rule to the project CLAUDE.md:

## OpenStreetMap / Overpass
- Never query overpass-api.de or other public Overpass instances. They are for human mappers.
- Send every Overpass query to http://localhost:12345/api/interpreter (our own instance).

A CLAUDE.md rule changes which host the model aims for, but it is guidance, not enforcement, so pair it with the deny list or the hook above when the host must never be reached.

Which control covers which path#

ControlCoversNeeds the sandbox
sandbox.network.deniedDomainsShell commands (curl, wget, scripts) in the sandboxYes
permissions.deny with WebFetch(domain:...)The WebFetch tool onlyNo
PreToolUse hookWebFetch and BashNo
CLAUDE.md ruleRedirects the model to another host (guidance, not a block)No

Should you block it?#

Block overpass-api.de if your prompts touch OpenStreetMap at all, because the model reaches the public server without being asked, and automated queries are the load the server's maintainers are trying to shed. If you only need OSM occasionally, the WebFetch deny rule plus the hook is enough and needs no sandbox. If OSM data is part of a workflow you run often, stand up your own Overpass instance and redirect to it in CLAUDE.md, so the agent keeps the data source without adding to the public service's load. A combined setup, a self-hosted endpoint in CLAUDE.md with a deny list for the public host, keeps the queries working and keeps them off the shared server.


FAQ#

Q: Does Claude Code have a setting for the Overpass server?

A: No. Claude Code has no OpenStreetMap tool and no Overpass setting. The model writes the query and picks the host itself, defaulting to the public overpass-api.de. To change the host you redirect the model in CLAUDE.md; to stop a host you block it with the sandbox deny list, a WebFetch deny rule, or a hook.

Q: Why does Claude Code hit overpass-api.de without being asked?

A: It is the default host in most public Overpass examples, so the model falls back to it when nothing else is set. Reported in issue #110292.

Q: How do I stop Claude Code from querying the public Overpass API?

A: Add overpass-api.de and *.overpass-api.de to sandbox.network.deniedDomains for shell commands, add WebFetch(domain:overpass-api.de) to permissions.deny for the WebFetch tool, or deny both in a PreToolUse hook that matches the host in the tool input.

Q: Will a Bash deny rule block a curl to the host?

A: Not reliably. A Bash permission rule matches the start of the command, so it misses a host in the middle of a curl line or a different fetcher. Block it at the sandbox network layer or in a hook instead.

Q: Can I keep using OpenStreetMap data?

A: Yes. Run your own Overpass instance, or use a provider that expects automated traffic, and tell Claude to send queries to that host in CLAUDE.md. Keep a deny list on the public host so the agent cannot fall back to it.

Q: What does deniedDomainReasons do?

A: It attaches a message to a denied host, keyed by the exact deniedDomains entry. The model sees that text when the host is refused; entries with no reason report a generic "host is on the deny list".


Sources: [1] Claude Code issue #110292

Related: Claude Code sent my email in the User-Agent | Deny the Artifact tool to free context | Claude Code v2.1.219: sandbox.network.strictAllowlist

Get the weekly digest

New Claude Code, Codex, Gemini CLI and OpenCode guides and release analyses, once a week, plus occasional notes.

One email a week plus occasional notes. Confirm by email; unsubscribe from any issue. Privacy