

Sanity Robot Token IP Allowlist: Integration Security Guide
Sanity added IP allowlists for project and organisation robot tokens on 27 November 2026. Eligible Enterprise customers can now restrict a token to selected public IPv4 addresses, so requests from other locations are refused.
That makes a stolen credential harder to use outside the approved network. It also creates an immediate integration decision. A restricted token cannot use Sanity's API CDN, Sanity Functions cannot use an allowlisted token, and Sanity-hosted services such as Context MCP and the Sanity MCP server need a separate unrestricted credential. CI runners, serverless platforms and multi-region hosting may also use more public egress addresses than expected.
The right response is not to paste one IP address into every token. Start with a workload inventory, map where each request leaves the network, separate incompatible services, narrow permissions, test allowed and denied paths, then monitor the change. This guide explains the practical rollout for Australian businesses using Sanity as part of a website, application or connected content platform.
Why Sanity robot-token security is trending now
Robot tokens are non-human credentials used by builds, webhooks, integrations, migration scripts, server applications and automation. They may read published content, write drafts, upload assets or administer resources depending on the role attached to them.
Until this release, a valid token could generally be presented from any network location. Sanity's new control adds a source-network boundary: if the public source address is not on the allowlist, the API refuses the request. That is commercially important because a credential exposed through source code, a build log, a compromised laptop or a supplier system may otherwise be usable from an attacker's infrastructure.
The feature is timely, but availability is limited to certain Enterprise plans. Businesses on other plans should still use the same operating disciplines—separate credentials, least privilege, secure storage, expiry, rotation, monitoring and fast revocation—while they assess whether their plan or architecture needs an additional network control.
What the new allowlist does—and what it does not
An allowlist can contain up to ten public IPv4 addresses or CIDR ranges. Ranges must be /16 or narrower. Sanity rejects IPv6 addresses, private and special-use ranges, hostnames and wildcard formats. The addresses must represent where API traffic reaches the public internet, such as a NAT gateway, hosting egress address or CI runner pool—not the private address shown inside a server or container.
Changes take effect within about 30 seconds and are recorded in Sanity's activity log. Existing listeners, Live Content API connections and exports are checked when they connect, so a session already open during a policy change can continue until it reconnects.
This is a useful second boundary, not a complete credential strategy. A request from an allowed address can still do everything the token's role permits. IP rules do not replace narrow roles, secret storage, token expiry, rotation, usage review or incident response. They also do not automatically restrict any new token created by a powerful robot identity.
Four questions every robot token should answer
Network location is only one part of a defensible service-credential design.
What workload owns it?
Use one credential per application or automation where practical. Give it a clear owner, purpose, environment and replacement process.
What may it do?
Attach the narrowest suitable role. A build that only reads published content should not also edit documents or manage tokens.
Where may it run?
Add the known public egress addresses when the workload and plan support allowlisting. Do not guess from private server addresses.
How is misuse contained?
Store the secret safely, set expiry and rotation expectations, monitor usage, document revocation and rehearse recovery.
Inventory workloads before changing a token
A token label rarely tells the whole story. The same secret may have been copied into a hosting platform, a local deployment script, a scheduled job and a supplier integration. Restricting it before finding every consumer can turn a security improvement into an outage.
Build an inventory with these fields:
- token label, project or organisation scope, role and expiry;
- business owner and technical owner;
- production, staging, development or administrative purpose;
- every application, job, webhook, CI pipeline and person that uses it;
- hosting region, runtime, NAT gateway and public egress addresses;
- whether the client uses
api.sanity.ioor the API CDN; - whether Sanity Functions, Context MCP or the Sanity MCP server uses it;
- last-known use, expected frequency and business journeys affected;
- secret storage location, rotation method and rollback owner.
If one credential serves several unrelated workloads, split it before adding network policy. Separate tokens make permissions clearer and let the team revoke or rotate one integration without interrupting every consumer.

Map public egress, not internal addresses
The allowlist must match the public IPv4 address Sanity sees. A server with a private address such as 10.x.x.x may leave through a NAT gateway. A serverless function may use a shared or changing provider range unless the architecture includes fixed egress. A managed CI service may run jobs from several published ranges or from an address pool that changes.
Confirm egress from the actual runtime in each environment. Do not rely on a developer laptop test or the address shown in a cloud console. Record primary and failover paths, multiple regions, disaster-recovery infrastructure and deployment runners. If there are more than ten required entries, avoid widening a range merely to make the limit fit. Consider a stable NAT gateway, controlled proxy, self-hosted runner or architecture change that produces a smaller, owned egress set.
Plan changes to network infrastructure as token-policy changes. A new NAT gateway, hosting migration or regional failover can block requests even when the application and secret are unchanged.
Turn off the API CDN for restricted tokens
A restricted token works with api.sanity.io, not apicdn.sanity.io. In @sanity/client, authenticated server-side clients using an allowlisted token must set useCdn: false.
Search every codebase and runtime configuration that uses the token. A successful anonymous content query does not prove the authenticated path is correct, and a client may select the CDN through a shared helper or environment default. Test the exact read, write, mutation, upload, export or listener operation performed by the workload.
Keep tokens out of browser bundles. IP allowlisting cannot make a credential safe when it is shipped to end users, because the caller's network is outside the business's control and the secret can be extracted. Authenticated Sanity operations should run in a trusted server, build or controlled integration environment.
Separate Sanity-hosted and customer-hosted workloads
Sanity Functions use tokens managed by Sanity and cannot receive an IP allowlist. Other Sanity-hosted services that call the API with your credential, including Context MCP and the Sanity MCP server, are refused when the token is restricted because requests originate from Sanity's infrastructure rather than your allowlisted network.
Do not remove the allowlist from a website build token merely because an MCP connection shares it. Create a separate token for the hosted service with the minimum role it needs, then keep the customer-hosted build or server token restricted to your egress addresses.
This separation also improves incident containment. If an AI or editorial integration is paused, its token can be revoked without stopping production rendering. If a build credential is rotated, the MCP connection does not need to change. Record which credentials cannot use network policy and compensate with narrower permissions, expiry, usage review and stronger secret handling.
Apply the policy without locking out production
Use a staged change with evidence at each step:
- Create or split credentials: give each workload the narrowest role and an accountable owner.
- Confirm egress: observe public addresses from production-equivalent runtimes, including failover paths.
- Fix client configuration: route restricted credentials to the API rather than the API CDN.
- Test a new token first: use staging or a non-critical workload to verify the network and role assumptions.
- Prove both outcomes: confirm expected operations succeed from every allowed path and fail with HTTP 403 from a denied path.
- Deploy during a monitored window: watch builds, webhooks, content publishing, asset processing, cache refreshes and business APIs.
- Revoke superseded credentials: do not leave the old unrestricted token active as a permanent fallback.
Keep a rollback path that restores service without normalising weak controls. A temporary removal of the network policy may be appropriate during a verified outage, but assign who can approve it, how long it may remain and what evidence is required before reapplying the restriction.
Automate policy carefully through the Access API
Sanity's Access API robot endpoints accept networkPolicy.allowedSourceCidrs when a robot token is created or updated. The same endpoints return the policy, and setting networkPolicy to null removes it.
Infrastructure-as-code can make the expected policy reviewable and repeatable, but it also raises the impact of a mistake. Protect the administrative token that creates or modifies robots, require review for policy changes, and validate current egress before applying a pipeline update. A robot cannot change its own allowlist, which helps prevent self-expansion, but a powerful robot may create other credentials that do not inherit its restriction.
Include negative tests in deployment checks. A configuration is not proven merely because the API returns the expected JSON. Verify a permitted workload, an intentionally denied source, the correct endpoint, the required business operation and a failover path.
Monitor the control as part of normal operations
After rollout, track more than successful deployments. Useful evidence includes:
- HTTP 403 errors for disallowed source addresses or API CDN use;
- activity-log events for adding, editing or removing an allowlist;
- last-used information and expected usage frequency for each token;
- unexpected access from allowed networks;
- tokens approaching expiry or missing an owner;
- failed builds, stale content, missed webhooks and broken asset workflows;
- network changes that alter public egress;
- unused, duplicated or over-privileged credentials.
Review the inventory after hosting changes, supplier changes, team departures and integration upgrades. A network rule that was correct at launch can become obsolete, too broad or operationally fragile as the platform evolves.
Respond to a leaked or misused token
An allowlist can limit where a leaked token works, but it should not delay incident response. If misuse or exposure is suspected, preserve relevant logs, revoke or rotate the credential, identify every workload that used it, assess the role and content or administration actions available, and inspect activity for unauthorised reads or changes.
For Australian organisations, the OAIC describes a general response sequence of contain, assess, notify when required and review. If the token could access personal information, determine what data was available, whether it was actually accessed or disclosed, the likely harm and whether the Notifiable Data Breaches scheme applies. Avoid destroying evidence while containing the incident.
After recovery, remove the root cause. That may mean deleting the secret from source history, fixing log redaction, narrowing the role, splitting a shared token, changing build permissions or moving the workload behind stable egress.
Move from shared secrets to governed service identities
Prioritise production credentials with broad permissions and uncertain ownership.
Days 1–5: discover
Export the token inventory, assign owners, locate every consumer and identify production credentials with broad roles, no expiry or unclear purpose.
Days 6–10: map
Confirm public egress for servers, CI, serverless jobs and failover routes. Identify CDN clients and Sanity-hosted services that need separation.
Days 11–15: redesign
Split shared credentials, reduce roles, set lifecycle expectations and choose which eligible Enterprise tokens receive network policy.
Days 16–20: test
Apply the policy in staging, verify allowed and denied requests, test API endpoint changes and rehearse rollback and revocation.
Days 21–25: deploy
Roll out in monitored windows, watch business journeys and integrations, then revoke superseded unrestricted credentials.
Days 26–30: operate
Publish the runbook, alerts, review cadence and incident owner. Record accepted exceptions and the next date for reducing them.
When an IP allowlist is a good fit
The control is a strong fit for eligible Enterprise organisations whose production builds, backend applications and integration workers leave through stable, owned public IPv4 addresses. It is especially useful for write-capable credentials or tokens that can reach sensitive unpublished content.
It is harder to apply when workloads use changing shared egress, depend on Sanity Functions or Sanity-hosted MCP services, require the API CDN, or cannot fit within ten narrow entries. In those cases, redesign the network path or keep a separate token with compensating controls rather than adding a broad range that weakens the boundary.
Smaller businesses should compare the whole operating cost: plan availability, fixed egress, network management, credential separation, testing and support. The most valuable first step may be a clean token inventory and least-privilege redesign. An allowlist strengthens that foundation; it cannot replace it.
Questions to ask your website or integration partner
- Which robot token belongs to each application, build, webhook and automation?
- What role does each token have, and can it be narrowed?
- Where is the secret stored, and when was it last rotated?
- What public IPv4 addresses do production, staging, CI and failover traffic use?
- Does any client use the API CDN with an authenticated token?
- Which services require separate unrestricted tokens, and what compensating controls protect them?
- How will allowed, denied and failover paths be tested before production?
- Who monitors 403 errors, token activity, expiry and business-workflow failures?
- What is the rollback and revocation process if a change causes an outage or a credential leaks?
Good evidence should include the token register, owner and role decisions, observed egress addresses, test results, deployment record, revoked credentials and the next review date.
Sources checked
- Sanity: Restrict robot tokens to IP addresses
- Sanity: Robot tokens accept an IP allowlist
- Sanity: Restrict a robot token to specific IP addresses
- Sanity: Authentication and tokens
- Sanity: Keeping your data safe
- Sanity: Roles and permissions
- Australian Signals Directorate: Managing cryptographic keys and secrets
- Australian Signals Directorate: Cloud shared responsibility guidance for SMEs
- OAIC: Responding to data breaches
Sources were accessed on 28 November 2026. Product availability, limits and API behaviour can change; verify the current Sanity documentation and your organisation's plan before implementation.