# API Error: Missing required parameter (parameter_missing / "x" is required)

**Code:** `parameter_missing` · **Category:** API · **Seen on:** REST API

The API rejected the request because a field it requires — in the query string, path, headers or JSON body — wasn’t sent or was empty.

## Meaning

Every endpoint declares which inputs are mandatory. If one is absent, null or an empty string, the server stops before doing any work and returns a 400 (sometimes 422) naming the missing field.

The field is often there in your code but never reaches the wire: it was undefined and got dropped during JSON serialization, it was sent as a query parameter when the API expects it in the body, or a form encoding/Content-Type mismatch meant the server couldn’t read the body at all.

## Common causes

- The field was left out of the request
- The value was undefined/null and silently dropped by JSON.stringify
- Sent in the wrong place (query string instead of body, or body instead of header)
- Body not parsed because Content-Type is missing or wrong
- Field name misspelled or wrong case (customerId vs customer_id)

## Quick fix

1. Read the error body — it usually names the missing parameter
2. Log the exact request the client sends and compare it with the API docs
3. Add client-side validation so required fields can’t be empty

## Detailed fix by platform

### Node.js

1. `// undefined values vanish from JSON — check before sending const body = { email, plan }; for (const [k, v] of Object.entries(body)) if (v == null
2. v === '') throw new Error(`missing ${k}`); await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) });`

### Python

1. 

```python
r = requests.post(url, json={"email": email, "plan": plan})  # json= sets Content-Type for you
print(r.status_code, r.json())
```


### curl

1. `curl -X POST https://api.example.com/v1/users -H 'Content-Type: application/json' -d '{"email":"a@b.com","plan":"pro"}'`

## How to diagnose

1. **Error body** — Which parameter does it name?
2. **Raw request** — Is the field present in the bytes actually sent (proxy/devtools log)?
3. **Location** — Does the docs say query, path, header or body?
4. **Spelling** — Exact name and case match the docs?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/api/missing-required-parameter)
