Runbook 03 β Security API Integration and Failure Handling
Runbook Information
Section titled βRunbook InformationβRunbook Type: Security API Operations / Security Automation
Difficulty: Intermediate β Advanced
Primary Audience: Security Engineers / SOC Engineers / Detection Engineers / Cloud Security Engineers / Security Automation Engineers
Security Domains: SOC / SOAR / Cloud Security / Vulnerability Management / Threat Intelligence / Identity Security
Execution Model: Secure and resilient API integration workflow
Primary Goal: Build and operate reliable security integrations without allowing API failures to create unsafe security decisions
Purpose
Section titled βPurposeβModern security environments depend heavily on APIs.
Security automation may integrate with:
SIEM
SOAR
EDR / XDR
IDENTITY PROVIDERS
CLOUD PLATFORMS
VULNERABILITY MANAGEMENT
THREAT INTELLIGENCE
EMAIL SECURITY
ASSET INVENTORY
CASE MANAGEMENTA typical workflow might look like:
SIEM ALERT βIDENTITY API βASSET API βVULNERABILITY API βTHREAT INTELLIGENCE API βNORMALIZE βCORRELATE βANALYST REVIEWThe workflow is only reliable if every API dependency is handled safely.
Core Principle
Section titled βCore PrincipleβA successful API call does not automatically mean:
SUCCESSFULSECURITY OUTCOMELikewise:
API FAILUREdoes not mean:
NO SECURITY RISKThe integration must distinguish between:
NO RESULTand:
COULD NOT CHECKAPI Reliability Model
Section titled βAPI Reliability ModelβDISCOVER API βDEFINE PURPOSE βAUTHENTICATE βAUTHORIZE βBUILD REQUEST βSEND REQUEST βVALIDATE HTTP RESPONSE βVALIDATE CONTENT βHANDLE PAGINATION βNORMALIZE DATA βHANDLE PARTIAL FAILURE βRETRY WHEN SAFE βMONITOR βAUDIT βRECOVER01 β Define the Security Use Case
Section titled β01 β Define the Security Use CaseβBefore integrating an API, define:
WHY ARE WE CALLING IT?Examples:
Retrieve security alerts
Retrieve asset information
Check vulnerability findings
Collect cloud configuration
Enrich indicators
Retrieve identity context
Create approved security cases02 β Define Required Operations
Section titled β02 β Define Required OperationsβDocument whether the integration needs:
READ
SEARCH
CREATE
UPDATE
DELETEPrefer:
READ-ONLYunless writes are genuinely required.
03 β Separate Read and Write Workflows
Section titled β03 β Separate Read and Write WorkflowsβRecommended:
COLLECTION WORKFLOW βREAD-ONLY IDENTITYand separately:
APPROVED RESPONSE βCONTROLLED WRITE IDENTITY04 β Identify API Owner
Section titled β04 β Identify API OwnerβDocument:
API NAME
SERVICE OWNER
SECURITY OWNER
SUPPORT CONTACT
DOCUMENTATION LOCATION05 β Identify API Type
Section titled β05 β Identify API TypeβCommon types:
REST
GRAPHQL
SOAP
RPC
WEBHOOK
EVENT APIThis runbook primarily focuses on REST-style APIs, but the operational principles apply more broadly.
06 β Understand the Base Endpoint
Section titled β06 β Understand the Base EndpointβExample training endpoint:
http://127.0.0.1:8080/apiProduction integrations should use approved secure endpoints.
07 β Identify API Version
Section titled β07 β Identify API VersionβExamples:
/api/v1/
/api/v2/Record the expected version.
08 β Why Version Matters
Section titled β08 β Why Version MattersβAn API upgrade may change:
FIELD NAMES
DATA TYPES
PAGINATION
AUTHENTICATION
STATUS CODES
ENDPOINTS09 β Review API Documentation
Section titled β09 β Review API DocumentationβBefore implementation understand:
AUTHENTICATION
ENDPOINTS
METHODS
PARAMETERS
RATE LIMITS
PAGINATION
ERROR RESPONSES
VERSIONING10 β Authentication
Section titled β10 β AuthenticationβCommon authentication models include:
API TOKEN
OAUTH 2.0
SIGNED REQUEST
CLIENT CERTIFICATE
WORKLOAD IDENTITY
MANAGED IDENTITY11 β Prefer Short-Lived Authentication
Section titled β11 β Prefer Short-Lived AuthenticationβWhere supported prefer:
SHORT-LIVED TOKEN
WORKLOAD IDENTITY
FEDERATED IDENTITY
MANAGED IDENTITYover:
STATIC LONG-LIVED SECRET12 β Never Hardcode Production Credentials
Section titled β12 β Never Hardcode Production CredentialsβAvoid:
API_TOKEN = "real-production-secret"13 β Use Secure Credential Sources
Section titled β13 β Use Secure Credential SourcesβDepending on environment:
SECRET MANAGER
WORKLOAD IDENTITY
MANAGED IDENTITY
PROTECTED ENVIRONMENT VARIABLE14 β Environment Variable Example
Section titled β14 β Environment Variable ExampleβFor a local training lab:
export SECURITY_API_TOKEN="training-token"PowerShell:
$env:SECURITY_API_TOKEN = "training-token"15 β Validate Credential Presence
Section titled β15 β Validate Credential PresenceβBefore sending requests:
TOKEN AVAILABLE? βYES β CONTINUE
NO β STOPDo not silently send unauthenticated requests unless the endpoint is intentionally public.
16 β Never Log Credentials
Section titled β16 β Never Log CredentialsβDo not log:
API TOKEN
PASSWORD
PRIVATE KEY
SESSION TOKEN
AUTHORIZATION HEADER17 β Redact Sensitive Headers
Section titled β17 β Redact Sensitive HeadersβInstead of:
Authorization:Bearer eyJ...log:
Authorization:[REDACTED]18 β Apply Least Privilege
Section titled β18 β Apply Least PrivilegeβAsk:
WHAT IS THE MINIMUMAPI PERMISSION REQUIRED?Example:
READ FINDINGSdoes not require:
ADMINISTRATOR19 β Scope Credentials
Section titled β19 β Scope CredentialsβWhere supported restrict credentials by:
RESOURCE
ACCOUNT
SUBSCRIPTION
PROJECT
API ENDPOINT
ACTION20 β Separate Credentials by Purpose
Section titled β20 β Separate Credentials by PurposeβExample:
SECURITY INVENTORY CLIENTβ READ ONLY
CASE CREATION CLIENTβ LIMITED WRITE
ADMINISTRATIVE CLIENTβ SEPARATE / RESTRICTED21 β Credential Rotation
Section titled β21 β Credential RotationβDocument:
OWNER
EXPIRATION
ROTATION PROCESS
REVOCATION PROCESS22 β Credential Failure
Section titled β22 β Credential FailureβCommon authentication response:
401 UnauthorizedTreat it as:
AUTHENTICATION FAILUREnot:
NO SECURITY FINDINGS23 β Authorization Failure
Section titled β23 β Authorization FailureβCommon:
403 ForbiddenUsually means:
AUTHENTICATEDBUT NOT AUTHORIZED24 β Do Not Solve 403 with Admin Access
Section titled β24 β Do Not Solve 403 with Admin AccessβDetermine the exact missing permission.
Apply:
LEAST PRIVILEGE25 β Build Requests Explicitly
Section titled β25 β Build Requests ExplicitlyβEvery request should define:
METHOD
URL
HEADERS
PARAMETERS
BODY
TIMEOUT26 β Common HTTP Methods
Section titled β26 β Common HTTP MethodsβGETβ retrieve
POSTβ create/process
PUTβ replace
PATCHβ modify
DELETEβ delete27 β Treat Write Methods Carefully
Section titled β27 β Treat Write Methods CarefullyβMethods such as:
POST
PUT
PATCH
DELETEmay modify state.
Require stronger validation.
28 β Validate Destination
Section titled β28 β Validate DestinationβBefore calling an API verify:
EXPECTED HOST?
EXPECTED PROTOCOL?
EXPECTED PATH?29 β Use HTTPS for Production APIs
Section titled β29 β Use HTTPS for Production APIsβPreferred:
HTTPSnot:
HTTPexcept controlled local training environments.
30 β TLS Validation
Section titled β30 β TLS ValidationβDo not casually disable:
CERTIFICATE VALIDATIONto make an integration work.
Investigate the trust problem.
31 β Request Headers
Section titled β31 β Request HeadersβTypical headers:
Authorization
Accept
Content-Type
User-Agent32 β User-Agent
Section titled β32 β User-AgentβIdentify the automation.
Example:
GoHackersCloud-Security-Automation/1.0This can help API owners identify traffic.
33 β Correlation ID
Section titled β33 β Correlation IDβGenerate:
request_idor:
correlation_idfor each operation.
34 β Why Correlation IDs Matter
Section titled β34 β Why Correlation IDs MatterβThey connect:
AUTOMATION LOG βAPI REQUEST βAPI RESPONSE βDOWNSTREAM ACTION35 β Validate Query Parameters
Section titled β35 β Validate Query ParametersβDo not blindly pass uncontrolled values into requests.
Validate:
DATES
SEVERITY
STATUS
PAGE NUMBER
PAGE SIZE36 β Encode Query Parameters Safely
Section titled β36 β Encode Query Parameters SafelyβUse your languageβs URL/query-building functions rather than manually concatenating untrusted input.
37 β Request Body Validation
Section titled β37 β Request Body ValidationβBefore sending JSON verify:
REQUIRED FIELDS
DATA TYPES
ALLOWED VALUES
RESOURCE ID38 β Preview Write Requests
Section titled β38 β Preview Write RequestsβFor write operations:
BUILD REQUEST βDISPLAY PROPOSED CHANGE βAPPROVAL βSEND39 β Use Dry Run Where Available
Section titled β39 β Use Dry Run Where AvailableβIf the target API supports:
VALIDATE
DRY RUN
WHAT-IFuse it before impactful changes.
40 β Define Timeout
Section titled β40 β Define TimeoutβEvery external request should have a timeout.
Avoid:
REQUEST βWAIT FOREVER41 β Timeout Types
Section titled β41 β Timeout TypesβDepending on client/library:
CONNECTION TIMEOUT
READ TIMEOUT
TOTAL TIMEOUT42 β Choose Timeout Based on Service
Section titled β42 β Choose Timeout Based on ServiceβA local API might respond in:
<1 SECONDwhile a large analytics query may legitimately require longer.
Do not use one arbitrary timeout for every API.
43 β Timeout Is Not βNo Resultβ
Section titled β43 β Timeout Is Not βNo ResultββThis:
THREAT INTELLIGENCE REQUESTTIMED OUTdoes not mean:
INDICATOR IS SAFEIt means:
RESULT UNKNOWN44 β HTTP Status Classes
Section titled β44 β HTTP Status ClassesβMental model:
1XXINFORMATIONAL
2XXSUCCESS
3XXREDIRECTION
4XXCLIENT-SIDE CONDITION
5XXSERVER-SIDE FAILURE45 β 200 OK
Section titled β45 β 200 OKβUsually:
REQUEST SUCCEEDEDbut you must still validate:
BODY
SCHEMA
CONTENT46 β 201 Created
Section titled β46 β 201 CreatedβUsually indicates:
RESOURCE CREATEDFor write operations, verify the resulting resource.
47 β 204 No Content
Section titled β47 β 204 No ContentβCan represent successful operation without response content.
Do not attempt JSON parsing automatically.
48 β 400 Bad Request
Section titled β48 β 400 Bad RequestβUsually indicates:
INVALID REQUESTReview:
PARAMETERS
BODY
SCHEMA49 β 401 Unauthorized
Section titled β49 β 401 UnauthorizedβReview:
TOKEN PRESENT?
TOKEN EXPIRED?
TOKEN VALID?
AUTH FORMAT CORRECT?50 β 403 Forbidden
Section titled β50 β 403 ForbiddenβReview:
ROLE
SCOPE
PERMISSIONS
RESOURCE ACCESS51 β 404 Not Found
Section titled β51 β 404 Not FoundβCould mean:
BAD ENDPOINT
WRONG RESOURCE ID
RESOURCE REMOVED
API VERSION CHANGED52 β 409 Conflict
Section titled β52 β 409 ConflictβMay indicate:
RESOURCE ALREADY EXISTS
STATE CONFLICT
DUPLICATE OPERATIONThis is particularly relevant to idempotency.
53 β 429 Too Many Requests
Section titled β53 β 429 Too Many RequestsβMeans:
RATE LIMITDo not continuously hammer the API.
54 β 500 Internal Server Error
Section titled β54 β 500 Internal Server ErrorβUsually:
SERVER-SIDE FAILUREMay be retryable.
55 β 502 / 503 / 504
Section titled β55 β 502 / 503 / 504βOften represent temporary service or gateway conditions.
These may be candidates for controlled retry.
56 β Build Status Handling Matrix
Section titled β56 β Build Status Handling Matrixβ| Status | Meaning | Typical Action |
|---|---|---|
| 200 | Success | Validate body |
| 201 | Created | Verify resource |
| 204 | Success/no body | Continue |
| 400 | Bad request | Fix request |
| 401 | Authentication | Stop/review credential |
| 403 | Authorization | Review permissions |
| 404 | Not found | Validate endpoint/resource |
| 409 | Conflict | Check idempotency/state |
| 429 | Rate limited | Backoff |
| 500 | Server error | Controlled retry |
| 503 | Unavailable | Retry/escalate |
57 β Do Not Treat All Errors the Same
Section titled β57 β Do Not Treat All Errors the SameβBad design:
ANY ERROR βRETRYBetter:
ERROR βCLASSIFY βRETRY?STOP?ESCALATE?58 β Response Validation
Section titled β58 β Response ValidationβAfter receiving:
HTTP 200ask:
IS BODY PRESENT?
IS IT EXPECTED FORMAT?
IS JSON VALID?
IS SCHEMA VALID?
ARE REQUIRED FIELDS PRESENT?59 β Successful HTTP β Valid Data
Section titled β59 β Successful HTTP β Valid DataβExample:
200 OKwith:
{ "error": "backend unavailable"}may still represent an unusable application response.
60 β Validate Content-Type
Section titled β60 β Validate Content-TypeβExpected:
application/jsonbut server returns:
text/htmlThis may indicate:
PROXY ERROR
LOGIN PAGE
SERVICE FAILURE61 β JSON Parsing
Section titled β61 β JSON ParsingβHandle malformed JSON safely.
Example:
HTTP 200 βINVALID JSON βRECORD FAILURE βDO NOT CRASH ENTIRE WORKFLOW62 β Validate Top-Level Structure
Section titled β62 β Validate Top-Level StructureβExpected:
{ "results": []}Do not assume every JSON object is valid.
63 β Validate Required Fields
Section titled β63 β Validate Required FieldsβExample finding requires:
id
asset
severity
status64 β Handle Missing Fields
Section titled β64 β Handle Missing FieldsβPossible response:
QUARANTINE RECORD
MARK FIELD UNKNOWN
CONTINUE WITH WARNINGdepending on field importance.
65 β Validate Types
Section titled β65 β Validate TypesβExample:
scoreexpected:
NUMBERbut received:
"critical"Treat as schema/data problem.
66 β Validate Enumerations
Section titled β66 β Validate EnumerationsβIf expected severity is:
critical
high
medium
lowand API returns:
urgentdo not silently map it unless documented.
67 β Preserve Raw Response
Section titled β67 β Preserve Raw ResponseβFor troubleshooting, preserve an approved raw response where appropriate.
Example:
raw-api-response.jsonBe careful not to persist:
TOKENS
SENSITIVE HEADERS
UNNECESSARY SENSITIVE DATA68 β Record API Provenance
Section titled β68 β Record API ProvenanceβNormalized data should contain:
source_api
endpoint
collection_time
api_version69 β Pagination
Section titled β69 β PaginationβMany APIs return only part of a dataset.
Example:
PAGE 1100 RECORDS
PAGE 2100 RECORDS
PAGE 345 RECORDS70 β Common Pagination Models
Section titled β70 β Common Pagination ModelsβPAGE NUMBER
OFFSET/LIMIT
CURSOR
CONTINUATION TOKEN
NEXT LINK71 β Detect Pagination Model
Section titled β71 β Detect Pagination ModelβRead the API documentation.
Do not assume:
page=1works for every API.
72 β Page Number Model
Section titled β72 β Page Number ModelβExample:
?page=1&page_size=10073 β Offset Model
Section titled β73 β Offset ModelβExample:
?offset=0&limit=10074 β Cursor Model
Section titled β74 β Cursor ModelβExample response:
{ "results": [], "next_cursor": "abc123"}75 β Next-Link Model
Section titled β75 β Next-Link ModelβSome APIs provide:
nextor:
nextLinkFollow only validated links expected for the trusted service.
76 β Pagination Safety
Section titled β76 β Pagination SafetyβDefine:
MAXIMUM PAGES
MAXIMUM RECORDS
TIME LIMIT77 β Prevent Infinite Pagination
Section titled β77 β Prevent Infinite PaginationβA broken API might return:
same next cursorforeverTrack previously seen cursors.
78 β Detect Duplicate Pages
Section titled β78 β Detect Duplicate PagesβFingerprint page content or track stable record IDs where appropriate.
79 β Record Pagination Metrics
Section titled β79 β Record Pagination MetricsβTrack:
pages_processed
records_received
duplicate_records80 β Validate Total Count
Section titled β80 β Validate Total CountβIf API reports:
total = 1,000but you receive:
700mark:
INCOMPLETE COLLECTION81 β Rate Limiting
Section titled β81 β Rate LimitingβAPIs often restrict:
REQUESTS / SECOND
REQUESTS / MINUTE
REQUESTS / DAY82 β Respect Rate Limits
Section titled β82 β Respect Rate LimitsβDo not attempt to bypass legitimate service rate controls.
Instead:
SLOW DOWN
CACHE
BATCH
BACKOFF83 β Retry-After
Section titled β83 β Retry-AfterβA 429 response may include:
Retry-AfterHonor it where appropriate.
84 β Rate-Limit Headers
Section titled β84 β Rate-Limit HeadersβSome services expose:
X-RateLimit-Limit
X-RateLimit-Remaining
X-RateLimit-ResetNames vary by provider.
85 β Monitor Remaining Quota
Section titled β85 β Monitor Remaining QuotaβIf available, record:
REMAINING REQUESTSto prevent unexpected service disruption.
86 β Caching
Section titled β86 β CachingβCache data when:
SOURCE CHANGES SLOWLY
MULTIPLE ALERTS NEED SAME DATAExample:
ASSET CRITICALITYmay not need an API request for every alert.
87 β Define Cache TTL
Section titled β87 β Define Cache TTLβEvery cache needs:
EXPIRATIONExample:
IDENTITY CONTEXTβ 15 minutes
ASSET INVENTORYβ 1 hourThese are examples only.
88 β Stale Cache Risk
Section titled β88 β Stale Cache RiskβCaching reduces:
API LOADbut can increase:
DATA STALENESSBalance both.
89 β Retry Strategy
Section titled β89 β Retry StrategyβRetry only when failure is likely temporary.
Typical candidates:
TIMEOUT
429
500
502
503
50490 β Usually Do Not Retry
Section titled β90 β Usually Do Not RetryβWithout a specific reason, avoid retrying:
400
401
403
40491 β Retry Limit
Section titled β91 β Retry LimitβAlways define:
MAX RETRIES92 β Exponential Backoff
Section titled β92 β Exponential BackoffβExample:
ATTEMPT 1 βWAIT 1 SECOND
ATTEMPT 2 βWAIT 2 SECONDS
ATTEMPT 3 βWAIT 4 SECONDS
STOP93 β Add Jitter
Section titled β93 β Add JitterβAt scale, many workers retrying simultaneously can create:
THUNDERING HERDUse randomized:
JITTERwhere appropriate.
94 β Retry Budget
Section titled β94 β Retry BudgetβDefine how much total time the workflow may spend retrying.
Example:
MAX RETRIES:3
MAX TOTAL RETRY TIME:30 seconds95 β Retry Only Safe Operations
Section titled β95 β Retry Only Safe OperationsβA GET is generally easier to retry than a write operation.
96 β Write Retry Risk
Section titled β96 β Write Retry RiskβExample:
POST /ticketstimes out.
Did the server:
CREATE THE TICKETbefore the timeout?
Unknown.
Blind retry could create:
DUPLICATE TICKET97 β Idempotency
Section titled β97 β IdempotencyβDesign writes so repeated requests do not create unintended duplicate effects.
98 β Idempotency Key
Section titled β98 β Idempotency KeyβWhere supported:
Idempotency-Key:ALERT-100199 β Application-Level Deduplication
Section titled β99 β Application-Level DeduplicationβBefore creating a resource:
SEARCH EXISTING βEXISTS? β β YES NO β βUSE CREATEEXISTING100 β Stable Security IDs
Section titled β100 β Stable Security IDsβUseful identifiers:
ALERT ID
FINDING ID
INCIDENT ID
EVENT ID
ASSET ID101 β Write Verification
Section titled β101 β Write VerificationβAfter:
POST
PATCH
PUTverify the resulting state.
102 β Example
Section titled β102 β ExampleβRequest:
CREATE CASEResponse:
201 CreatedThen retrieve:
CASE IDand verify:
EXPECTED FIELDS103 β Never Assume Response Means Outcome
Section titled β103 β Never Assume Response Means OutcomeβSecurity automation should use:
REQUEST βRESPONSE βVERIFICATION104 β Partial Failure
Section titled β104 β Partial FailureβMulti-API workflows frequently partially fail.
Example:
IDENTITY APIβ
CMDB APIβ
VULNERABILITY APIβ
THREAT INTEL APIβ105 β Do Not Discard Good Data
Section titled β105 β Do Not Discard Good DataβResult:
PARTIAL CONTEXTrather than:
TOTAL FAILUREwhen the use case permits.
106 β Mark Missing Context
Section titled β106 β Mark Missing ContextβExample:
{ "identity_context": "available", "asset_context": "available", "vulnerability_context": "unavailable", "threat_intel_context": "available"}107 β Decision Safety
Section titled β107 β Decision SafetyβIf a missing dependency is critical for the decision:
STOP AUTOMATED ACTIONand:
REQUIRE HUMAN REVIEW108 β Example
Section titled β108 β ExampleβIf identity verification fails during proposed account containment:
DO NOT ASSUMEIDENTITY IS MALICIOUSEscalate.
109 β Graceful Degradation
Section titled β109 β Graceful DegradationβDesign:
FULL CONTEXT βNORMAL WORKFLOW
PARTIAL CONTEXT βLIMITED ANALYSIS βANALYST REVIEW110 β Critical Dependency Classification
Section titled β110 β Critical Dependency ClassificationβClassify API dependencies:
OPTIONAL
IMPORTANT
CRITICAL111 β Optional Dependency
Section titled β111 β Optional DependencyβExample:
GEOGRAPHIC IP ENRICHMENTmay not prevent basic alert triage.
112 β Critical Dependency
Section titled β112 β Critical DependencyβExample:
IDENTITY VERIFICATIONmay be required before an identity response action.
113 β Dependency Matrix
Section titled β113 β Dependency Matrixβ| API | Purpose | Criticality | Failure Behavior |
|---|---|---|---|
| Identity | User context | Critical | Stop write action |
| CMDB | Asset context | Important | Mark unknown |
| Threat Intel | IOC context | Important | Mark unavailable |
| Reporting | Dashboard | Optional | Queue report |
114 β Circuit Breaker Concept
Section titled β114 β Circuit Breaker ConceptβIf an API repeatedly fails:
REQUEST βFAIL βFAIL βFAIL βSTOP TEMPORARY CALLSThis prevents repeatedly overwhelming a failing service.
115 β Circuit Breaker States
Section titled β115 β Circuit Breaker StatesβConceptually:
CLOSEDβ requests allowed
OPENβ requests blocked temporarily
HALF-OPENβ limited test requests116 β Circuit Breaker Benefit
Section titled β116 β Circuit Breaker BenefitβIt can reduce:
UNNECESSARY LOAD
LONG TIMEOUT CHAINS
CASCADE FAILURE117 β Dependency Isolation
Section titled β117 β Dependency IsolationβOne failing API should not unnecessarily crash:
ALL SECURITY AUTOMATIONSeparate dependencies where possible.
118 β Bulkhead Concept
Section titled β118 β Bulkhead ConceptβArchitecture:
IDENTITY WORKERS β βββ isolated βVULNERABILITY WORKERS β βββ isolated βTHREAT INTEL WORKERSFailure in one pool should not consume all resources.
119 β Concurrency
Section titled β119 β ConcurrencyβParallel API requests can improve performance but increase:
RATE-LIMIT RISK
RESOURCE USAGE
COMPLEXITY120 β Limit Concurrency
Section titled β120 β Limit ConcurrencyβDefine:
MAX WORKERSrather than unlimited parallel requests.
121 β Backpressure
Section titled β121 β BackpressureβIf downstream systems cannot keep up:
SLOW INPUTrather than building an unlimited queue.
122 β Queue-Based Integration
Section titled β122 β Queue-Based IntegrationβFor larger systems:
EVENT βQUEUE βWORKER βAPI βRESULTcan improve resilience.
123 β Dead-Letter Queue
Section titled β123 β Dead-Letter QueueβRepeated failures can move to:
DLQfor review.
124 β DLQ Record
Section titled β124 β DLQ RecordβInclude:
request_id
operation
attempt_count
last_error
timestampDo not include unnecessary secrets.
125 β Webhooks
Section titled β125 β WebhooksβSome APIs send data to you.
Flow:
SECURITY PLATFORM βWEBHOOK βYOUR RECEIVER βVALIDATE βQUEUE βPROCESS126 β Never Trust Webhook Input Automatically
Section titled β126 β Never Trust Webhook Input AutomaticallyβValidate:
SOURCE
AUTHENTICITY
SIGNATURE
SCHEMA
TIMESTAMPaccording to provider documentation.
127 β Replay Protection
Section titled β127 β Replay ProtectionβWhere supported, validate:
TIMESTAMP
EVENT ID
NONCEto reduce duplicate/replayed processing.
128 β Webhook Acknowledgement
Section titled β128 β Webhook AcknowledgementβDo not perform long analysis before acknowledging if the provider expects a fast response.
Possible design:
WEBHOOK βVALIDATE βQUEUE βACKNOWLEDGE βPROCESS ASYNC129 β API Schema Drift
Section titled β129 β API Schema DriftβAPIs change.
Possible changes:
NEW FIELD
REMOVED FIELD
RENAMED FIELD
TYPE CHANGE
ENUM CHANGE130 β Detect Schema Drift
Section titled β130 β Detect Schema DriftβTrack:
EXPECTED FIELDS
UNEXPECTED FIELDS
TYPE MISMATCHES131 β Do Not Ignore Missing Critical Fields
Section titled β131 β Do Not Ignore Missing Critical FieldsβExample:
asset_idsuddenly missing from 80% of records.
This should trigger:
PIPELINE INVESTIGATION132 β Adapter Pattern
Section titled β132 β Adapter PatternβUse:
PROVIDER API βPROVIDER ADAPTER βCOMMON SECURITY MODEL133 β Why Adapters Help
Section titled β133 β Why Adapters HelpβIf the API changes:
UPDATE ADAPTERinstead of rewriting:
ALL DOWNSTREAM ANALYTICS134 β API Version Upgrade
Section titled β134 β API Version UpgradeβBefore changing versions:
READ CHANGELOG
TEST NEW VERSION
COMPARE OUTPUT
UPDATE MAPPINGS
RUN REGRESSION TESTS135 β Parallel Version Testing
Section titled β135 β Parallel Version TestingβWhere practical:
V1 βNORMALIZED OUTPUT A
V2 βNORMALIZED OUTPUT B
COMPARE136 β API Deprecation
Section titled β136 β API DeprecationβTrack:
DEPRECATION DATE
MIGRATION DEADLINE
OWNER
REPLACEMENT VERSION137 β Observability
Section titled β137 β ObservabilityβMonitor:
REQUEST COUNT
SUCCESS RATE
ERROR RATE
LATENCY
TIMEOUT RATE
RETRY RATE
429 RATE
5XX RATE138 β API Health Dashboard
Section titled β138 β API Health DashboardβExample:
Identity APISuccess: 99.9%Latency: 180 ms429: 0
Threat Intel APISuccess: 82%Latency: 3.2 sTimeouts: Elevated139 β Availability Is Not Enough
Section titled β139 β Availability Is Not EnoughβAn API may be:
UPbut returning:
STALE
INCOMPLETE
INVALIDdata.
Monitor:
DATA QUALITYas well.
140 β Data Freshness
Section titled β140 β Data FreshnessβTrack:
LAST SUCCESSFUL COLLECTION
LATEST SOURCE TIMESTAMP141 β Latency Percentiles
Section titled β141 β Latency PercentilesβAt larger scale monitor:
P50
P95
P99rather than only average latency.
142 β Error Budget Concept
Section titled β142 β Error Budget ConceptβDefine acceptable reliability for the integration.
Example:
TARGET:99.5% successful enrichmentUse organizational requirements rather than arbitrary numbers.
143 β Structured API Logging
Section titled β143 β Structured API LoggingβExample:
{ "request_id": "REQ-1001", "service": "asset-api", "method": "GET", "status": 200, "duration_ms": 184}144 β Do Not Log Full URLs Blindly
Section titled β144 β Do Not Log Full URLs BlindlyβURLs can contain:
TOKENS
USER DATA
QUERY SECRETSRedact sensitive parameters.
145 β Log Failure Category
Section titled β145 β Log Failure CategoryβUse:
authentication
authorization
timeout
rate_limit
server_error
schema_error
validation_error146 β Avoid Only Logging Exception Text
Section titled β146 β Avoid Only Logging Exception TextβStructured categories make it easier to:
SEARCH
TREND
ALERT147 β Request Metrics
Section titled β147 β Request MetricsβTrack:
api_requests_total
api_requests_success
api_requests_failed
api_retries_total
api_timeouts_total148 β Dependency Metrics
Section titled β148 β Dependency MetricsβTrack separately per:
SERVICE
ENDPOINT
OPERATION149 β Alert Thresholds
Section titled β149 β Alert ThresholdsβExamples:
ERROR RATE SPIKE
NO SUCCESSFUL REQUEST
HIGH LATENCY
REPEATED 401
REPEATED 429
SCHEMA FAILURE150 β Repeated 401
Section titled β150 β Repeated 401βMay indicate:
TOKEN EXPIRED
ROTATION FAILURE
AUTH CONFIGURATION CHANGE151 β Repeated 403
Section titled β151 β Repeated 403βMay indicate:
PERMISSION CHANGE
ROLE REMOVAL
SCOPE CHANGE152 β Repeated 404
Section titled β152 β Repeated 404βMay indicate:
API VERSION REMOVED
RESOURCE PATH CHANGED153 β Repeated 429
Section titled β153 β Repeated 429βMay indicate:
REQUEST VOLUME INCREASE
BAD CACHE
CONCURRENCY TOO HIGH
PAGINATION LOOP154 β Repeated 5XX
Section titled β154 β Repeated 5XXβPossible:
SERVICE OUTAGE
PROVIDER INCIDENT
DEPENDENCY FAILURE155 β Escalation
Section titled β155 β EscalationβEscalate when:
CRITICAL API UNAVAILABLE
AUTHENTICATION BROKEN
SCHEMA CHANGE BREAKS PROCESSING
DATA QUALITY UNTRUSTWORTHY
HIGH-IMPACT ACTION CANNOT BE VERIFIED156 β API Outage Procedure
Section titled β156 β API Outage ProcedureβWhen an important API is unavailable:
CONFIRM FAILURE βCLASSIFY DEPENDENCY βSTOP UNSAFE ACTIONS βENABLE DEGRADED MODE βRECORD COVERAGE GAP βNOTIFY OWNER βMONITOR RECOVERY157 β Confirm the Failure
Section titled β157 β Confirm the FailureβCheck:
ONE REQUEST?
MULTIPLE REQUESTS?
MULTIPLE WORKERS?
HEALTH ENDPOINT?
SERVICE STATUS?Avoid declaring an outage from one transient timeout.
158 β Degraded Mode
Section titled β158 β Degraded ModeβExample:
THREAT INTEL API DOWNWorkflow may continue:
ALERT TRIAGEbut mark:
THREAT INTELLIGENCEUNAVAILABLE159 β Disable Unsafe Response
Section titled β159 β Disable Unsafe ResponseβIf a required verification API is unavailable:
PAUSEAUTOMATED RESPONSEwhile allowing:
READ-ONLY COLLECTIONwhere safe.
160 β Recovery
Section titled β160 β RecoveryβWhen service returns:
HEALTH CHECK βTEST REQUEST βVALIDATE SCHEMA βVALIDATE DATA βRESUME LIMITED TRAFFIC βMONITOR βFULL RECOVERY161 β Do Not Resume Full Load Immediately
Section titled β161 β Do Not Resume Full Load ImmediatelyβPrefer:
CANARY REQUESTSbefore restoring large request volume.
162 β Process Backlog Carefully
Section titled β162 β Process Backlog CarefullyβAfter an outage you may have:
10,000 QUEUED REQUESTSDo not send them all simultaneously.
Use:
RATE CONTROL
BATCHING
PRIORITIZATION163 β Backlog Prioritization
Section titled β163 β Backlog PrioritizationβProcess:
CRITICAL CURRENT EVENTSbefore:
LOW-PRIORITY STALE ENRICHMENTwhen appropriate.
164 β Stale Request Review
Section titled β164 β Stale Request ReviewβSome queued actions may no longer be relevant after a long outage.
Revalidate before processing.
165 β Recovery Verification
Section titled β165 β Recovery VerificationβConfirm:
REQUEST SUCCESS
DATA VALID
LATENCY NORMAL
ERROR RATE NORMAL
BACKLOG DECREASING166 β API Incident Record
Section titled β166 β API Incident RecordβDocument:
START TIME
SERVICE
IMPACT
FAILURE MODE
AFFECTED WORKFLOWS
SAFETY ACTIONS
RECOVERY TIME
ROOT CAUSE
FOLLOW-UP167 β API Failure Matrix
Section titled β167 β API Failure MatrixβMaintain:
| Failure | Retry? | Workflow |
|---|---|---|
| Timeout | Usually limited | Degraded |
| 400 | No | Fix request |
| 401 | No | Auth review |
| 403 | No | Permission review |
| 404 | Usually no | Endpoint review |
| 429 | Yes, controlled | Backoff |
| 500 | Limited | Retry/degraded |
| Invalid JSON | Usually no | Schema/data review |
| Missing critical field | No | Quarantine |
168 β Safe Write Workflow
Section titled β168 β Safe Write WorkflowβFor any API that modifies security state:
DETECT βVALIDATE βENRICH βPROPOSE ACTION βPREVIEW βHUMAN APPROVAL βWRITE βVERIFY βAUDIT169 β Example Case Creation
Section titled β169 β Example Case CreationβLow-impact example:
CRITICAL VULNERABILITY βVALIDATE FINDING βMAP OWNER βCHECK EXISTING CASE βCREATE CASE βVERIFY CASE170 β Example Identity Response
Section titled β170 β Example Identity ResponseβHigher-impact:
SUSPICIOUS IDENTITY ALERT βVERIFY IDENTITY βCOLLECT EVIDENCE βANALYST REVIEW βAPPROVED RESPONSE βVERIFY STATE171 β Avoid Autonomous Destructive API Workflows
Section titled β171 β Avoid Autonomous Destructive API WorkflowsβDo not design generic automation that automatically:
DELETES CLOUD RESOURCES
DISABLES SECURITY LOGGING
REMOVES SECURITY CONTROLS
MASS-CHANGES IAM
MODIFIES FIREWALLSwithout appropriate authorization, governance, testing, and safeguards.
172 β Security API Threat Model
Section titled β172 β Security API Threat ModelβConsider threats against:
API CREDENTIAL
API CLIENT
CONFIGURATION
REQUEST DATA
RESPONSE DATA
CACHE
QUEUE
LOGS173 β Credential Theft
Section titled β173 β Credential TheftβIf a token is compromised:
REVOKE
ROTATE
INVESTIGATE USE
REVIEW PERMISSIONS174 β Excessive Permissions
Section titled β174 β Excessive PermissionsβIf integration has unnecessary privileges:
REDUCE SCOPEDo not wait for an incident.
175 β Malicious or Unexpected Response Data
Section titled β175 β Malicious or Unexpected Response DataβTreat API response data as:
UNTRUSTED INPUTValidate before:
DATABASE INSERT
REPORTING
DOWNSTREAM ACTION176 β API Supply Chain Consideration
Section titled β176 β API Supply Chain ConsiderationβExternal services introduce:
DEPENDENCY RISKUnderstand:
WHAT DATA IS SENT?
WHAT ACCESS EXISTS?
WHAT HAPPENS IF SERVICE FAILS?177 β Data Minimization
Section titled β177 β Data MinimizationβSend only required data.
Do not send an entire incident record when the API only requires:
ONE HASH178 β Sensitive Data
Section titled β178 β Sensitive DataβBe cautious with:
USER INFORMATION
INTERNAL HOSTNAMES
PRIVATE IPS
INCIDENT DETAILS
CUSTOMER DATA179 β API Response Storage
Section titled β179 β API Response StorageβDo not retain full responses forever without a reason.
Define:
RETENTION
ACCESS CONTROL
ENCRYPTION180 β API Integration Testing
Section titled β180 β API Integration TestingβTest:
SUCCESS
AUTH FAILURE
PERMISSION FAILURE
NOT FOUND
RATE LIMIT
TIMEOUT
SERVER ERROR
INVALID JSON
MISSING FIELD
WRONG TYPE
EMPTY RESPONSE181 β Test Pagination
Section titled β181 β Test PaginationβInclude:
ONE PAGE
MULTIPLE PAGES
EMPTY PAGE
REPEATED CURSOR
MISSING NEXT CURSOR182 β Test Retry Logic
Section titled β182 β Test Retry LogicβVerify:
RETRYABLE ERRORβ RETRIES
NON-RETRYABLE ERRORβ DOES NOT RETRY183 β Test Backoff
Section titled β183 β Test BackoffβConfirm retries are not:
IMMEDIATEand do not overload the service.
184 β Test Write Idempotency
Section titled β184 β Test Write IdempotencyβRun the same synthetic write request twice.
Expected:
ONE LOGICAL RESULTnot:
TWO DUPLICATE RESULTS185 β Test Partial Failure
Section titled β185 β Test Partial FailureβExample:
3 APIS
2 SUCCESS
1 FAILUREVerify output clearly states:
PARTIAL CONTEXT186 β Test Recovery
Section titled β186 β Test RecoveryβSimulate:
API DOWN βAPI RECOVERSVerify:
CIRCUIT RECOVERS
BACKLOG PROCESSES
NO REQUEST STORM187 β Test Schema Drift
Section titled β187 β Test Schema DriftβChange synthetic response:
severityto:
risk_levelThe integration should:
DETECT FAILURErather than silently produce bad data.
188 β Test Unknown Enumeration
Section titled β188 β Test Unknown EnumerationβReturn:
severity = urgentVerify:
UNKNOWN / QUARANTINEaccording to policy.
189 β Test Missing Token
Section titled β189 β Test Missing TokenβExpected:
FAIL BEFORE REQUEST190 β Test Wrong Token
Section titled β190 β Test Wrong TokenβExpected:
401 βNO RETRY LOOP βAUTHENTICATION ERROR191 β Test Service Offline
Section titled β191 β Test Service OfflineβExpected:
CONNECTION FAILURE βBOUNDED RETRY βDEGRADED MODE192 β Test Slow API
Section titled β192 β Test Slow APIβSimulate response exceeding timeout.
Expected:
TIMEOUT βCONTROLLED RETRY βFAILURE STATUS193 β Test Invalid Endpoint
Section titled β193 β Test Invalid EndpointβExpected:
404 βNO BLIND RETRY194 β Test 429
Section titled β194 β Test 429βExpected:
429 βREAD RETRY-AFTER βWAIT βRETRY WITHIN BUDGET195 β Test 500
Section titled β195 β Test 500βExpected:
500 βCONTROLLED RETRY βBACKOFF βDEGRADED MODEif still failing.
196 β API Readiness Checklist
Section titled β196 β API Readiness ChecklistβBefore production:
- Security use case documented
- API owner identified
- Documentation reviewed
- API version documented
- Required endpoints documented
- Read/write operations identified
- Least privilege implemented
- Credentials securely stored
- Credential rotation defined
- HTTPS used where required
- TLS validation enabled
- Timeouts configured
- Status handling implemented
- JSON validation implemented
- Schema validation implemented
- Pagination implemented
- Pagination limits configured
- Rate limits understood
- Retry-After handled where appropriate
- Retries bounded
- Backoff implemented
- Write idempotency considered
- Partial failures represented correctly
- Critical dependencies identified
- Degraded mode defined
- Observability implemented
- Secrets excluded from logs
- Data freshness monitored
- Recovery tested
- API owner escalation documented
197 β Operational API Checklist
Section titled β197 β Operational API ChecklistβDuring each integration run:
- Authentication available
- API endpoint reachable
- Expected version available
- Request ID generated
- Request validated
- Timeout applied
- HTTP status checked
- Content type checked
- Response schema validated
- Pagination completed
- Duplicate records handled
- Rate limits respected
- Partial failures recorded
- Data normalized
- Collection metrics generated
- Security decision reflects missing context
198 β API Failure Investigation Template
Section titled β198 β API Failure Investigation TemplateβUse:
INCIDENT ID:
API:
ENDPOINT:
FIRST FAILURE:
LAST SUCCESS:
HTTP STATUS:
ERROR CATEGORY:
REQUEST ID:
AFFECTED WORKFLOW:
AFFECTED DATA:
DEPENDENCY CRITICALITY:
RETRY ATTEMPTS:
DEGRADED MODE:
SECURITY IMPACT:
OWNER:
RECOVERY STATUS:199 β API Change Review Template
Section titled β199 β API Change Review TemplateβBefore API migration:
CURRENT VERSION:
NEW VERSION:
DEPRECATION DATE:
AUTHENTICATION CHANGES:
ENDPOINT CHANGES:
SCHEMA CHANGES:
PAGINATION CHANGES:
RATE LIMIT CHANGES:
TEST RESULTS:
ROLLBACK PLAN:
APPROVER:200 β Integration Health Template
Section titled β200 β Integration Health TemplateβSERVICE:
STATUS:
LAST SUCCESS:
SUCCESS RATE:
ERROR RATE:
AVERAGE LATENCY:
P95 LATENCY:
TIMEOUT RATE:
429 RATE:
5XX RATE:
DATA FRESHNESS:
QUEUE DEPTH:
OWNER:201 β API Failure Decision Tree
Section titled β201 β API Failure Decision TreeβAPI REQUEST FAILED βWHAT TYPE? β βββββββΌββββββββββ¬ββββββββββ β β β β401 403 429 5XX β β β βAUTH PERMISSION BACKOFF RETRYREVIEW REVIEW β β LIMIT BOUNDED RETRY RETRYThen:
STILL FAILED? βIS DEPENDENCY CRITICAL? β ββββββ΄βββββ β βYES NO β βSTOP DEGRADEDUNSAFE MODEACTION βHUMANREVIEW202 β Security Decision Model
Section titled β202 β Security Decision ModelβNever design:
API RETURNED NOTHING βNO RISKUse:
API RETURNEDVALID EMPTY RESULT βNO MATCH FROM THIS SOURCEversus:
API FAILED βUNKNOWN203 β Reliability Mental Model
Section titled β203 β Reliability Mental ModelβREQUEST βDID IT CONNECT? βDID AUTH WORK? βWAS ACCESS ALLOWED? βDID HTTP SUCCEED? βIS CONTENT VALID? βIS SCHEMA VALID? βIS DATA COMPLETE? βIS PAGINATION COMPLETE? βIS DATA FRESH? βCAN I TRUST ITFOR THIS DECISION?204 β Security API Safety Equation
Section titled β204 β Security API Safety EquationβSECURE AUTHENTICATION +LEAST PRIVILEGE +VALIDATION +TIMEOUTS +CONTROLLED RETRIES +RATE-LIMIT HANDLING +IDEMPOTENCY +OBSERVABILITY +SAFE FAILURE =RELIABLE SECURITY APIINTEGRATION205 β Key Lesson
Section titled β205 β Key LessonβRemember:
NO MATCHIS NOT THE SAME ASNO DATAand:
NO DATAIS NOT THE SAME ASAPI FAILURE206 β Final Mental Model
Section titled β206 β Final Mental ModelβWhenever your security automation calls an API, ask:
WHY AM I CALLING IT? βWHAT ACCESS DO I NEED? βHOW DO I AUTHENTICATE? βIS THE CONNECTION TRUSTED? βWHAT IS MY TIMEOUT? βWHAT HTTP STATUS DID I GET? βIS THE RESPONSE VALID? βIS THE SCHEMA EXPECTED? βIS THERE PAGINATION? βAM I RATE LIMITED? βSHOULD I RETRY? βIS THE OPERATION IDEMPOTENT? βIS ANY CONTEXT MISSING? βCAN I SAFELY MAKETHE SECURITY DECISION?Runbook Outcome
Section titled βRunbook OutcomeβAfter completing this runbook, your security API integrations should be designed to:
AUTHENTICATE SECURELY
USE LEAST PRIVILEGE
VALIDATE REQUESTS
VALIDATE RESPONSES
HANDLE TIMEOUTS
CLASSIFY HTTP FAILURES
RESPECT RATE LIMITS
PROCESS PAGINATION
RETRY SAFELY
PREVENT DUPLICATE WRITES
HANDLE PARTIAL FAILURE
OPERATE IN DEGRADED MODE
MONITOR DEPENDENCIES
RECOVER SAFELYThe objective is not simply:
MAKE THE API CALL WORKThe objective is:
MAKE THE SECURITY WORKFLOWRELIABLE WHEN THE APIDOES NOT WORKWhatβs Next?
Section titled βWhatβs Next?ββ‘οΈ Runbook 04 β SOC Alert Enrichment, Correlation and Triage
The next runbook moves from reliable data collection and API integration into operational SOC decision support.
You will build a repeatable process for:
SECURITY ALERT βVALIDATE βNORMALIZE βDEDUPLICATE βIDENTITY CONTEXT βASSET CONTEXT βIOC CONTEXT βVULNERABILITY CONTEXT βCORRELATE βPRIORITIZE βTRIAGE RECOMMENDATION βANALYST REVIEW βESCALATE / CLOSEThe goal will be to transform raw security alerts into context-rich, explainable, analyst-ready investigations while keeping final security decisions and disruptive response actions under appropriate human control.