# Check if an email exists in the database

`POST /api/auth/email-check`

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [CheckEmailDTO](https://sourcey-gauzy.pages.dev/api-reference/models/checkemaildto/index.md)

- `email` (required)
  Type: string
  
  Email address to check for existence
  
  Example:
  
  ```json
  "test@example.com"
  ```

Responses:

- 200: Email existence checked

Content type: application/json

Type: unknown

Example:

```json
{
  "exists": true
}
```

- 400: Invalid email format or missing email

## Examples

### cURL

```bash
curl -X POST 'http://localhost:3000/api/auth/email-check' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "email": "test@example.com"
}'
```

### JavaScript

```javascript
const body = `{
  "email": "test@example.com"
}`;

const response = await fetch('http://localhost:3000/api/auth/email-check', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "email": "test@example.com"
}'''

response = requests.post(
    'http://localhost:3000/api/auth/email-check',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```
