Why API penetration testing scope decides whether the test is useful
Scope and rules of engagement decide what an API penetration test examines, what it must leave alone and whether the resulting report will be accepted by the auditor, customer or insurer who asked for it. If a framework, a customer security review, a product launch or an insurer requires an API test, the commissioning team has to define the boundaries before any tester sends a request. A vague scope produces a report that looks thorough but misses the risks the requirement was written to catch, while an overly broad scope raises cost and production risk without adding coverage that matters.
The biggest scoping risks sit in the categories of the OWASP API Security Top 10 2023. API1 Broken Object Level Authorization and API5 Broken Function Level Authorization can only be tested if the scope names which roles, tenants and test accounts are in play, and API3 Broken Object Property Level Authorization depends on knowing which response fields are meant to be hidden. API9 Improper Inventory Management means the scope must be fed by an inventory of hosts and deployed versions, because an API version nobody listed is the one most likely to be left out. API6 Unrestricted Access to Sensitive Business Flows and API4 Unrestricted Resource Consumption raise a production question: the rules of engagement must say whether load-like or repeated-request tests run against live systems, and in which window. NIST SP 800-115 treats rules of engagement as the written guidelines and constraints agreed before testing, so a useful rules document records the targets, testing windows, permitted techniques, data handling, contacts for stopping a test and the people authorized to approve changes.
Before you sign anything, confirm three things with your provider: the complete list of API hosts, versions and protocols in scope, including whether the target uses REST, SOAP, GraphQL, gRPC or WebSockets; which environments are covered and whether production data may be touched; and which actions are explicitly excluded. Ask for the rules of engagement in writing, and check that they name an emergency contact and a stop condition. Those decisions determine whether the report later answers the question your auditor or customer is asking.
What can be in scope for an API test
Each card is a decision that must be written into the scope document before testing starts. Together they fix what the tester may touch, with which access, and where. Anything left implied tends to be argued about during the test, so the rules of engagement should name each item explicitly.
APIs and versions
Start from the API inventory, not from a list of product names. Under OWASP API9 Improper Inventory Management, a proper inventory of hosts and deployed API versions is what keeps deprecated versions and exposed debug endpoints from being missed. List each in-scope API, its base URL, and each live version, and state whether older versions are included. Ask the client to confirm which undocumented or shadow endpoints they know about, so the test does not rely on the published specification alone.
API Top 10 2023API technologies in use
The WSTG API Testing chapter covers REST, SOAP, GraphQL, gRPC and WebSockets, and each needs different test techniques. Scope should name which of these the target exposes, including any gateway that translates between them. A REST-only scope can leave a GraphQL endpoint or WebSocket channel untested by accident. Confirm the protocols with the client's architecture diagram and gateway configuration, not from memory.
WSTG API testingEnvironments and hosts
State whether testing runs against production, a staging copy, or a dedicated test environment. Each choice changes data risk, rate limit behavior and who must be told before testing starts. Record the hostnames, the cloud account or cluster that hosts them, and any change freeze windows. If production is in scope, the rules should cover monitoring, maintenance windows and stop conditions. Confirm that staging matches production in authentication, gateway and data configuration.
Roles and test accounts
Authorization findings depend on the accounts the tester holds. Scope should list each role, such as anonymous, standard user, tenant administrator and service account, and the number of accounts per role. Two accounts per role are needed to test object level access between users. Name who issues the accounts, how they are revoked after the test, and which data they may read or change. Synthetic data should be used where possible.
Token and credential handling
Write down how the tester obtains and stores tokens, API keys and certificates, and how long they stay valid. Scope should say whether the tester may request tokens through the client's identity provider, receives them from the client, or uses a sandbox issuer. Agree how credentials are shared and destroyed at the end. This also covers any MFA or single sign-on step the tester must pass, so that access is not blocked mid-test.
Third-party and excluded integrations
Most APIs call other services: payment processors, identity providers, data brokers and partner APIs. Scope must state which of these are excluded, because the client cannot authorize testing of systems it does not own, and each provider may have its own testing rules. Confirm the provider's terms before testing any integration that is shared. Denial of service testing is also commonly excluded, and the PCI SSC supplement notes that denial of service weaknesses are not considered for PCI penetration testing since they would not lead to compromise of cardholder data.
How the scoping and rules of engagement process runs
The sequence turns a loose request for an API test into a written scope, signed rules of engagement and a testing plan that the client, the tester and any affected parties can all hold to.
Define the business purpose and trigger
The client states why the test is needed, such as a framework requirement, a customer security review, a release or an insurer request, and names the sponsor who can approve scope. The provider asks which compliance framework or customer questionnaire the result must satisfy, because that determines the depth and the report format. The step closes with a one-page statement of purpose that both parties sign off before any target discussion begins.
Build the API inventory
The client supplies the list of hosts, base paths, deployed API versions, gateways and any deprecated or internal endpoints they know about. The OWASP API Security Top 10 2023 entry on improper inventory management recommends a proper inventory of hosts and deployed versions, so the inventory becomes the basis for scope. The provider compares it against what is discoverable and flags undocumented or old versions. The step is done when every in-scope version is named and any gaps are recorded as open questions.
Confirm API technologies and specifications
The provider and client confirm which API styles the target uses, such as REST, SOAP, GraphQL, gRPC or WebSockets, as listed in the WSTG API Testing chapter. They also agree which specifications, such as OpenAPI documents or GraphQL schemas, the tester will receive, and whether any are out of date. The output is a scope table that maps each API to its technology and its available documentation, so testing approach can be chosen per API.
Set environments, access and test accounts
The parties agree whether testing runs against production, a staging copy or a dedicated test environment, and which roles and test accounts the tester will use, unauthenticated, standard user and privileged. They also agree whether source code or documentation access is provided, since ASVS 5.0.0 favors documentation or source led testing for access control and business logic. The client confirms that the test accounts are isolated, with data that can be altered safely. The step closes when each environment and account is listed with its owner.
Write the rules of engagement
The provider drafts the rules of engagement using the template in NIST SP 800-115, covering the testing window, source IP ranges, permitted techniques, excluded hosts and functions, rate limits the tester may apply, data handling, stop conditions, escalation contacts and what happens if a critical issue appears mid-test. For payment-related APIs, the window and affected parties should be communicated as the PCI SSC supplement describes. Denial of service testing is excluded where it would not affect cardholder data, and the client decides whether any availability testing is permitted. The client's authorized signatory and the provider's lead tester both sign. The document is complete only when signed and distributed to the client's security operations and hosting teams.
Agree the test plan and approach
The tester maps the agreed scope to the WSTG API Testing chapter and to the OWASP API Security Top 10 2023, and records which categories will be covered manually and which will rely on tooling. The plan states the testing viewpoint for each role, whether black box, grey box or authenticated, and the ASVS level chosen if verification is required. The client reviews the plan for any function that should be excluded, such as live payment execution or bulk data export. The step closes with an approved test plan that is attached to the rules of engagement.
Run the test within the agreed boundaries
The tester executes the plan only within the signed rules of engagement, logs every session with timestamps, and pauses to contact the named escalation point if a finding suggests active compromise or threatens availability. Scope changes are made in writing and signed before testing continues. The client's operations team confirms the test window was monitored. The step is complete when the test window closes and the tester records any out-of-scope activity or incidents.
Hand over findings and confirm retest scope
The provider delivers the report, which should list scope, method, findings and the ASVS coverage the test achieved, and the parties agree a retest scope for fixed issues. The client confirms the retest environment, accounts and window, which are set through the same written process. Scope and rules of engagement are archived with the report so that an auditor or customer can see what was tested and under which limits. The step closes when the client accepts the report and the retest is scheduled under the same rules.
What the rules of engagement must record before testing starts
A written rules of engagement (RoE) is the document that turns an API test from an activity into an authorized, bounded exercise. Before any request reaches the target, it should name the authorized testers and the source IP ranges they test from, so the security operations team can tell test traffic from a live attack and so the provider can prove who was acting. It should also list the API base URLs, the versions in scope, the environments covered (production, staging or both) and the test accounts and roles that will be used. NIST SP 800-115 includes a template for rules of engagement and is a sound starting point for the structure. Confirm with the provider whether it will reuse that template or its own, and check that the document is signed by someone with authority over the systems being tested.
The RoE should also settle the hard boundaries: which techniques are permitted, which are prohibited, and whether production data may be accessed. For an API, this means stating whether the tester may create, modify or delete records, whether real customer or cardholder data may be viewed, how any sensitive data encountered will be handled, stored and destroyed, and whether tests may run against production at all. Testing windows should be set in writing, and for payment-related APIs the PCI SSC information supplement advises communicating the timing and scope of testing to all affected parties and running it in a monitored maintenance window. Emergency contacts, a stop condition (for example, errors or latency that indicate a fault on the live service) and a named escalation path belong in the same document. Denial of service testing is excluded from PCI penetration testing scope, since the supplement notes such weaknesses would not lead to compromise of cardholder data. Any other load, rate or resource consumption test, such as flooding a rate-limited endpoint to check API4 controls, should require explicit written approval, with agreed limits and a designated owner on the client side.
How scope differs across production, staging and partner APIs
Testing a live production API carries the most operational risk, so scope here is mostly about when and how testing happens and when it must stop. Production is the only environment where the real configuration, real traffic patterns and real data protections exist, which is why many buyers want at least some coverage there. The trade-off is that active testing can degrade service, trigger alerts that wake on-call staff, or touch customer records.
- Monitored windows: Agree testing windows with the platform and operations teams, and confirm that a named person can observe traffic during them. The PCI SSC supplement recommends communicating timing and scope to all affected parties and running testing in a monitored maintenance window.
- Read-mostly test data: Prefer dedicated test accounts and synthetic records. Write operations, deletions and payment-style actions should be limited to objects the client has created for the test.
- Rate and load limits: Set request ceilings in writing. Resource consumption tests, which map to API4:2023, should be run carefully or excluded from production scope.
- Stop conditions: Define the signals that halt testing immediately, such as error rates, latency thresholds or any sign of customer impact, and name who has authority to call a stop.
- Alert handling: Decide whether the security operations team will be told in advance, or whether the test should be detected to measure monitoring. Record the choice in the rules of engagement.
Before signing, confirm the monitored window, the stop contacts and which accounts and data sets the tester may use.
Staging environments are safer to test, which makes them attractive, but a clean result there proves less than it appears to. The key question is parity: whether the staging API runs the same code version, gateway rules, authentication configuration, secrets handling and data shape as production. Differences in any of these can hide broken object level authorization, excessive data exposure or misconfigured rate limits that would appear in production.
- Version parity: Confirm the deployed build, API version and schema match production. Deprecated versions that remain live in production, which relate to API9:2023 on improper inventory, often exist only in one environment.
- Configuration differences: Compare gateway policies, CORS settings, debug flags, token lifetimes, identity provider settings and any feature flags. A staging API with debug endpoints enabled or relaxed authentication can produce findings that do not apply to production, or miss ones that do.
- Data sets: Ask whether staging holds synthetic data or a masked copy of production. Authorization tests depend on realistic ownership relationships between objects, so generic seed data can produce false assurance.
- Integration paths: Check whether downstream services, payment providers or third-party calls are stubbed. Stubs change the behavior the tester sees.
- Documented gaps: Record every known difference in the scope document so that the report can state which findings transfer to production and which do not.
Ask the client to provide a written parity statement listing configuration and version differences before testing starts.
When the API is hosted or operated by a partner, a supplier or a cloud-hosted service provider, your organization may not own the infrastructure, and the partner has its own testing rules and interests. Testing an API you consume from a third party without permission can breach contract terms or law, even if your own application is the client. Scope must therefore separate what the client owns, what the partner owns, and what needs the partner's written agreement.
- Provider testing rules: Check whether the partner publishes testing rules or requires advance notice. Some providers restrict certain test types, such as load or denial of service testing, entirely.
- Written consent: Obtain authorization from the party that owns the endpoint, not only from the client that consumes it. Record who signed and what they authorized.
- Shared responsibility: Test the client's own use of the partner API, such as how it stores tokens, validates responses and handles errors, separately from the partner's server behavior.
- Test accounts and tenants: Confirm that test tenants are isolated from other customers. A tester must not access or modify another customer's data on a shared platform.
- Escalation path: Name the partner contact who can respond if testing affects their service or reveals a flaw in their platform.
Confirm consent in writing from the owning party, and ask whether the partner's terms permit the specific test types in scope.
What changes the scope and effort of an API test
This table compares the factors that move the size of an API test, why each one changes the effort, and what to confirm in writing before work starts. Read it against your own API inventory and identity model, since the largest driver is often the number of distinct roles and versions rather than the raw endpoint count. Treat every row as a question to settle in the scope document, not as a number to price from.
| Scope factor | Why it changes effort | What to confirm in writing |
|---|---|---|
| Number of APIs and versions | Each live version can expose different routes, parameters and defaults, so each one needs its own coverage decisions. Deprecated versions still reachable in production are a common reason scope grows late. | Named list of APIs, base URLs and versions in scope, plus which deprecated or beta versions are included or excluded |
| Authentication methods and role count | Each role and token type changes what must be tested for object and function level authorization. Testing two roles against each other is far less work than testing a matrix of tenants, roles and permissions. | Number of roles, tenants and token types, and which of them the tester receives test accounts for |
| Endpoint count from the inventory | Effort follows the endpoints that actually exist, not the ones in old documentation. An inventory that is out of date means the tester must discover routes, which adds time. | Source of truth for endpoints (specification, gateway export or inventory), its date, and who resolves gaps found during testing |
| Technologies in use | REST, SOAP, GraphQL, gRPC and WebSockets each need different test techniques. Mixed protocols in one target widen the method and the tooling needed. | Which of REST, SOAP, GraphQL, gRPC or WebSockets the target uses, and any gateways or message brokers in the path |
| Specification and source access | An OpenAPI or GraphQL schema, plus code access, lets testers plan coverage and check authorization logic directly. Without them, more time goes to discovery and the test relies more on black box observation. | Which documents, schemas and code paths are provided, their version, and whether testing is black box, grey box or documentation-led |
| Environment choice | Testing production carries stricter timing, data and monitoring constraints. A staging copy with different configuration may miss production-only defaults, so coverage decisions depend on this choice. | Target environment, data handling rules, maintenance window, and who is notified before and during testing |
| Retest | A retest covers only the findings that were fixed, but it still needs environment access, updated builds and tester time. Scope it as a separate, defined item rather than an open-ended follow-up. | Which findings are retested, the build or version to test against, and the window in which fixes are checked |
What the scope document and final report should show your auditor
An API test is only as defensible as the link between what was agreed, what was tested and what was reported. The six artifacts below form that chain, and each one answers a question an auditor or customer security reviewer is likely to ask.
Signed rules of engagement
The rules of engagement record who authorized the test, which testing windows apply, which environments and accounts are in play, and what the tester must not do. NIST SP 800-115 includes a template for this document. An auditor uses it to confirm that the test was authorized and bounded. Check that it names a accountable signatory on the client side and an escalation contact for stopping the test.
NIST SP 800-115Scope statement with API list and versions
The scope statement lists each API in scope by name, base address, protocol and version, such as REST, SOAP, GraphQL, gRPC or WebSockets. It also states which versions and environments are covered and which are excluded. A customer reviewer compares this list with the systems they rely on. Ambiguous wording such as "the public API" is a common gap that auditors flag.
Inventory reconciliation
The inventory reconciliation compares the scope list with the client's own record of hosts and deployed API versions. OWASP API9 Improper Inventory Management treats an accurate inventory as the control against deprecated versions and exposed debug endpoints. The document should show which endpoints were found outside the inventory, how each was resolved, and which were added to scope or formally excluded.
Findings mapped to API Top 10 identifiers
Each finding should carry an OWASP API Security Top 10 2023 identifier, such as API1 Broken Object Level Authorization or API5 Broken Function Level Authorization, alongside its severity and affected endpoint. This lets a reviewer group results by risk class across several tests. Ask for the mapping in the report, since a list of unlabelled findings is hard to reconcile with a risk register.
Requirements checked and not applicable
Where the test is measured against OWASP ASVS, the report should list the requirements checked, the exceptions found and the requirements the tester judged not applicable, with a reason for each. ASVS 5.0.0 says a verification report should summarize all requirements checked, not only failures. Auditors rely on the not-applicable entries to confirm that nothing was silently skipped.
Retest results
The retest record shows which findings were fixed, which remain open and which were accepted as risk, with the date and evidence for each status. A closed finding without a retest is an assertion, not evidence. Confirm with the provider whether the retest covers the original scope and whether it is included in the quoted price or billed separately.
Questions buyers ask about API test scope
Does an API penetration test need access to production?
Not always, but the answer should be decided in the rules of engagement rather than assumed. Production testing shows the controls that real traffic meets, while a staging or pre-production copy is safer for destructive or load-sensitive checks. Many teams test authorization and business logic in a production-like environment with the same gateway, identity provider and data model, then confirm a small set of read-only checks in production under a monitored window. Ask the provider which checks need production, what data they will touch, who on your side approves each one, and how they will avoid disrupting customers. Confirm that the staging copy really matches production configuration, since drift is a common source of false assurance.
What happens when testing finds undocumented API endpoints?
Undocumented endpoints should be recorded, tested within the agreed scope and added to the inventory, and the rules of engagement should say in advance how new discoveries are handled. OWASP's API9:2023 Improper Inventory Management item explains why a current inventory of hosts and deployed API versions matters, including deprecated versions and exposed debug endpoints. Agree whether the tester may probe a newly found endpoint without stopping to ask, whether it is added to scope automatically, and who you notify if it touches regulated data. Ask the provider how discoveries will be reported and whether they will be mapped to OWASP identifiers in the final report. Confirm the owner of each endpoint so the fix has a destination.
Should third-party APIs be included in the test scope?
Generally no, unless you control the third-party service under a contract that allows testing. Your application may call external APIs for payments, identity or data enrichment, and those providers set their own testing rules and may not permit active testing against their systems. A safer approach is to test how your application handles their responses, including validation, timeouts, error handling and secrets, and to treat the third party as out of scope for direct attack. Ask the provider to list every external dependency, and confirm with each provider whether testing is permitted. Where your application consumes third-party data without validation, that is in scope as an unsafe consumption issue under API10:2023.
How much effort does our team need to put into scoping?
Your team carries the most effort in identifying the target, supplying documentation and making decisions, and the provider carries the effort of turning those inputs into a written scope. Expect to provide a list of APIs and versions, the protocols in use (REST, SOAP, GraphQL, gRPC or WebSockets, as listed in the OWASP WSTG API testing chapter), specifications where they exist, the environments available, test accounts with different roles, and the people who approve risky checks. The more complete the inventory, the fewer surprises in testing. Ask the provider what they need before the first scoping call, who will attend, and how long they expect the back-and-forth to take. Effort varies with the size and age of your API estate, so confirm it against your own inventory.
Can we define the API test scope ourselves?
Yes, your team can draft the initial scope, but the provider should review it before anything is signed, because gaps in an inventory are usually found by the tester. Start with your API inventory, the data each API handles, the authentication model, and the environments and versions in use. Then write down what is in scope, what is excluded, which techniques are allowed, and who to contact during testing. NIST SP 800-115 includes a rules of engagement template that can structure this work. Ask the provider to challenge your draft, especially on versions still in production, shadow endpoints and third-party dependencies, since these are where internally written scopes most often miss items.
How are scope changes handled during an engagement?
Scope changes should go through a written change process agreed before testing starts, not through informal messages. The rules of engagement should name who can approve a change, how a change is recorded, and how it affects timing and fees. Typical triggers include a newly discovered API, a version that turns out to be shared with another system, or a finding that makes a deeper check necessary. Ask the provider how change requests are priced, whether additional work is quoted before it begins, and how the final report will reflect the agreed scope and any changes made during testing. Keep a single log of changes shared by both parties so the report can show exactly what was tested.
What should the rules of engagement record for an API test?
The rules of engagement should record the permitted techniques, testing windows, source addresses, test accounts, data handling, stop conditions and emergency contacts. The PCI SSC information supplement advises communicating the timing and scope of penetration testing to all affected parties and running tests in a monitored maintenance window, which is a sensible model even outside card environments. Also record how denial of service checks are handled, since they can disrupt shared services. Ask the provider to show a sample rules of engagement document and confirm that your security operations team will know when tests run, so alerts are not mistaken for a live attack.
Does an API test need source code or API specifications?
Specifications and source access are not mandatory, but they usually improve coverage and reduce the time spent discovering the API surface. ASVS 5.0.0 strongly encourages documentation or source code led (hybrid) testing over testing with no documentation or source, and notes that automated tools cannot fully verify many requirements, particularly business logic and access control. Supply OpenAPI or GraphQL schemas, gateway configuration and any internal design notes you are comfortable sharing. Ask the provider how they will verify that the specification matches what is deployed, since a mismatch is itself a finding worth reporting.
How DeployOpen scopes, tests and retests API engagements
DeployOpen treats the written scope and rules of engagement as the foundation of every API penetration test, not an afterthought. We agree which APIs, versions and environments are in play, what is off limits, and how testing is run, before any testing starts, then carry those decisions through the test, the report and the retest.
How we scope
- Engagements are fixed-scope, with the APIs, versions and environments agreed in writing before work starts.
- We ask for the API inventory, including deprecated versions and debug endpoints, so the scope reflects what is actually deployed.
- Rules of engagement set testing windows, prohibited actions, rate limits, test accounts and contacts for stopping a test.
How we build
- We confirm which API styles the target uses, such as REST, SOAP, GraphQL, gRPC or WebSockets, and test each one in scope.
- Testing combines documentation, specifications and tokens with authenticated and unauthenticated viewpoints, so authorization gaps are not missed.
- Test traffic is run within the agreed windows and monitored, with the client's operations team informed of timing and scope.
How we hand over
- The report states scope, method, the APIs covered, and any areas excluded, so reviewers can see what was and was not tested.
- Each finding is mapped to the relevant OWASP API Security Top 10 2023 identifier, with reproduction detail and a recommended fix.
- Deliverables are agreed in the scope document, so buyers know the report format before the test begins.
How we support
- Retesting of agreed findings is included in the written scope, so fixes can be verified against the same rules of engagement.
- Ongoing support, upgrades and continuous testing are available as a retainer for APIs that change frequently.
- When scope changes during an engagement, we record the change in writing and confirm the revised rules of engagement with you.

