# Validate invite by code and email.

`POST /api/invite/validate-by-code`

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

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

- `email` (required)
  Type: string

- `code` (required)
  Type: number

Responses:

- 200: Found invite

Content type: application/json

Type: object

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

- `deletedAt` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `createdAt` (optional)
  Type: string, date-time
  
  The creation timestamp of the entity.
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `updatedAt` (optional)
  Type: string, date-time
  
  The last update timestamp of the entity.
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `id` (optional)
  Type: string

- `isActive` (optional)
  Type: boolean
  
  default: true

- `isArchived` (optional)
  Type: boolean
  
  default: false

- `archivedAt` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `tenantId` (optional)
  Type: string

- `organizationId` (optional)
  Type: string

- `token` (required)
  Type: string

- `email` (required)
  Type: string

- `fullName` (optional)
  Type: string

- `status` (required)
  Type: string
  
  enum: ["INVITED","ACCEPTED","EXPIRED","REJECTED"]

- `expireDate` (optional)
  Type: string, date-time

- `actionDate` (optional)
  Type: string, date-time

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

- `roleId` (optional)
  Type: string

- `userId` (optional)
  Type: string

- 404: Record not found

## Examples

### cURL

```bash
curl -X POST 'http://localhost:3000/api/invite/validate-by-code' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "email": "string",
  "code": 0
}'
```

### JavaScript

```javascript
const body = `{
  "email": "string",
  "code": 0
}`;

const response = await fetch('http://localhost:3000/api/invite/validate-by-code', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "email": "string",
  "code": 0
}'''

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