Skip to main content

Api Troubleshooting

Deep API Troubleshooting Guide

Goal

API troubleshooting is about finding where the failure is happening:

Client/App → Network → API Gateway → Authentication → Backend Service → Database/External System

A good implementation engineer isolates the layer before escalating.


1. Start With 4 Basic Questions

QuestionWhy It Matters
What is expected to happen?Defines success
What actually happens?Defines the failure
Is it reproducible?Separates one-time issue from systemic issue
Who is affected?Helps identify scope

Example:

Expected: CRM ticket is created after chat ends.
Actual: Chat ends, but no CRM ticket appears.
Scope: One customer environment, all agents.

2. Identify the API Direction

DirectionMeaningExample
Inbound APICustomer system calls platform APICRM calls Glia API
Outbound APIPlatform calls customer systemGlia calls CRM API
WebhookEvent notification sent automaticallyChat ended → CRM ticket
CallbackResponse sent after async processPayment status update

This matters because it tells you which side to check first.


3. Check the HTTP Method

MethodTroubleshooting Focus
GETIs the resource ID correct?
POSTIs the payload valid?
PUTAre all required fields included?
PATCHAre updated fields allowed?
DELETEDoes the user/token have delete permission?

Example issue:

GET /api/create-ticket

But the API expects:

POST /api/create-ticket

Likely result:

405 Method Not Allowed

4. Check the Endpoint

Validate:

Base URL
API version
Path
Resource ID
Query parameters
Environment

Example:

https://api.vendor.com/v1/customers/12345

Common mistakes:

ProblemExample
Wrong environmentUsing sandbox instead of production
Wrong API version/v1/ instead of /v2/
Typo in endpoint/costumers/ instead of /customers/
Missing resource ID/customers/ instead of /customers/12345

5. Check Headers

Important headers:

HeaderPurpose
AuthorizationSends bearer token/API key
Content-TypeFormat of request body
AcceptFormat expected in response
x-api-keyAPI key authentication
Correlation-IDRequest tracking

Example:

Authorization: Bearer eyJhbGc...
Content-Type: application/json
Accept: application/json

Common issue:

Content-Type missing

API may not understand the JSON body.


6. Check Authentication

Most API failures happen here.

ErrorMeaningCommon Cause
401Not authenticatedMissing/expired/invalid token
403Authenticated but blockedMissing permission/scope/role

401 Checklist

Check:

Is Authorization header present?
Is token expired?
Is token copied correctly?
Is token for the right environment?
Was token revoked?

403 Checklist

Check:

Does token have correct scope?
Does user/app have permission?
Is IP allowlisting required?
Is this endpoint restricted?

7. Check OAuth Scope

Scopes define what the token can do.

Example:

read:customers
write:tickets
admin

If token only has:

read:customers

but you call:

POST /api/tickets

You may get:

403 Forbidden

8. Check the JSON Payload

For POST/PUT/PATCH, inspect payload carefully.

Example:

{
  "customerId": "12345",
  "channel": "chat",
  "authenticated": true
}

Validate:

ItemExample Problem
SyntaxMissing comma
Required fieldsMissing customerId
Data type"true" instead of true
Field namecustomerID instead of customerId
NestingObject expected, string sent
Array formatSingle value sent instead of list

9. Understand Status Codes by Category

Code RangeMeaning
2xxSuccess
3xxRedirect
4xxClient/request issue
5xxServer/backend issue

Important Codes

CodeMeaningFirst Place To Look
200SuccessValidate response body
201CreatedConfirm resource ID returned
204No ContentSuccess, but no body
400Bad RequestPayload/parameters
401UnauthorizedAuthentication
403ForbiddenPermissions/scopes
404Not FoundEndpoint/resource
405Method Not AllowedHTTP method
408TimeoutNetwork/backend delay
409ConflictDuplicate/existing resource
415Unsupported Media TypeContent-Type
422Validation errorField validation
429Rate limitToo many requests
500Server errorBackend logs
502Bad gatewayProxy/upstream
503UnavailableOutage/maintenance
504Gateway timeoutBackend too slow

10. Troubleshooting by Error Code

400 Bad Request

Likely:

Invalid payload, missing fields, wrong query parameter

Check:

JSON syntax
Required fields
Field names
Data types
API documentation

401 Unauthorized

Likely:

Authentication failed

Check:

Token present
Token expired
Correct auth method
Correct environment

403 Forbidden

Likely:

Permission issue

Check:

User role
OAuth scopes
API permissions
IP allowlist

404 Not Found

Likely:

Wrong endpoint or resource does not exist

Check:

URL path
API version
Resource ID
Environment

409 Conflict

Likely:

Duplicate or conflicting resource

Example:

Trying to create a user that already exists

415 Unsupported Media Type

Likely:

Wrong or missing Content-Type

Check:

Content-Type: application/json

422 Validation Error

Likely:

Payload is valid JSON but fails business rules

Example:

Phone number format invalid
Required field has invalid value

429 Too Many Requests

Likely:

Rate limit exceeded

Check:

Retry-After header
API rate limits
Looping automation
Retry logic

500 Internal Server Error

Likely:

Backend application error

Action:

Collect request ID, timestamp, payload sample, and escalate

502 / 503 / 504

Likely:

Gateway, service availability, or timeout issue

Check:

Load balancer
API gateway
Backend health
Maintenance window
Network latency

11. Network Layer Checks

APIs depend on network reachability.

Check:

DNS resolution
Firewall
Proxy
Port 443
TLS certificate
IP allowlisting
VPN/private connectivity

Common symptoms:

SymptomPossible Cause
TimeoutFirewall, proxy, backend delay
TLS errorCertificate or TLS mismatch
DNS failureWrong hostname
Connection refusedService down or port blocked

12. TLS / Certificate Checks

For HTTPS APIs, validate:

Certificate not expired
Hostname matches certificate
Certificate chain trusted
TLS 1.2 or 1.3 supported

Common failures:

certificate expired
self-signed certificate
hostname mismatch
TLS handshake failed

13. Rate Limiting

Rate limiting protects APIs from overload.

Common response:

429 Too Many Requests

Check headers:

Retry-After: 60

Troubleshooting:

Reduce request frequency
Add backoff/retry logic
Check if automation is looping
Review API quota

14. Timeouts

Timeouts can occur at multiple layers:

Client timeout
API gateway timeout
Load balancer timeout
Backend service timeout
Database timeout

Ask:

How long before failure?
Does it fail always or intermittently?
Is payload large?
Is backend dependency slow?

15. Correlation IDs

A correlation ID tracks one request across systems.

Example:

X-Correlation-ID: abc-123

Use it to trace:

API Gateway → Auth Service → Backend Service → Database

For escalation, always include:

correlation ID
timestamp
endpoint
HTTP method
response code

16. Logs To Review

Log TypeWhat It Shows
API Gateway logsRequest entry, routing, response code
Auth logsOAuth/token failures
Application logsBackend errors
Webhook logsDelivery attempts
Load balancer logsUpstream health/timeouts
Firewall/proxy logsBlocked connections
CRM logsCustomer/ticket integration failures

17. Good Troubleshooting Workflow

1. Confirm expected behavior
2. Reproduce issue
3. Identify endpoint + method
4. Check response code
5. Validate auth
6. Validate headers
7. Validate payload
8. Validate network/TLS
9. Check logs/correlation ID
10. Isolate failed layer
11. Escalate with evidence

18. Example Scenario

Issue

Chat ends but CRM ticket is not created.

Expected Flow

Chat completed → Webhook sent → CRM API creates ticket

Troubleshooting

Check:

Was chat_completed event generated?
Was webhook sent?
Did CRM receive webhook?
What HTTP response did CRM return?
Was token valid?
Was JSON payload accepted?
Was ticket required field missing?

Possible findings:

FindingMeaning
No event generatedPlatform workflow issue
Webhook sent, no responseCRM endpoint/network issue
401 from CRMAuth/token issue
400 from CRMPayload/field mapping issue
500 from CRMCRM backend issue

19. Another Scenario

Issue

Customer lookup fails during chat start.

Expected Flow

Customer enters → API calls CRM → CRM returns profile

Check:

Customer ID passed correctly?
CRM endpoint correct?
Token valid?
Customer exists?
Field mapping correct?
CRM API response code?

Likely outcomes:

ResponseLikely Issue
401Token expired
403Missing CRM permission
404Customer not found
400Bad customerId format
500CRM backend failure

20. What To Say In Interview

API Troubleshooting Answer

“I start by confirming the expected workflow and reproducing the issue. Then I identify the API endpoint, HTTP method, response code, headers, authentication method, and payload. Based on the response code, I isolate whether the issue is authentication, permissions, request formatting, endpoint, networking, or backend related. I also check logs, timestamps, and correlation IDs before escalating with clear evidence.”


21. Implementation Engineer Mindset

Do not just say:

The API failed.

Say:

The POST request to the CRM ticket endpoint is returning 400 because the payload is missing the required caseType field.

That shows strong technical ownership.