Skip to main content

400: Bad Request

Use this page for all 400 BAD REQUEST errors.

A 400 means the request could not be parsed or validated as valid input.

What Usually Causes 400

  1. URL is constructed incorrectly (path vs query string mixups)
  2. Query parameters are malformed (? / & / key=value issues)
  3. Parameter type or format is invalid (string where number/date is expected)
  4. Parameter value is unsupported or out of range
  5. Option symbol is not valid OCC format
  6. date parameter is used in a current-data request (historical-only usage)

Case 1: URL Construction Problems (Path vs Query)

Common examples:

  • Putting query parameters in the path segment
  • Missing ? before query parameters
  • Using wrong separators between parameters

Correct structure:

https://api.marketdata.app/<endpoint-path>/?key=value&key2=value2

If you need a step-by-step URL-building guide, use:

Case 2: Invalid Parameter Type/Format/Value

You can get 400 when a parameter cannot be parsed correctly or violates endpoint rules.

Examples:

  • Sending text where a numeric value is expected
  • Sending a malformed date
  • Sending an unsupported enum/value for a parameter
  • Sending a value outside allowed bounds

Fast check:

  1. Confirm parameter names exactly match the endpoint docs.
  2. Confirm each parameter value type/format is valid.
  3. Remove optional parameters and re-add one at a time.

Case 3: Invalid Option Symbol (OCC)

You may receive:

{
"s": "error",
"errmsg": "Invalid option symbol. Use valid OCC symbology for the option symbol."
}

Meaning: request shape is valid, but optionSymbol is malformed.

For detailed format rules, examples, and validation workflow, use:

Case 4: date Parameter Is Historical-Only

You may receive:

{
"s": "error",
"errmsg": "Invalid date. The date parameter is used for historical queries only."
}

Meaning:

  • Request can be otherwise valid
  • date was used in a current-data context

How to fix:

  1. For current data: omit date
  2. For historical data: provide a past trading date
# Current request (correct): no date parameter
GET https://api.marketdata.app/v1/options/quotes/OPTION_SYMBOL/

# Historical request (correct): includes date
GET https://api.marketdata.app/v1/options/quotes/OPTION_SYMBOL/?date=2025-01-15

400 vs Other Status Codes

  • 400: request input/format is invalid
  • 401: authentication issue (token missing/invalid)
  • 402: plan/entitlement limit reached
  • 403: forbidden by policy (for example multiple IP addresses)
  • 404: request format is valid, but requested resource was not found

If You Still Get 400

  1. Log full request URL and all query parameters
  2. Compare request against endpoint docs field-by-field
  3. Re-test with only required parameters
  4. Add optional parameters back one at a time