> For the complete documentation index, see [llms.txt](https://vanis-organization.gitbook.io/api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vanis-organization.gitbook.io/api-docs/propfuse-api.md).

# PropFuse API

## <mark style="color:red;">Authentication</mark>

## User Registration

## Register a new user.

<mark style="color:green;">`POST`</mark> `https://propfuseapi.vercel.app/api/register`

Creates a new user.

#### Request Body

| Name                                       | Type   | Description              |
| ------------------------------------------ | ------ | ------------------------ |
| username<mark style="color:red;">\*</mark> | string | The username of the user |
| email<mark style="color:red;">\*</mark>    | string | The email ID of the user |
| password<mark style="color:red;">\*</mark> | string | The password to be given |

{% tabs %}
{% tab title="201: Created User successfully created" %}

```json
{
    "_id": "64b534b6847d791670c255c5",
    "email": "captain@gmail.com"
}
```

{% endtab %}

{% tab title="400: Bad Request Invalid user data" %}

```json
{
    "error": "User data is not valid"
}
```

{% endtab %}
{% endtabs %}

## User Login

## Log in a user.

<mark style="color:green;">`POST`</mark> `https://propfuseapi.vercel.app/api/login`

Logs in a user.

#### Request Body

| Name                                       | Type   | Description                     |
| ------------------------------------------ | ------ | ------------------------------- |
| email<mark style="color:red;">\*</mark>    | string | Registered email ID of the user |
| password<mark style="color:red;">\*</mark> | string | Password                        |

{% tabs %}
{% tab title="200: OK User successfully logged in" %}

```json
{
    "message": "successfully logged in"
}
```

{% endtab %}

{% tab title="401: Unauthorized Invalid credentials" %}

```json
{
    "error": "email or password is not valid"
}
```

{% endtab %}
{% endtabs %}

## Current User

## Check the current user.

<mark style="color:blue;">`GET`</mark> `https://propfuseapi.vercel.app/api/current`

Checks the logged in user.

{% tabs %}
{% tab title="200: OK user data fetched" %}

```json
{
    "username": "caprogers",
    "email": "captain@gmail.com",
    "id": "64b534b6847d791670c255c5"
}
```

{% endtab %}
{% endtabs %}

## User Logout

## Log out the user.

<mark style="color:blue;">`GET`</mark> `https://propfuseapi.vercel.app/api/logout`

Logs out the logged in user.

{% tabs %}
{% tab title="200: OK user logged out" %}

```json
{
    "message": "successfully logged out"
}
```

{% endtab %}
{% endtabs %}

## <mark style="color:red;">API Endpoints</mark>

## Property Listings

{% hint style="info" %}
Users must be logged in for accessing the property listings.
{% endhint %}

## Get all properties.

<mark style="color:blue;">`GET`</mark> `https://propfuseapi.vercel.app/api/listings`

Fetches all the property listings.

{% tabs %}
{% tab title="200: OK property listings fetched" %}

```json
[
    {
        "area": "1260 sqft",
        "image_url": "https://img.staticmb.com/mbphoto/property/cropped_images/2019/May/24/Photo_h300_w450/42266845_10_PropertyImage1558706280819_300_450.jpg",
        "location": "3 BHK Builder Floor for Sale in Rohini Sector 7 New Delhi",
        "price": "₹2.20 Cr"
    },
]
```

{% endtab %}
{% endtabs %}

## Property Listings by location

## Get properties by location.

<mark style="color:blue;">`GET`</mark> `https://propfuseapi.vercel.app/api/listings/filter`

Fetches all the properties of a particular location by filtering the data.

#### Query Parameters

| Name                                       | Type   | Description           |
| ------------------------------------------ | ------ | --------------------- |
| location<mark style="color:red;">\*</mark> | string | location for listings |

{% tabs %}
{% tab title="200: OK filtered property listings fetched" %}

{% endtab %}
{% endtabs %}
