Common Errors

All error responses share the same JSON envelope — regardless of whether the error originates at the API gateway (nginx) or the application layer:

{ "s": "error", "msg": "Description of what went wrong" }

Quick Reference

StatusMsgOriginRetryable
400Bad requestGatewayNo — fix the request
400Input validation failed. Kindly check your input contains required fields for the requestApplicationNo — fix the request
400Internal Error occurred. Kindly try again.ApplicationYes
401UnauthorizedGateway / ApplicationNo — re-authenticate
403ForbiddenGatewayNo — check IP whitelist and app permissions
404Resource not foundGatewayNo — check the endpoint path
405Method not allowedGatewayNo — check the HTTP method
429Too many requestsGatewayYes — back off and retry
500Internal server errorApplicationYes — retry with backoff
502Bad gatewayGatewayYes — retry with backoff
503Service unavailableGatewayYes — retry after delay
504Gateway timedoutGatewayYes — retry with backoff

HTTP 400 — Bad Request

A 400 can come from two sources with different msg values.

Gateway-level 400

The request was structurally invalid and rejected by the API gateway before reaching the application (e.g. malformed URL, unparseable body, unsupported Content-Type).

{ "s": "error", "msg": "Bad request" }
CauseResolution
Content-Type: application/json sent on a POST/PUT endpointUse Content-Type: application/x-www-form-urlencoded
Content-Type header missing on a POST/PUT endpointAdd Content-Type: application/x-www-form-urlencoded
Malformed request URL or unparseable query stringCheck URL encoding; special characters in query values must be percent-encoded

Application-level 400

The request reached the application but failed field-level validation.

{ "s": "error", "msg": "Input validation failed. Kindly check your input contains required fields for the request" }
{ "s": "error", "msg": "Internal Error occurred. Kindly try again." }
ScenarioBad valueCorrect value
Wrong side value"b", "BUY""buy" or "sell"
Wrong type value"LIMIT", "sl""limit", "market", "stoplimit", "stopmarket"
Wrong product value"CNC", "cnc""delivery", "intraday", "normal"
Wrong validity value"DAY""day", "ioc", "eos", "gtc"
limitPrice missing for limit orderOmittedRequired when type is "limit" or "stoplimit"
trigPrice missing for stop orderOmittedRequired when type is "stoplimit" or "stopmarket"
Missing twoFaTyp on Individual Token endpointField omittedPass twoFaTyp=otp or twoFaTyp=totp

HTTP 401 — Unauthorized

The request could not be authenticated. A single msg: "Unauthorized" is returned for all causes — use the sub-scenarios below to diagnose.

{ "s": "error", "msg": "Unauthorized" }
ScenarioCauseResolution
Wrong credentialsIncorrect client_id, password, or twoFa value on the auth endpointVerify your API key in the Apps section; regenerate your OTP/TOTP; confirm twoFaTyp matches the value type (otp or totp)
Token expiredAccess tokens are valid for 24 hours — after expiry all authenticated calls return 401Re-authenticate using the Individual Token or OAuth token endpoint to obtain a fresh access_token
Authorization header missingNo Authorization header sent with the requestAdd Authorization: Bearer <api_key>:<access_token>
Authorization header malformedWrong format — e.g. Bearer <token_only> or missing Bearer prefixUse the exact format Authorization: Bearer <api_key>:<access_token>
Static IP not whitelistedRequest originates from an IP not registered during app creation (Individual Apps only)Add your IP to the whitelist in the Apps section
TOTP/OTP expired or wrongThe 6-digit code in twoFa is incorrect or has expiredGenerate a fresh TOTP code; OTP codes expire after 30–60 seconds

HTTP 403 — Forbidden

The request was authenticated but the caller does not have permission to access the resource.

{ "s": "error", "msg": "Forbidden" }
CauseResolution
Static IP not whitelistedThe authenticated token is valid but the originating IP address is not on the app's whitelist
App not authorised for endpointYour app registration does not include permission for this endpoint or segment
Accessing another user's resourceAttempting to query data that does not belong to the authenticated account

A 403 differs from 401: 401 means the server could not identify who you are; 403 means the server knows who you are but is denying access.


HTTP 404 — Resource Not Found

The requested endpoint path does not exist on the server.

{ "s": "error", "msg": "Resource not found" }
CauseResolution
Incorrect endpoint pathCheck the path against the API reference; paths are case-sensitive
Missing path parametere.g. /api/mkt-data/scrips/symbol-store/{scripGroup} requires scripGroup to be filled in
Wrong base URLAll requests must go to https://api.tradejini.com/v2 — requests to developer.tradejini.com will not resolve API paths

HTTP 405 — Method Not Allowed

The endpoint exists but does not support the HTTP method used in the request.

{ "s": "error", "msg": "Method not allowed" }
CauseResolution
Using POST on a GET-only endpointCheck the method column in the API reference for the endpoint
Using GET on a POST/PUT endpointUse the correct HTTP method
Using DELETE without the required query parametersEnsure required query parameters (e.g. orderId) are included

HTTP 415 — Unsupported Media Type

The request body's Content-Type is not accepted by the endpoint. This error is returned by the application layer before nginx for incorrectly typed POST/PUT requests.

CauseResolution
Content-Type: application/json sent on a POST/PUT endpointChange to Content-Type: application/x-www-form-urlencoded
Content-Type header missing on a POST/PUT endpointAdd Content-Type: application/x-www-form-urlencoded

GET and DELETE endpoints use only query parameters and do not require a Content-Type header.


HTTP 429 — Too Many Requests

The request was rejected by the rate-limiter. See Rate Limits for the full limits table.

{ "s": "error", "msg": "Too many requests" }
ZoneApplies toLimitScope
OTP limitPOST /api-gw/oauth/individual-token-v23 req/secPer IP address
API key limitOAuth token exchange and API-key-only endpoints100 req/secPer api_key
Data fetch limitMarket data and account data endpoints100 req/secPer auth token
Place Order limitPOST /api/oms/place-order10 req/secPer auth token
General API limitAll other authenticated endpoints10 req/sec and 400 req/minPer auth token

Resolution: Implement exponential backoff — wait 1s, then 2s, then 4s between retries. Do not retry immediately on 429.


HTTP 500 — Internal Server Error

An unexpected error occurred inside the application. The request was valid but could not be processed.

{ "s": "error", "msg": "Internal server error" }
CauseResolution
Transient application faultRetry with exponential backoff (1s → 2s → 4s)
Dependency failure (database, downstream service)Retry after a short delay; check Tradejini status
Persistent 500 on a specific endpointContact Tradejini support with the full request details and timestamp

HTTP 502 — Bad Gateway

The API gateway received an invalid response from the upstream application server. The application may be restarting or temporarily unreachable.

{ "s": "error", "msg": "Bad gateway" }
CauseResolution
Upstream server restarting or crashingRetry with exponential backoff; typically resolves within seconds
Deployment in progressWait 30–60 seconds and retry
Persistent 502Check Tradejini status

HTTP 503 — Service Unavailable

The server is temporarily unable to handle the request, usually due to maintenance or overload.

{ "s": "error", "msg": "Service unavailable" }
CauseResolution
Scheduled maintenanceCheck Tradejini status for maintenance windows
Server overloadRetry with exponential backoff and reduced request frequency
Market hours startupSome services start shortly before market open; retry after a short delay

HTTP 504 — Gateway Timeout

The API gateway did not receive a response from the upstream server within the allowed time.

{ "s": "error", "msg": "Gateway timedout" }
CauseResolution
Upstream server took too long to respondRetry the request; consider whether the operation may have partially succeeded (e.g. check the order book after a 504 on place-order before retrying)
Network congestion between gateway and applicationRetry with backoff
Request processing unusually slowFor order operations, always verify state via GET /api/oms/orders or GET /api/oms/history before assuming failure

Important for order operations: A 504 on POST /api/oms/place-order does not confirm that the order was rejected. The order may have been placed before the timeout. Always check GET /api/oms/orders before retrying a place-order call to avoid duplicate orders.


Common Integration Mistakes

SymptomMost likely cause
Every request returns 401Token expired — re-authenticate; or static IP not whitelisted
Auth returns 401 despite correct passwordWrong twoFaTyp — use totp for authenticator app, otp for SMS/email
Auth returns 403Static IP not whitelisted — register your IP in the Apps section
Request returns 404Wrong base URL (developer.tradejini.com vs api.tradejini.com/v2) or wrong path
POST returns 400 Bad requestMissing or wrong Content-Type: application/x-www-form-urlencoded
POST returns 400 with validation messageMissing required field or wrong enum value — check the endpoint's Request Body section
Successful auth but all subsequent calls return 401Authorization header format wrong — must be Bearer <api_key>:<access_token> (two parts separated by colon)
Works locally, fails in productionStatic IP not whitelisted — register your production server IP
429 on auth endpoint onlyOTP rate limit is IP-based (3 req/sec) and separate from the general per-token limits
504 after placing an orderDo not retry immediately — check GET /api/oms/orders first to avoid duplicate orders
s: "no-data" instead of an arrayNo records exist for the session (e.g. no open orders today) — this is a normal empty-state response, not an error

On this page