> ## Documentation Index
> Fetch the complete documentation index at: https://unkey.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# invalid_input

> The client provided input that failed server-side validation. Review the error details to fix malformed fields, missing values, or bad types.

<Danger>`err:unkey:application:invalid_input`</Danger>

```json Example theme={"theme":"kanagawa-wave"}
{
  "meta": {
    "requestId": "req_2c9a0jf23l4k567"
  },
  "error": {
    "detail": "The request contains invalid input that failed validation",
    "status": 400,
    "title": "Bad Request",
    "type": "https://unkey.com/docs/errors/unkey/application/invalid_input",
    "errors": [
      {
        "location": "body.limit",
        "message": "must be greater than or equal to 1",
        "fix": "Provide a limit value of at least 1"
      }
    ]
  }
}
```

## What Happened?

This error occurs when your request contains input data that doesn't meet Unkey's validation requirements. This could be due to missing required fields, values that are out of allowed ranges, incorrectly formatted data, or other validation failures.

Common validation issues include:

* Missing required fields
* Values that exceed minimum or maximum limits
* Strings that don't match required patterns
* Invalid formats for IDs, emails, or other structured data
* Type mismatches (e.g., providing a string where a number is expected)

Here's an example of a request that would trigger this error:

```bash theme={"theme":"kanagawa-wave"}
# Attempting to create a rate limit with an invalid limit value of 0
curl -X POST https://api.unkey.com/v2/ratelimit.limit \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer unkey_YOUR_API_KEY" \
  -d '{
    "namespace": "api.requests",
    "identifier": "user_123",
    "limit": 0,
    "duration": 60000
  }'
```

## How To Fix

To fix this error, carefully review the error details provided in the response. The `errors` array contains specific information about what failed validation:

1. Check the `location` field to identify which part of your request is problematic
2. Read the `message` field for details about why validation failed
3. Look at the `fix` field (if available) for guidance on how to correct the issue
4. Modify your request to comply with the validation requirements

Here's the corrected version of our example request:

```bash theme={"theme":"kanagawa-wave"}
# Corrected request with a valid limit value
curl -X POST https://api.unkey.com/v2/ratelimit.limit \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer unkey_YOUR_API_KEY" \
  -d '{
    "namespace": "api.requests",
    "identifier": "user_123",
    "limit": 100,
    "duration": 60000
  }'
```

## Common Mistakes

* **Ignoring schema requirements**: Not checking the API documentation for field requirements
* **Range violations**: Providing values outside of allowed ranges (too small, too large)
* **Format errors**: Not following the required format for IDs, emails, or other structured data
* **Missing fields**: Omitting required fields in API requests
* **Type errors**: Sending the wrong data type (e.g., string instead of number)

## Related Errors

* [err:unkey:application:assertion\_failed](./assertion_failed) - When a runtime assertion or invariant check fails
* [err:unkey:application:protected\_resource](./protected_resource) - When attempting to modify a protected resource
