Skip to main content

Troubleshooting Guide: 400 Bad Request HTTP Status (Client Error)

Distributor/API user troubleshooting for a 400 Bad Request error in Encompass: check query parameters, headers, JSON formatting and data types, and what to send Support. Requires v26.01+.

B
Written by Bailey Naas-Thornton

Minimum Version Required: 26.01

Pre-Conditions

  • Access to the application, API client (e.g., Postman, curl), or integration code initiating the request.

  • Access to the API documentation or expected request schema for the endpoint being called.

  • Basic understanding of how to inspect HTTP requests, including URLs, headers, and body payloads.

Steps

  • Check Query Parameters: Review the request URL to ensure all required query parameters are included, correctly spelled, and formatted according to the API documentation.

  • Verify Request Headers: Inspect the outgoing request headers. Ensure all required headers (such as Authorization or Content-Type) are present and that there are no invalid or unsupported headers included.

  • Validate JSON Formatting: If sending a payload, use a JSON linter or validator to confirm that the request body is valid JSON and not malformed (e.g., missing quotes, trailing commas, or unmatched brackets).

  • Confirm Data Types: Compare the data sent in your client payload against the server schema. Ensure there are no data type mismatches (e.g., sending a string like "123" when the server expects an integer 123).

  • Review Structural Validation: Check the overall structure of your payload to ensure it matches the exact hierarchy and nesting required by the server-side structural validation rules.

  • Contact Support: If the issue persists after attempting the steps above, please contact our support team. Provide the following information for efficient troubleshooting:

    • Exact error messages or codes encountered (including the raw response body from the server).

    • Screenshots or video recordings of the issue (e.g., showing the API client setup or application state).

    • Log files (specifically network logs, client application error logs, or exported HAR files).

    • The exact steps taken by the customer that led to the issue (including the exact endpoint URL, HTTP method, headers, and full payload).

    • The date and time the issue was first observed and any recurrence.

    • Any changes made to the system, application code, or integration before the issue appeared.

Fields And Definitions

  • 400 Bad Request: An HTTP response status code indicating that the server cannot or will not process the request due to an apparent client error (e.g., malformed request syntax, invalid parameters, or data mismatch).

  • Query Parameters: Key-value pairs appended to the end of a URL (after a ? mark) used to pass data or instructions to the server.

  • Request Headers: Metadata sent along with an HTTP request (like Content-Type: application/json) that provides the server with context about the request and the client making it.

  • JSON Format (JavaScript Object Notation): A standardized, lightweight format for storing and transporting data, frequently used for API request payloads.

  • Payload Body: The actual data message transmitted in the HTTP request, typically containing the information the server needs to create or update a record.

  • Server Schema: The defined blueprint or set of rules on the server that dictates the exact structure, mandatory fields, and data types a payload must adhere to.

Best Practices

  • Utilize API Testing Tools: Always test and build your requests in a dedicated API client (like Postman or Insomnia) to easily isolate configuration issues before hardcoding them into your application.

  • Implement Client-Side Validation: Add structural and data-type validation to your client-side application before the HTTP request is dispatched. This catches errors locally and prevents unnecessary server load.

  • Reference the Latest Documentation: API endpoints and schemas can evolve. Always ensure you are building requests against the most up-to-date version of the developer documentation.

  • Log Full API Responses: When building automated integrations, ensure your error-handling logic captures and logs the entire HTTP 400 response body, as servers often return detailed hints about exactly which field or header failed validation.

Did this answer your question?