# InvalidRequestError<!-- -->

Raised when the Apify API returns an HTTP 400 Bad Request response.

### Hierarchy

* [ApifyApiError](https://docs.apify.com/api/client/python/reference/class/ApifyApiError.md)
  * *InvalidRequestError*

## Index[](#Index)

### Methods

* [\_\_init\_\_](https://docs.apify.com/api/client/python/reference/class/InvalidRequestError.md#__init__)
* [\_\_new\_\_](https://docs.apify.com/api/client/python/reference/class/InvalidRequestError.md#__new__)

## Methods<!-- -->[](#Methods)

### [](#__init__)\_\_init\_\_

* **\_\_init\_\_**(response, attempt, \*, method, url): None

- Inherited from [ApifyApiError.\_\_init\_\_](https://docs.apify.com/api/client/python/reference/class/ApifyApiError.md#__init__)

  Initialize the API error from a failed response.

  ***

  #### Parameters

  * ##### response: [HttpResponse](https://docs.apify.com/api/client/python/reference/class/HttpResponse.md)

    The failed HTTP response from the Apify API.

  * ##### attempt: int

    The attempt number when the request failed (1-indexed).

  * ##### optionalkeyword-onlymethod: str = <!-- -->'GET'

    The HTTP method of the failed request.

  * ##### optionalkeyword-onlyurl: str | None = <!-- -->None

    The failed request URL, if available.

  #### Returns None

### [](#__new__)\_\_new\_\_

* **\_\_new\_\_**(response, attempt, \*, method, url): Self

- Inherited from [ApifyApiError.\_\_new\_\_](https://docs.apify.com/api/client/python/reference/class/ApifyApiError.md#__new__)

  Dispatch to the subclass matching the response's HTTP status code, if any.

  ***

  #### Parameters

  * ##### response: [HttpResponse](https://docs.apify.com/api/client/python/reference/class/HttpResponse.md)
  * ##### attempt: int
  * ##### optionalkeyword-onlymethod: str = <!-- -->'GET'
  * ##### optionalkeyword-onlyurl: str | None = <!-- -->None

  #### Returns Self
