> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vambe.me/llms.txt
> Use this file to discover all available pages before exploring further.

# Get info of an AI contact

## Overview

Retrieve comprehensive information about a specific contact, including their profile data, active ticket, last closed ticket, and custom metadata. This endpoint is essential for getting the complete context of a contact's current state and interaction history.

## Use Cases

* **Contact Profile Display**: Show detailed contact information in your CRM or dashboard
* **Ticket Management**: Access current and historical ticket data for support workflows
* **Custom Data Integration**: Retrieve custom metadata fields for personalized experiences
* **Contact Status Tracking**: Monitor contact engagement status and last interaction
* **Support Agent Context**: Provide agents with full contact history before responding
* **Agent Assignment Tracking**: See which team members are currently assigned to a contact

## Authentication

This endpoint requires authentication using an API key. Include your API key in the request header:

```
x-api-key: your_api_key_here
```

## Path Parameters

| Parameter     | Type          | Required | Description                                  |
| ------------- | ------------- | -------- | -------------------------------------------- |
| `aiContactId` | string (UUID) | Yes      | Unique identifier of the contact to retrieve |

## Response Structure

The endpoint returns a contact object with the following structure:

### Contact Object

| Field                      | Type           | Description                                                      |
| -------------------------- | -------------- | ---------------------------------------------------------------- |
| `id`                       | string (UUID)  | Unique identifier for the contact                                |
| `name`                     | string         | Contact's full name                                              |
| `email`                    | string \| null | Contact's email address                                          |
| `phone`                    | string \| null | Contact's phone number                                           |
| `platform`                 | string         | Communication channel (e.g., "whatsapp", "instagram", "webchat") |
| `created_at`               | string (ISO)   | Timestamp when the contact was created                           |
| `last_message_at`          | string (ISO)   | Timestamp of the last message sent or received                   |
| `last_message_content`     | string \| null | Content of the last message                                      |
| `chat_status`              | string         | Current chat status (e.g., "UNATTENDED", "ATTENDED", "CLOSED")   |
| `is_chat_read`             | boolean        | Whether the chat has been read by an agent                       |
| `blocked`                  | boolean        | Whether the contact is blocked                                   |
| `client_id`                | string (UUID)  | ID of the client/owner account                                   |
| `ai_customer_id`           | string (UUID)  | Associated customer profile ID                                   |
| `default_stage_id`         | string \| null | ID of the contact's current pipeline stage                       |
| `active_ticket_v2_id`      | string \| null | ID of the currently active ticket                                |
| `last_closed_ticket_v2_id` | string \| null | ID of the most recently closed ticket                            |
| `current_integration_data` | object \| null | Integration-specific data (e.g., CRM sync info)                  |
| `metadata`                 | object         | Custom key-value pairs for additional contact data               |
| `active_ticket`            | object \| null | Details of the currently active ticket                           |
| `last_closed_ticket`       | object \| null | Details of the last closed ticket                                |
| `assigned_agents`          | array          | List of team members assigned to this contact                    |

### Assigned Agent Object

Each item in the `assigned_agents` array contains:

| Field   | Type          | Description                                           |
| ------- | ------------- | ----------------------------------------------------- |
| `id`    | string (UUID) | Unique identifier of the assigned team member         |
| `name`  | string        | Full name of the team member (first name + last name) |
| `email` | string        | Email address of the team member                      |

### Active Ticket Object

When a contact has an active ticket, the `active_ticket` field contains:

| Field            | Type           | Description                                  |
| ---------------- | -------------- | -------------------------------------------- |
| `id`             | string (UUID)  | Unique ticket identifier                     |
| `ai_contact_id`  | string (UUID)  | Associated contact ID                        |
| `status`         | string         | Ticket status (e.g., "OPEN", "IN\_PROGRESS") |
| `created_at`     | string (ISO)   | Ticket creation timestamp                    |
| `updated_at`     | string (ISO)   | Last update timestamp                        |
| `ticket_summary` | string \| null | AI-generated or human summary of the ticket  |
| `metadata`       | object         | Custom ticket metadata                       |

### Last Closed Ticket Object

The `last_closed_ticket` field has the same structure as `active_ticket` but represents the most recently closed ticket.

## Example Response

```json theme={null}
{
  "id": "df980fc8-b6db-4820-bf22-2969482d106d",
  "name": "Maria Rodriguez",
  "email": "maria.rodriguez@example.com",
  "phone": "+56912345678",
  "platform": "whatsapp",
  "created_at": "2024-01-15T10:30:00.000Z",
  "last_message_at": "2024-09-30T14:25:33.000Z",
  "last_message_content": "Gracias por tu ayuda!",
  "chat_status": "ATTENDED",
  "is_chat_read": true,
  "blocked": false,
  "client_id": "550e8400-e29b-41d4-a716-446655440000",
  "ai_customer_id": "660e8400-e29b-41d4-a716-446655440001",
  "default_stage_id": "770e8400-e29b-41d4-a716-446655440002",
  "active_ticket_v2_id": "880e8400-e29b-41d4-a716-446655440003",
  "last_closed_ticket_v2_id": "990e8400-e29b-41d4-a716-446655440004",
  "current_integration_data": {
    "crm_id": "12345",
    "last_sync": "2024-09-30T12:00:00.000Z"
  },
  "metadata": {
    "company": "Acme Corp",
    "plan": "Premium",
    "customer_since": "2024-01-15",
    "preferred_language": "es"
  },
  "active_ticket": {
    "id": "880e8400-e29b-41d4-a716-446655440003",
    "ai_contact_id": "df980fc8-b6db-4820-bf22-2969482d106d",
    "status": "IN_PROGRESS",
    "created_at": "2024-09-30T10:00:00.000Z",
    "updated_at": "2024-09-30T14:25:33.000Z",
    "ticket_summary": "Customer inquiring about premium plan upgrade options and pricing",
    "metadata": {
      "priority": "high",
      "category": "sales",
      "assigned_agent": "John Doe"
    }
  },
  "last_closed_ticket": {
    "id": "990e8400-e29b-41d4-a716-446655440004",
    "ai_contact_id": "df980fc8-b6db-4820-bf22-2969482d106d",
    "status": "CLOSED",
    "created_at": "2024-09-25T09:00:00.000Z",
    "updated_at": "2024-09-25T15:30:00.000Z",
    "ticket_summary": "Billing inquiry resolved - payment processed successfully",
    "metadata": {
      "priority": "medium",
      "category": "billing",
      "resolution_time": "6.5 hours"
    }
  },
  "assigned_agents": [
    {
      "id": "228d7a0d-9072-4ca8-939b-959b75cc606a",
      "name": "John Doe",
      "email": "john.doe@example.com"
    },
    {
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "name": "Jane Smith",
      "email": "jane.smith@example.com"
    }
  ]
}
```

## Common Use Cases

### 1. Display Contact Profile in Dashboard

```javascript theme={null}
const contactId = 'df980fc8-b6db-4820-bf22-2969482d106d';

const response = await fetch(
  `https://api.vambe.me/api/public/contact/${contactId}/info`,
  {
    headers: {
      'x-api-key': 'your_api_key_here',
    },
  },
);

const contact = await response.json();

// Display in UI
console.log(`Name: ${contact.name}`);
console.log(`Email: ${contact.email}`);
console.log(`Phone: ${contact.phone}`);
console.log(`Platform: ${contact.platform}`);
console.log(`Status: ${contact.chat_status}`);
```

### 2. Check for Active Tickets

```javascript theme={null}
const response = await fetch(
  `https://api.vambe.me/api/public/contact/${contactId}/info`,
  {
    headers: {
      'x-api-key': 'your_api_key_here',
    },
  },
);

const contact = await response.json();

if (contact.active_ticket) {
  console.log('Active ticket found:', contact.active_ticket.ticket_summary);
  console.log('Ticket status:', contact.active_ticket.status);
  console.log(
    'Created:',
    new Date(contact.active_ticket.created_at).toLocaleString(),
  );
} else {
  console.log('No active tickets for this contact');
}
```

### 3. Access Custom Metadata

```javascript theme={null}
const response = await fetch(
  `https://api.vambe.me/api/public/contact/${contactId}/info`,
  {
    headers: {
      'x-api-key': 'your_api_key_here',
    },
  },
);

const contact = await response.json();

// Access custom metadata
const company = contact.metadata?.company;
const plan = contact.metadata?.plan;
const customerSince = contact.metadata?.customer_since;

console.log(
  `${contact.name} from ${company} has been a ${plan} customer since ${customerSince}`,
);
```

### 4. Get Last Interaction Info

```javascript theme={null}
const response = await fetch(
  `https://api.vambe.me/api/public/contact/${contactId}/info`,
  {
    headers: {
      'x-api-key': 'your_api_key_here',
    },
  },
);

const contact = await response.json();

const lastMessageDate = new Date(contact.last_message_at);
const daysSinceLastMessage = Math.floor(
  (Date.now() - lastMessageDate.getTime()) / (1000 * 60 * 60 * 24),
);

console.log(`Last message: ${contact.last_message_content}`);
console.log(`${daysSinceLastMessage} days ago`);
console.log(`Read status: ${contact.is_chat_read ? 'Read' : 'Unread'}`);
```

## Chat Status Values

The `chat_status` field can have the following values:

| Status       | Description                                             |
| ------------ | ------------------------------------------------------- |
| `UNATTENDED` | New message received, not yet attended by an agent      |
| `ATTENDED`   | Agent is actively working on the conversation           |
| `CLOSED`     | Conversation has been closed/resolved                   |
| `PENDING`    | Waiting for customer response or additional information |

## Platform Values

The `platform` field indicates the communication channel:

| Platform    | Description               |
| ----------- | ------------------------- |
| `whatsapp`  | WhatsApp (API or QR)      |
| `instagram` | Instagram Direct Messages |
| `webchat`   | Web chat widget           |
| `tiktok`    | TikTok Direct Messages    |
| `sms`       | SMS messages              |
| `messenger` | Facebook Messenger        |
| `voice`     | Voice calls               |

## Error Responses

| Status Code | Description                                  |
| ----------- | -------------------------------------------- |
| 400         | Bad Request - Invalid contact ID format      |
| 401         | Unauthorized - Invalid or missing API key    |
| 404         | Not Found - Contact does not exist           |
| 500         | Internal Server Error - Something went wrong |

## Tips

* **Contact ID Format**: Always use the UUID format for `aiContactId`
* **Null Values**: Many fields can be `null` - always check before accessing nested properties
* **Metadata Structure**: Custom metadata fields vary by organization - check your specific fields
* **Ticket History**: Only the last closed ticket is returned, not all historical tickets
* **Real-time Data**: This endpoint returns current data - for historical conversation data, use the messages endpoint
* **Backward Compatibility**: The response includes both `active_ticket_v2` and `active_ticket` for compatibility


## OpenAPI

````yaml get /api/public/contact/{aiContactId}/info
openapi: 3.0.0
info:
  title: Vambe AI API
  description: Vambe AI documentation
  version: '1.0'
  contact: {}
servers:
  - url: https://api.vambe.me
    description: Production Server
security: []
tags:
  - name: Vambe AI
    description: ''
paths:
  /api/public/contact/{aiContactId}/info:
    get:
      tags:
        - Contact
      summary: Get info of an AI contact
      operationId: PublicAiContactController_getAiContactInfo
      parameters:
        - name: x-api-key
          in: header
          description: API key required to authorize the request
          required: true
          schema:
            type: string
        - name: aiContactId
          required: true
          in: path
          description: ID of the AI contact
          schema:
            type: string
        - name: isoDates
          required: false
          in: query
          description: >-
            When true, date/datetime custom fields are serialized in ISO 8601
            format (e.g. "2026-03-31T20:00:00.000Z" or "2026-03-31" for
            date-only fields). Defaults to false for backward compatibility.
          schema:
            type: boolean
      responses:
        '200':
          description: AI contact info retrieved successfully.
        '404':
          description: AI contact not found.

````