# Mongoose

You can find out the Mongoose auth APIs public repo [here](https://github.com/crema-git/crema-mongoose.git)

All Auth APIs listed here -

## Register User

<mark style="color:green;">`POST`</mark> `https://crema-mongoose.herokuapp.com/api/users`

This endpoint allows you to get free cakes.

#### Request Body

| Name     | Type   | Description              |
| -------- | ------ | ------------------------ |
| name     | string | Name of the user         |
| email    | string | Email of the user        |
| password | string | Password for the account |

{% tabs %}
{% tab title="200 Cake successfully retrieved." %}

```
{
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWY0ZjE5ZWNjN2Y5ZGEwMDE3ZDg1YmFkIn0sImlhdCI6MTU5OTAxOTUwMSwiZXhwIjoxNTk5NDUxNTAxfQ.diJyrzPOY-FD7quqhbJ9D5sDdN8Oym40qqfgHoldpdg"
}
```

{% endtab %}

{% tab title="400 Could not find a cake matching this query." %}

```
{
    "error": "User already exists"
}
```

{% endtab %}
{% endtabs %}

## Login User

<mark style="color:green;">`POST`</mark> `http://crema-mongo-api.herokuapp.com/api/auth`

#### Request Body

| Name     | Type   | Description             |
| -------- | ------ | ----------------------- |
| email    | string | Email of the user       |
| password | string | Password of the account |

{% tabs %}
{% tab title="200 " %}

```
{
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWY0ZjE5ZWNjN2Y5ZGEwMDE3ZDg1YmFkIn0sImlhdCI6MTU5OTA3MDc3MCwiZXhwIjoxNTk5NTAyNzcwfQ.fK3L6ZmU8S7I-i21kJj_0sA212JOPgFaTWeSeAUaORQ"
}
```

{% endtab %}

{% tab title="400 " %}

```
{
    "error": "Invalid Credentials"
}
```

{% endtab %}
{% endtabs %}

## &#x20;Auth User

<mark style="color:blue;">`GET`</mark> `http://crema-mongo-api.herokuapp.com/api/auth`

#### Headers

| Name         | Type   | Description |
| ------------ | ------ | ----------- |
| x-auth-token | string |             |

{% tabs %}
{% tab title="200 " %}

```
{
    "_id": "5f4f19ecc7f9da0017d85bad",
    "name": "Demo User",
    "email": "demqo@example.com",
    "avatar": "https://gravatar.com/avatar/8f6b538c5a829890d9d72aba5fc4ed25?d=mm&r=pg&s=200",
    "date": "2020-09-02T04:05:00.903Z",
    "__v": 0
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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:

```
GET https://docs.cremawork.com/v2.0/servers/mongoose.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
