# Create a new employee in the same tenant

`POST /api/employee`

Authentication (security requirement alternatives):

```json
[
  {
    "bearer": []
  }
]
```

- bearer: http (bearer), header JWT. Enter JWT token

Parameters:

- `origin` (header, string, required)
  Type: string

Request body: application/json (required)

Type: object

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

- `user` (optional)
  Reference: [UserInputDTO](https://sourcey-gauzy.pages.dev/api-reference/models/userinputdto/index.md); Type: object

- `userId` (optional)
  Type: string

- `password` (required)
  Type: string

Responses:

- 201: Employee record created successfully.

- 400: Invalid input. Check the request body for potential issues.

- 401: Unauthorized

- 403: Forbidden

## Examples

### cURL

```bash
curl -X POST 'http://localhost:3000/api/employee' \
  -H 'origin: string' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "user": {
    "email": "string",
    "roleId": "string",
    "role": {},
    "firstName": "string",
    "lastName": "string",
    "imageUrl": "string",
    "preferredLanguage": "en"
  },
  "userId": "string",
  "password": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "user": {
    "email": "string",
    "roleId": "string",
    "role": {},
    "firstName": "string",
    "lastName": "string",
    "imageUrl": "string",
    "preferredLanguage": "en"
  },
  "userId": "string",
  "password": "string"
}`;

const response = await fetch('http://localhost:3000/api/employee', {
  method: 'POST',
  headers: {
    'origin': 'string',
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "user": {
    "email": "string",
    "roleId": "string",
    "role": {},
    "firstName": "string",
    "lastName": "string",
    "imageUrl": "string",
    "preferredLanguage": "en"
  },
  "userId": "string",
  "password": "string"
}'''

response = requests.post(
    'http://localhost:3000/api/employee',
    data=body.encode('utf-8'),
    headers={
        'origin': 'string',
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```
