# Invalid Request

The request is malformed and cannot be processed by the server. This typically means the request body, headers, or content type are incorrect.

**HTTP Status:** `400 Bad Request`

## Error Codes

| Code | Description |
|  --- | --- |
| `invalid_content_type` | The `Content-Type` header is missing or not supported |
| `malformed_body` | The request body is not valid JSON |
| `missing_grant_type` | The `grant_type` parameter is missing |
| `unsupported_grant_type` | The `grant_type` value is not supported |
| `missing_authorization` | The `Authorization` header is missing |
| `missing_file` | A required file upload is missing |
| `missing_type` | The document `type` field is missing |
| `file_too_large` | The uploaded file exceeds the maximum allowed size |
| `invalid_limit` | The `limit` query parameter is invalid |
| `invalid_sort` | The `sort` query parameter is invalid |
| `invalid_order` | The `order` query parameter is invalid |
| `invalid_cursor` | The pagination cursor is invalid or expired |
| `empty_update` | The update request body contains no fields to update |


## Example Response


```json
{
  "type": "https://docs.dinie.com/errors/invalid-request",
  "title": "Bad Request",
  "status": 400,
  "detail": "The request body could not be parsed as JSON.",
  "code": "malformed_body"
}
```

## How to Resolve

- **`invalid_content_type`** -- Set the `Content-Type` header to `application/json` for JSON requests or `multipart/form-data` for file uploads.
- **`malformed_body`** -- Validate that your request body is well-formed JSON before sending. Check for trailing commas, unquoted keys, or encoding issues.
- **`missing_grant_type`** -- Include `grant_type=client_credentials` in your token request body.
- **`unsupported_grant_type`** -- Only `client_credentials` is supported.
- **`missing_authorization`** -- Include the `Authorization` header with Basic or Bearer credentials.
- **`missing_file`** -- Ensure the required file field is included in your multipart upload.
- **`missing_type`** -- Include the `type` field specifying the document type.
- **`file_too_large`** -- Reduce the file size before uploading.
- **`invalid_limit` / `invalid_sort` / `invalid_order` / `invalid_cursor`** -- Check query parameter values against the API documentation.
- **`empty_update`** -- Include at least one field to update in the PATCH request body.


## See Also

- [Error Handling guide](/en-us/apis/concepts/errors) -- Full error handling patterns and code examples