# Authentication

Rememberizer provides several authentication endpoints to manage user accounts and sessions. This document outlines the available authentication APIs.

## Sign Up

{% openapi src="/files/7T1Jx6BU3fZ2U5LsImW1" path="/auth/signup/" method="post" %}
[rememberizer\_openapi.yml](https://2952947711-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyNqpTh7Mh66N0RnO0k24%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media\&token=cbad765b-1613-4222-b591-9ae17a3b7cfa)
{% endopenapi %}

### Example Requests

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

```bash
curl -X POST \
  https://api.rememberizer.ai/api/v1/auth/signup/ \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "password": "secure_password",
    "name": "John Doe",
    "captcha": "recaptcha_response"
  }'
```

{% hint style="info" %}
Replace `recaptcha_response` with an actual reCAPTCHA response.
{% endhint %}
{% endtab %}

{% tab title="JavaScript" %}

```javascript
const signUp = async () => {
  const response = await fetch('https://api.rememberizer.ai/api/v1/auth/signup/', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      email: 'user@example.com',
      password: 'secure_password',
      name: 'John Doe',
      captcha: 'recaptcha_response'
    })
  });
  
  const data = await response.json();
  console.log(data);
};

signUp();
```

{% hint style="info" %}
Replace `recaptcha_response` with an actual reCAPTCHA response.
{% endhint %}
{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def sign_up():
    headers = {
        "Content-Type": "application/json"
    }
    
    payload = {
        "email": "user@example.com",
        "password": "secure_password",
        "name": "John Doe",
        "captcha": "recaptcha_response"
    }
    
    response = requests.post(
        "https://api.rememberizer.ai/api/v1/auth/signup/",
        headers=headers,
        data=json.dumps(payload)
    )
    
    data = response.json()
    print(data)

sign_up()
```

{% hint style="info" %}
Replace `recaptcha_response` with an actual reCAPTCHA response.
{% endhint %}
{% endtab %}
{% endtabs %}

## Sign In

{% openapi src="/files/7T1Jx6BU3fZ2U5LsImW1" path="/auth/signin/" method="post" %}
[rememberizer\_openapi.yml](https://2952947711-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyNqpTh7Mh66N0RnO0k24%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media\&token=cbad765b-1613-4222-b591-9ae17a3b7cfa)
{% endopenapi %}

### Example Requests

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

```bash
curl -X POST \
  https://api.rememberizer.ai/api/v1/auth/signin/ \
  -H "Content-Type: application/json" \
  -d '{
    "login": "user@example.com",
    "password": "secure_password",
    "captcha": "recaptcha_response"
  }'
```

{% hint style="info" %}
Replace `recaptcha_response` with an actual reCAPTCHA response.
{% endhint %}
{% endtab %}

{% tab title="JavaScript" %}

```javascript
const signIn = async () => {
  const response = await fetch('https://api.rememberizer.ai/api/v1/auth/signin/', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      login: 'user@example.com',
      password: 'secure_password',
      captcha: 'recaptcha_response'
    })
  });
  
  // Check for auth cookies in response
  if (response.status === 204) {
    console.log("Login successful!");
  } else {
    console.error("Login failed!");
  }
};

signIn();
```

{% hint style="info" %}
Replace `recaptcha_response` with an actual reCAPTCHA response.
{% endhint %}
{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def sign_in():
    headers = {
        "Content-Type": "application/json"
    }
    
    payload = {
        "login": "user@example.com",
        "password": "secure_password",
        "captcha": "recaptcha_response"
    }
    
    response = requests.post(
        "https://api.rememberizer.ai/api/v1/auth/signin/",
        headers=headers,
        data=json.dumps(payload)
    )
    
    if response.status_code == 204:
        print("Login successful!")
    else:
        print("Login failed!")

sign_in()
```

{% hint style="info" %}
Replace `recaptcha_response` with an actual reCAPTCHA response.
{% endhint %}
{% endtab %}
{% endtabs %}

## Email Verification

{% openapi src="/files/7T1Jx6BU3fZ2U5LsImW1" path="/auth/verify-email/" method="post" %}
[rememberizer\_openapi.yml](https://2952947711-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyNqpTh7Mh66N0RnO0k24%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media\&token=cbad765b-1613-4222-b591-9ae17a3b7cfa)
{% endopenapi %}

### Example Requests

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

```bash
curl -X POST \
  https://api.rememberizer.ai/api/v1/auth/verify-email/ \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "verification_code": "123456"
  }'
```

{% hint style="info" %}
Replace `YOUR_JWT_TOKEN` with your actual JWT token and use the verification code sent to your email.
{% endhint %}
{% endtab %}

{% tab title="JavaScript" %}

```javascript
const verifyEmail = async () => {
  const response = await fetch('https://api.rememberizer.ai/api/v1/auth/verify-email/', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_JWT_TOKEN',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      verification_code: '123456'
    })
  });
  
  if (response.status === 200) {
    console.log("Email verification successful!");
  } else {
    console.error("Email verification failed!");
  }
};

verifyEmail();
```

{% hint style="info" %}
Replace `YOUR_JWT_TOKEN` with your actual JWT token and use the verification code sent to your email.
{% endhint %}
{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def verify_email():
    headers = {
        "Authorization": "Bearer YOUR_JWT_TOKEN",
        "Content-Type": "application/json"
    }
    
    payload = {
        "verification_code": "123456"
    }
    
    response = requests.post(
        "https://api.rememberizer.ai/api/v1/auth/verify-email/",
        headers=headers,
        data=json.dumps(payload)
    )
    
    if response.status_code == 200:
        print("Email verification successful!")
    else:
        print("Email verification failed!")

verify_email()
```

{% hint style="info" %}
Replace `YOUR_JWT_TOKEN` with your actual JWT token and use the verification code sent to your email.
{% endhint %}
{% endtab %}
{% endtabs %}

## Token Management

{% openapi src="/files/7T1Jx6BU3fZ2U5LsImW1" path="/auth/custom-refresh/" method="post" %}
[rememberizer\_openapi.yml](https://2952947711-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyNqpTh7Mh66N0RnO0k24%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media\&token=cbad765b-1613-4222-b591-9ae17a3b7cfa)
{% endopenapi %}

### Example Requests

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

```bash
curl -X POST \
  https://api.rememberizer.ai/api/v1/auth/custom-refresh/ \
  -b "refresh_token=YOUR_REFRESH_TOKEN"
```

{% hint style="info" %}
This endpoint uses cookies for authentication. The refresh token should be sent as a cookie.
{% endhint %}
{% endtab %}

{% tab title="JavaScript" %}

```javascript
const refreshToken = async () => {
  const response = await fetch('https://api.rememberizer.ai/api/v1/auth/custom-refresh/', {
    method: 'POST',
    credentials: 'include' // This includes cookies in the request
  });
  
  if (response.status === 204) {
    console.log("Token refreshed successfully!");
  } else {
    console.error("Token refresh failed!");
  }
};

refreshToken();
```

{% hint style="info" %}
This endpoint uses cookies for authentication. Make sure your application includes credentials in the request.
{% endhint %}
{% endtab %}

{% tab title="Python" %}

```python
import requests

def refresh_token():
    cookies = {
        "refresh_token": "YOUR_REFRESH_TOKEN"
    }
    
    response = requests.post(
        "https://api.rememberizer.ai/api/v1/auth/custom-refresh/",
        cookies=cookies
    )
    
    if response.status_code == 204:
        print("Token refreshed successfully!")
    else:
        print("Token refresh failed!")

refresh_token()
```

{% hint style="info" %}
Replace `YOUR_REFRESH_TOKEN` with your actual refresh token.
{% endhint %}
{% endtab %}
{% endtabs %}

## Logout

{% openapi src="/files/7T1Jx6BU3fZ2U5LsImW1" path="/auth/custom-logout/" method="post" %}
[rememberizer\_openapi.yml](https://2952947711-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyNqpTh7Mh66N0RnO0k24%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media\&token=cbad765b-1613-4222-b591-9ae17a3b7cfa)
{% endopenapi %}

### Example Requests

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

```bash
curl -X POST \
  https://api.rememberizer.ai/api/v1/auth/custom-logout/
```

{% hint style="info" %}
This endpoint will clear the authentication cookies.
{% endhint %}
{% endtab %}

{% tab title="JavaScript" %}

```javascript
const logout = async () => {
  const response = await fetch('https://api.rememberizer.ai/api/v1/auth/custom-logout/', {
    method: 'POST',
    credentials: 'include' // This includes cookies in the request
  });
  
  if (response.status === 204) {
    console.log("Logout successful!");
  } else {
    console.error("Logout failed!");
  }
};

logout();
```

{% hint style="info" %}
This endpoint uses cookies for authentication. Make sure your application includes credentials in the request.
{% endhint %}
{% endtab %}

{% tab title="Python" %}

```python
import requests

def logout():
    session = requests.Session()
    
    response = session.post(
        "https://api.rememberizer.ai/api/v1/auth/custom-logout/"
    )
    
    if response.status_code == 204:
        print("Logout successful!")
    else:
        print("Logout failed!")

logout()
```

{% hint style="info" %}
This endpoint will clear the authentication cookies.
{% endhint %}
{% 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.rememberizer.ai/developer-resources/api-docs/authentication.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.
