# Models

## The UsageLimits object

```json
{"openapi":"3.1.0","info":{"title":"DM Champ API","version":"1.0.0"},"components":{"schemas":{"UsageLimits":{"type":"object","properties":{"monthly_credits":{"type":"integer","description":"Total monthly credits allocated"},"monthly_credits_used":{"type":"integer","description":"Number of monthly credits used"},"last_reset_date":{"type":"string","format":"date-time","description":"Date when the credits were last reset"},"notifications":{"type":["object","null"],"description":"Notification settings"},"credits":{"type":"integer","description":"Current credit balance"},"roll_over_to_next_month":{"type":"boolean","description":"Whether unused credits roll over to next month"}}}}}}
```

## The Contact object

```json
{"openapi":"3.1.0","info":{"title":"DM Champ API","version":"1.0.0"},"components":{"schemas":{"Contact":{"type":"object","required":["phoneNumber"],"properties":{"phoneNumber":{"type":"string","description":"Contact's phone number (must include valid country code)"},"firstName":{"type":"string","description":"Contact's first name","default":"Unknown"},"lastName":{"type":"string","description":"Contact's last name","default":"Unknown"},"email":{"type":"string","description":"Contact's email address","format":"email","default":"unknown@unknown.com"},"is_bot_active":{"type":"boolean","description":"Whether the bot is active for this contact","default":true},"listId":{"type":"string","description":"Single list ID to add the contact to upon creation"},"listIds":{"type":"array","items":{"type":"string"},"description":"Multiple list IDs to add the contact to upon creation (takes precedence over listId)"},"instagramId":{"type":["string","null"],"description":"Contact's Instagram ID"},"currentCampaign":{"type":["string","null"],"description":"Current campaign identifier"},"currentCampaignData":{"type":["object","null"],"description":"Data associated with current campaign"},"channel":{"type":["string","null"],"description":"Communication channel"},"isChatWindowOpen":{"type":"boolean","default":false,"description":"Whether chat window is open"},"externalId":{"type":["string","null"],"description":"External identifier"},"customChannel":{"type":["string","null"],"description":"Custom channel identifier"},"chatWidgetId":{"type":["string","null"],"description":"Chat widget identifier"},"do_not_disturb":{"type":"boolean","default":false,"description":"Whether the contact should not be disturbed"}}}}}}
```

## The SubAccount object

```json
{"openapi":"3.1.0","info":{"title":"DM Champ API","version":"1.0.0"},"components":{"schemas":{"SubAccount":{"type":"object","required":["email","first_name","last_name","usage_limits"],"properties":{"email":{"type":"string","description":"Sub-account user's email address","format":"email"},"first_name":{"type":"string","description":"Sub-account user's first name"},"last_name":{"type":"string","description":"Sub-account user's last name"},"role":{"type":"string","description":"Role of the sub-account (always \"Sub Account\")","default":"Sub Account"},"is_agency_sub_account":{"type":"boolean","default":true,"description":"Indicates this is a sub-account"},"business_name":{"type":"string","description":"Business name for the sub-account"},"description":{"type":"string","description":"Business description"},"address_line":{"type":"string","description":"Business address line"},"city":{"type":"string","description":"Business city"},"country":{"type":"string","description":"Business country"},"postal_code":{"type":"string","description":"Business postal code"},"state":{"type":"string","description":"Business state"},"time_zone_id":{"type":"string","description":"Time zone identifier"},"language":{"type":"string","description":"Preferred language"},"usage_limits":{"type":"object","required":["monthly_credits"],"properties":{"monthly_credits":{"type":"integer","description":"Total monthly credits allocated","minimum":1},"monthly_credits_used":{"type":"integer","description":"Number of monthly credits used","default":0},"credits":{"type":"integer","description":"Current credit balance"},"roll_over_to_next_month":{"type":"boolean","description":"Whether unused credits roll over to next month","default":false}}}}}}}}
```

## The Tag object

```json
{"openapi":"3.1.0","info":{"title":"DM Champ API","version":"1.0.0"},"components":{"schemas":{"Tag":{"type":"object","required":["name"],"properties":{"name":{"type":"string","description":"Tag name"},"description":{"type":"string","description":"Tag description"}}}}}}
```

## The Message object

```json
{"openapi":"3.1.0","info":{"title":"DM Champ API","version":"1.0.0"},"components":{"schemas":{"Message":{"type":"object","properties":{"content":{"type":"string","description":"Message content"},"timestamp":{"type":"string","format":"date-time"},"sender":{"type":"string"},"channel":{"type":"string"}}}}}}
```

## The ChatMessage object

```json
{"openapi":"3.1.0","info":{"title":"DM Champ API","version":"1.0.0"},"components":{"schemas":{"ChatMessage":{"type":"object","description":"A message within a chat session","properties":{"id":{"type":"string","description":"Unique message identifier"},"body":{"type":"string","description":"Message body/content"},"direction":{"type":"string","enum":["inbound","outbound"],"description":"Message direction"},"timestamp":{"type":["string","null"],"format":"date-time","description":"Message timestamp"},"type":{"type":"string","description":"Message type"},"channel":{"type":"string","description":"Channel the message was sent through"},"status":{"type":"string","description":"Message delivery status"}}}}}}
```

## The ChatSession object

```json
{"openapi":"3.1.0","info":{"title":"DM Champ API","version":"1.0.0"},"components":{"schemas":{"ChatSession":{"type":"object","description":"A chat session between the user and a contact","properties":{"id":{"type":"string","description":"Unique session identifier"},"start_date_time":{"type":"string","format":"date-time","description":"Session start timestamp (ISO 8601)"},"end_date_time":{"type":"string","format":"date-time","description":"Session end timestamp (ISO 8601)"},"status":{"type":"string","enum":["ChatSessionOpened","ChatSessionClosed"],"description":"Current session status"},"tag":{"type":["string","null"],"description":"Tag associated with this session"},"messages":{"type":"array","description":"Session messages. Only present when includeMessages=true","items":{"$ref":"#/components/schemas/ChatMessage"}}}},"ChatMessage":{"type":"object","description":"A message within a chat session","properties":{"id":{"type":"string","description":"Unique message identifier"},"body":{"type":"string","description":"Message body/content"},"direction":{"type":"string","enum":["inbound","outbound"],"description":"Message direction"},"timestamp":{"type":["string","null"],"format":"date-time","description":"Message timestamp"},"type":{"type":"string","description":"Message type"},"channel":{"type":"string","description":"Channel the message was sent through"},"status":{"type":"string","description":"Message delivery status"}}}}}}
```

## The RecentChatSession object

```json
{"openapi":"3.1.0","info":{"title":"DM Champ API","version":"1.0.0"},"components":{"schemas":{"RecentChatSession":{"type":"object","description":"A recent chat session with contact details","properties":{"session_id":{"type":"string","description":"Unique session identifier"},"contact_id":{"type":"string","description":"Contact identifier"},"contact_name":{"type":"string","description":"Contact full name"},"contact_phone":{"type":"string","description":"Contact phone number"},"contact_email":{"type":"string","description":"Contact email address"},"start_date_time":{"type":"string","format":"date-time","description":"Session start timestamp (ISO 8601)"},"end_date_time":{"type":"string","format":"date-time","description":"Session end timestamp (ISO 8601)"},"status":{"type":"string","enum":["ChatSessionOpened","ChatSessionClosed"],"description":"Current session status"},"tag":{"type":["string","null"],"description":"Tag associated with this session"},"messages":{"type":"array","description":"Session messages. Only present when includeMessages=true","items":{"$ref":"#/components/schemas/ChatMessage"}}}},"ChatMessage":{"type":"object","description":"A message within a chat session","properties":{"id":{"type":"string","description":"Unique message identifier"},"body":{"type":"string","description":"Message body/content"},"direction":{"type":"string","enum":["inbound","outbound"],"description":"Message direction"},"timestamp":{"type":["string","null"],"format":"date-time","description":"Message timestamp"},"type":{"type":"string","description":"Message type"},"channel":{"type":"string","description":"Channel the message was sent through"},"status":{"type":"string","description":"Message delivery status"}}}}}}
```

## The ChatExport object

```json
{"openapi":"3.1.0","info":{"title":"DM Champ API","version":"1.0.0"},"components":{"schemas":{"ChatExport":{"type":"object","description":"Chat export data for a single contact","properties":{"contactId":{"type":"string","description":"Contact identifier"},"contactName":{"type":"string","description":"Contact full name"},"phoneNumber":{"type":"string","description":"Contact phone number"},"email":{"type":"string","description":"Contact email address"},"messageCount":{"type":"integer","description":"Number of messages in the export"},"chatExport":{"type":"string","description":"Full chat export as formatted text"}}}}}}
```

## The OtpResponse object

```json
{"openapi":"3.1.0","info":{"title":"DM Champ API","version":"1.0.0"},"components":{"schemas":{"OtpResponse":{"type":"object","description":"OTP generation response","properties":{"success":{"type":"boolean"},"current_otp":{"type":"string","description":"Current 6-digit TOTP code"},"expires_in":{"type":"integer","description":"Seconds until the current code expires (0-30)"}}}}}}
```
