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

# GET /v1/contacts/:id

> Read a single messaging contact, with its custom fields and activity timestamps.

Returns one contact by id. Use [`GET /v1/contacts`](/dev/endpoints/contacts-list) to find the id first.

## Endpoint

```
GET https://api.keebai.com/v1/contacts/{id}
```

## Required scope

`contacts:read`

## Headers

| Header          | Required | Value                    |
| --------------- | -------- | ------------------------ |
| `Authorization` | Yes      | `Bearer kbai_pk_<token>` |

## Path parameters

| Field | Type     | Required | Description                |
| ----- | -------- | -------- | -------------------------- |
| `id`  | `string` | Yes      | `ObjectId` of the contact. |

## Example request

<CodeGroup>
  ```bash curl theme={null}
  curl https://api.keebai.com/v1/contacts/65a1f2b3c4d5e6f7a8b9c0d1 \
    -H "Authorization: Bearer kbai_pk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  ```

  ```js JavaScript theme={null}
  const response = await fetch(
    `https://api.keebai.com/v1/contacts/${contactId}`,
    {
      headers: { Authorization: `Bearer ${process.env.KEEBAI_API_TOKEN}` },
    },
  );
  const { contact } = await response.json();
  ```

  ```python Python theme={null}
  import os, requests

  resp = requests.get(
      f"https://api.keebai.com/v1/contacts/{contact_id}",
      headers={"Authorization": f"Bearer {os.environ['KEEBAI_API_TOKEN']}"},
      timeout=10,
  )
  resp.raise_for_status()
  contact = resp.json()["contact"]
  ```
</CodeGroup>

## Response

### 200 OK

```json theme={null}
{
  "contact": {
    "_id": "65a1f2b3c4d5e6f7a8b9c0d1",
    "channel_type": "whatsapp",
    "user_id": "56912345678",
    "channel_id": "65b1c2d3e4f5a6b7c8d9e0f1",
    "username": "juanp",
    "first_name": "Juan",
    "last_name": "Pérez",
    "phone": "+56912345678",
    "email": "juan@example.com",
    "profile_pic": "https://cdn.example.com/avatars/juan.jpg",
    "custom_fields": { "plan": "pro" },
    "tags": ["65c2d3e4f5a6b7c8d9e0f1a2"],
    "is_attended": true,
    "last_attended_at": "2026-05-02T14:35:00.000Z",
    "first_seen_at": "2026-04-18T09:12:44.010Z",
    "last_seen_at": "2026-05-02T14:31:07.221Z",
    "last_user_message_at": "2026-05-02T14:31:07.221Z",
    "last_bot_response_at": "2026-05-02T14:31:09.980Z",
    "last_agent_response_at": "2026-05-02T14:36:12.400Z",
    "created_at": "2026-04-18T09:12:44.010Z",
    "updated_at": "2026-05-02T14:36:12.400Z"
  }
}
```

### 401 Unauthorized

Missing, invalid, revoked, or expired token.

### 403 Forbidden

The token does not have the `contacts:read` scope.

### 404 Not Found

No contact with that id, the contact belongs to a different company, or it was absorbed by a merge.

### 502 Bad Gateway

The messaging service could not answer.

## Operational notes

* **The activity timestamps tell you who spoke last.** `last_user_message_at` is the contact, `last_bot_response_at` is the assistant, and `last_agent_response_at` is a human agent. Comparing them is the cheapest way to tell whether a conversation is waiting on you.
* **`is_attended`** flips to `true` when a human takes over the conversation in the portal.
* **`tags` are ids, not labels.** There is no public endpoint yet to resolve a tag id to its name.


## OpenAPI

````yaml GET /v1/contacts/{id}
openapi: 3.0.0
info:
  title: Keebai Public API
  description: Superficie pública REST autenticada con Personal Access Tokens (PAT).
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.keebai.com
    description: Production
security: []
tags: []
paths:
  /v1/contacts/{id}:
    get:
      tags:
        - contacts
      summary: Obtener detalle de un contacto
      operationId: PublicContactsController_get
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicContactEnvelopeDto'
      security:
        - PAT: []
components:
  schemas:
    PublicContactEnvelopeDto:
      type: object
      properties:
        contact:
          $ref: '#/components/schemas/PublicContactResponseDto'
      required:
        - contact
    PublicContactResponseDto:
      type: object
      properties:
        _id:
          type: string
          description: ObjectId del contacto
        channel_type:
          type: string
          enum:
            - web
            - whatsapp
            - whatsapp_qr
            - facebook
            - messenger
            - instagram
            - tiktok
            - telegram
            - email
            - phone
          description: Canal por el que existe el contacto
        user_id:
          type: string
          description: Identificador del contacto dentro de su canal
        channel_id:
          type: string
          description: ObjectId del canal concreto
        external_id:
          type: string
          description: Identificador en un sistema externo
        username:
          type: string
        first_name:
          type: string
        last_name:
          type: string
        phone:
          type: string
        email:
          type: string
        profile_pic:
          type: string
        custom_fields:
          type: object
          description: Campos personalizados de la company
        tags:
          description: Ids de tags
          type: array
          items:
            type: string
        is_attended:
          type: boolean
          description: true cuando un agente humano tomó la conversación
        last_attended_at:
          type: string
          format: date-time
        first_seen_at:
          type: string
          format: date-time
        last_seen_at:
          type: string
          format: date-time
        last_user_message_at:
          type: string
          format: date-time
        last_bot_response_at:
          type: string
          format: date-time
        last_agent_response_at:
          type: string
          format: date-time
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      required:
        - _id
        - channel_type
        - user_id
        - custom_fields
        - tags
        - is_attended
        - first_seen_at
        - created_at
        - updated_at
  securitySchemes:
    PAT:
      scheme: bearer
      bearerFormat: kbai_pk_<hex>
      type: http
      description: >-
        Personal Access Token con prefijo `kbai_pk_`. Generar desde el portal
        con permiso `developer.manage_tokens`.

````