# Invalid Request

**Code:** `API-002` · **Category:** API

The API rejected the request because one or more parameters, headers, fields, or request values are invalid or malformed.

## Common causes

- Missing required parameter
- Invalid parameter value
- Malformed JSON
- Incorrect Content-Type
- Invalid request structure
- Unsupported parameter

## Quick fix

1. Check the API documentation
2. Verify all required parameters
3. Validate the request JSON
4. Check request headers and Content-Type

## Detailed fix by platform

### JavaScript

1. Validate the request payload before sending it
2. Set the correct Content-Type header
3. Check required API parameters

### PHP

1. Validate incoming request parameters
2. Encode request data as valid JSON
3. Set the correct request headers

### REST

1. Compare the request with the API documentation
2. Remove unsupported parameters
3. Verify parameter names and data types

## How to diagnose

1. **Inspect the complete request** — 
2. **Validate the request body** — 
3. **Check required parameters** — 
4. **Review response error details** — 
5. **Compare the request with the API documentation** — 

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/api/api-002-invalid-request)
