# Contacts

Contact management operations

## List all contacts

> Returns all contacts accessible to the authenticated user

```json
{"openapi":"3.0.3","info":{"title":"Kaana Contacts API","version":"1.0.0"},"tags":[{"name":"Contacts","description":"Contact management operations"}],"servers":[{"url":"/api","description":"API base path"}],"security":[{"sessionAuth":[]}],"components":{"securitySchemes":{"sessionAuth":{"type":"apiKey","in":"cookie","name":"connect.sid","description":"Session-based authentication via HTTP-only cookie"}},"schemas":{"Contact":{"type":"object","required":["id","fullName","email","type","isActive","createdAt","updatedAt"],"properties":{"id":{"type":"integer","description":"Unique contact identifier"},"fullName":{"type":"string","description":"Contact's full name"},"mentionName":{"type":"string","nullable":true,"description":"Short name for @mentions"},"email":{"type":"string","format":"email","description":"Contact email address"},"phone":{"type":"string","nullable":true,"description":"Contact phone number"},"company":{"type":"string","nullable":true,"description":"Company name"},"title":{"type":"string","nullable":true,"description":"Job title"},"department":{"type":"string","nullable":true,"description":"Department"},"type":{"type":"string","enum":["internal","external","vendor","client"],"description":"Contact type"},"isActive":{"type":"boolean","description":"Whether the contact is active"},"metadata":{"type":"object","nullable":true,"description":"Additional contact metadata"},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp"},"updatedAt":{"type":"string","format":"date-time","description":"Last update timestamp"}}}}},"paths":{"/contacts":{"get":{"tags":["Contacts"],"summary":"List all contacts","description":"Returns all contacts accessible to the authenticated user","operationId":"listContacts","responses":{"200":{"description":"List of contacts","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}}}}},"401":{"description":"Not authenticated"},"403":{"description":"Access denied"},"500":{"description":"Server error"}}}}}}
```

## Create a new contact

> Creates a new contact. Requires consultant or admin role.

```json
{"openapi":"3.0.3","info":{"title":"Kaana Contacts API","version":"1.0.0"},"tags":[{"name":"Contacts","description":"Contact management operations"}],"servers":[{"url":"/api","description":"API base path"}],"security":[{"sessionAuth":[]}],"components":{"securitySchemes":{"sessionAuth":{"type":"apiKey","in":"cookie","name":"connect.sid","description":"Session-based authentication via HTTP-only cookie"}},"schemas":{"ContactCreate":{"type":"object","required":["fullName","email","type"],"properties":{"fullName":{"type":"string","description":"Contact's full name"},"mentionName":{"type":"string","nullable":true,"description":"Short name for @mentions"},"email":{"type":"string","format":"email","description":"Contact email address (must be unique)"},"phone":{"type":"string","nullable":true,"description":"Contact phone number"},"company":{"type":"string","nullable":true,"description":"Company name"},"title":{"type":"string","nullable":true,"description":"Job title"},"department":{"type":"string","nullable":true,"description":"Department"},"type":{"type":"string","enum":["internal","external","vendor","client"]},"isActive":{"type":"boolean","default":true},"metadata":{"type":"object","nullable":true},"canLogin":{"type":"boolean","default":false,"description":"Whether to create a user account for this contact"}}},"Contact":{"type":"object","required":["id","fullName","email","type","isActive","createdAt","updatedAt"],"properties":{"id":{"type":"integer","description":"Unique contact identifier"},"fullName":{"type":"string","description":"Contact's full name"},"mentionName":{"type":"string","nullable":true,"description":"Short name for @mentions"},"email":{"type":"string","format":"email","description":"Contact email address"},"phone":{"type":"string","nullable":true,"description":"Contact phone number"},"company":{"type":"string","nullable":true,"description":"Company name"},"title":{"type":"string","nullable":true,"description":"Job title"},"department":{"type":"string","nullable":true,"description":"Department"},"type":{"type":"string","enum":["internal","external","vendor","client"],"description":"Contact type"},"isActive":{"type":"boolean","description":"Whether the contact is active"},"metadata":{"type":"object","nullable":true,"description":"Additional contact metadata"},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp"},"updatedAt":{"type":"string","format":"date-time","description":"Last update timestamp"}}}}},"paths":{"/contacts":{"post":{"tags":["Contacts"],"summary":"Create a new contact","description":"Creates a new contact. Requires consultant or admin role.","operationId":"createContact","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactCreate"}}}},"responses":{"200":{"description":"Contact created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"400":{"description":"Validation error or email already exists"},"401":{"description":"Not authenticated"},"403":{"description":"Permission denied"},"500":{"description":"Server error"}}}}}}
```

## List contacts for mentions

> Returns contacts formatted for @mention functionality

```json
{"openapi":"3.0.3","info":{"title":"Kaana Contacts API","version":"1.0.0"},"tags":[{"name":"Contacts","description":"Contact management operations"}],"servers":[{"url":"/api","description":"API base path"}],"security":[{"sessionAuth":[]}],"components":{"securitySchemes":{"sessionAuth":{"type":"apiKey","in":"cookie","name":"connect.sid","description":"Session-based authentication via HTTP-only cookie"}}},"paths":{"/contacts/mentions":{"get":{"tags":["Contacts"],"summary":"List contacts for mentions","description":"Returns contacts formatted for @mention functionality","operationId":"listContactsForMentions","responses":{"200":{"description":"List of mentionable contacts","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"fullName":{"type":"string"},"mentionName":{"type":"string","nullable":true},"email":{"type":"string"}}}}}}},"401":{"description":"Not authenticated"},"500":{"description":"Server error"}}}}}}
```
