> For the complete documentation index, see [llms.txt](https://docs.redivis.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.redivis.com/api/client-libraries/redivis-python/reference/redivis/redivis.make_api_request.md).

# redivis.make\_api\_request

### **redivis.**<mark style="color:purple;">**make\_api\_request**</mark>**(*****\*, method, path, query, payload, ...*****)** → **Dict | None |** [**requests.Response**](https://requests.readthedocs.io/en/latest/api/#requests.Response)

Initiates an authenticated HTTP request to the [Redivis API](/api/rest-api/general-structure.md).&#x20;

If `parse_response=True` (the default) the result will be a `dict` corresponding to the API endpoint's JSON response, or `None` if the response is empty. Otherwise, returns a [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) object.

{% hint style="warning" %}
In most cases, you should use the various other methods in the redivis python library, rather than interfacing with the API directly, as these methods are far more user-friendly and cover the vast majority of the REST API.

However, in certain advanced cases, it may make sense to call API endpoint directly through this method.
{% endhint %}

### **Parameters:**

**`method` :&#x20;*****str {"GET"*****&#x20;|&#x20;*****"POST" | "PATCH" | "PUT" | "HEAD" | "DELETE" }, default "GET"***\
The HTTP method of the request. Defaults to "GET"

**`path` :&#x20;*****str, default ""***\
The API path, including the leading forward slash. E.g.: `"/organizations/demo/datasets"`

**`query` :&#x20;*****dict***\
An optional dictionary of query parameters to add to the path

**`payload` :&#x20;*****dict | any***\
An optional payload to include with the request. If provided and `parse_payload=True` , must be a dictionary that will be converted to a JSON string. If `parse_payload=False` , the contents will be sent up as the raw request body.

**`parse_response` :&#x20;*****bool, default True***\
Whether to parse the API response into a dict. Typically should be set to True, unless the API endpoint doesn't return JSON.

**`parse_payload` :&#x20;*****bool, default True***\
Whether to convert the provided dictionary payload into a JSON string to send to the API. Most endpoints that accept a payload in the body expect a JSON payload.

**`headers` :&#x20;*****dict***\
An optional dictionary of additional headers to include in the request. Note that authentication is already handled, and there is no need to provide API credentials in the headers when using this method.

**`stream` :&#x20;*****bool, default False***\
For advanced use cases. If True, the response will be read as a stream; in this scenario, `parse_response` must be set to False.

### **Returns:**

Dict | None | [requests.Response](https://requests.readthedocs.io/en/latest/api/#requests.Response) &#x20;

### Examples

```python
import redivis

# Calls the dataset.list endpoint
# See the REST API documentation for details on the response schema for each endpoint
json_response = redivis.make_api_request(
    method="GET", 
    path="/organizations/demo/datasets", 
    query={"maxResults": "10"}
)
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.redivis.com/api/client-libraries/redivis-python/reference/redivis/redivis.make_api_request.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
