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

# Lookup by phone

> Looks up comprehensive CRM context (matched contact record, active leads, and recent follow-ups) for an incoming chat message using phone number normalization and country code resolution. Requires `crm:read` scope.

Retrieves full CRM context for a customer from their incoming chat phone number, including matched contact profiles, active leads, and recent follow-up reminders.

### Phone normalization

The `phone` query parameter accepts phone numbers with or without a leading `+`, national punctuation, or country codes. The CRM automatically parses and normalizes the number to match against stored contact profiles.

### Query parameters

* `phone` (string, required): Customer phone number to resolve (e.g. `+15551234567` or `919876543210`).

### Returned context

* `matched` (boolean): Indicates whether a matching contact was identified.
* `contact` (object): Matched contact record, including tags and custom fields.
* `leads` (array): Active or closed deals associated with the contact.
* `recent_followups` (array): Scheduled follow-ups or recent action items.

### Required permissions

Requires an API key with the `crm:read` scope.


## OpenAPI

````yaml GET /inbox/by-phone
openapi: 3.1.0
info:
  title: Automate CRM API
  description: >-
    External integration API for Automate CRM. Manage leads, contacts, products,
    follow-ups, custom fields, and real-time inbox lookups.
  version: 1.0.0
servers:
  - url: https://crm-api.automatebusiness.com/api/v1/integrations-public
    description: Production Integration Server
security:
  - apiKeyAuth: []
paths:
  /inbox/by-phone:
    get:
      summary: Lookup Contact Context by Phone
      description: >-
        Looks up comprehensive CRM context (matched contact record, active
        leads, and recent follow-ups) for an incoming chat message using phone
        number normalization and country code resolution. Requires `crm:read`
        scope.
      operationId: lookupInboxByPhone
      parameters:
        - name: phone
          in: query
          required: true
          description: >-
            Phone number with or without leading '+', country code, or national
            formatting
          schema:
            type: string
            example: '+15551234567'
      responses:
        '200':
          description: CRM context resolved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InboxContextResponse'
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          $ref: '#/components/responses/ForbiddenError'
        '404':
          $ref: '#/components/responses/NotFoundError'
      security:
        - apiKeyAuth:
            - crm:read
components:
  schemas:
    InboxContextResponse:
      allOf:
        - $ref: '#/components/schemas/ReadSuccessEnvelope'
        - type: object
          properties:
            data:
              $ref: '#/components/schemas/InboxContext'
    ReadSuccessEnvelope:
      type: object
      description: Standard envelope returned by all GET (read) endpoints
      properties:
        status:
          type: string
          example: success
        code:
          type: integer
          example: 200
        message:
          type: string
          example: Integrations public retrieved successfully
        data:
          description: The returned entity, collection, or payload
        timestamp:
          type: string
          format: date-time
          example: '2026-10-26T10:00:00.000Z'
      required:
        - status
        - code
        - message
        - data
        - timestamp
    InboxContext:
      type: object
      properties:
        matched:
          type: boolean
          example: true
        normalized_phone:
          type: string
          example: '+15551234567'
        country_code:
          type: string
          example: '+1'
        contact:
          $ref: '#/components/schemas/Contact'
        leads:
          type: array
          items:
            $ref: '#/components/schemas/Lead'
        recent_followups:
          type: array
          items:
            $ref: '#/components/schemas/Followup'
    ErrorEnvelope:
      type: object
      description: Standard error envelope returned when a request fails
      properties:
        success:
          type: boolean
          example: false
        data:
          type: 'null'
          example: null
        error:
          type: object
          properties:
            message:
              type: string
              example: Validation failed
            details:
              type: array
              items:
                type: object
                properties:
                  message:
                    type: string
                    example: Required
                  field:
                    type: string
                    example: email
                  code:
                    type: string
                    example: invalid_type
          required:
            - message
      required:
        - success
        - data
        - error
    Contact:
      type: object
      properties:
        id:
          type: string
          example: cnt_941a7bc2
        first_name:
          type: string
          example: Jane
        last_name:
          type: string
          example: Doe
        phone_number:
          type: string
          example: '5551234567'
        country_code:
          type: string
          example: '+1'
        email:
          type: string
          format: email
          example: jane.doe@example.com
        tags:
          type: array
          items:
            type: string
          example:
            - vip
            - decision-maker
        custom_fields:
          type: object
          additionalProperties: true
          example:
            company_size: 100-500
        created_at:
          type: string
          format: date-time
          example: '2026-10-26T08:00:00.000Z'
        updated_at:
          type: string
          format: date-time
          example: '2026-10-26T08:00:00.000Z'
    Lead:
      type: object
      properties:
        id:
          type: string
          example: lead_890ef12a
        name:
          type: string
          example: Acme Corp Enterprise Deal
        email:
          type: string
          format: email
          example: lead@acmecorp.com
        phone:
          type: string
          example: '+15559876543'
        pipeline_id:
          type: string
          example: pipe_default
        stage_id:
          type: string
          example: stage_contacted
        stage_name:
          type: string
          example: Contacted
        assigned_to:
          type: string
          example: user_sarah
        tags:
          type: array
          items:
            type: string
          example:
            - enterprise
            - q4-inbound
        custom_fields:
          type: object
          additionalProperties: true
          example:
            deal_value: 50000
            industry: Technology
        meta_attribution:
          type: object
          properties:
            utm_source:
              type: string
              example: google
            utm_medium:
              type: string
              example: cpc
            utm_campaign:
              type: string
              example: fall_promo
        created_at:
          type: string
          format: date-time
          example: '2026-10-26T09:30:00.000Z'
        updated_at:
          type: string
          format: date-time
          example: '2026-10-26T09:30:00.000Z'
    Followup:
      type: object
      properties:
        id:
          type: string
          example: fol_7721a9
        entity_id:
          type: string
          description: Target lead or contact ID
          example: lead_890ef12a
        entity_type:
          type: string
          enum:
            - lead
            - contact
          example: lead
        title:
          type: string
          example: Contract Review Call
        notes:
          type: string
          example: Review updated pricing terms with CFO
        due_date:
          type: string
          format: date-time
          example: '2026-10-30T15:00:00.000Z'
        reminder_at:
          type: string
          format: date-time
          example: '2026-10-30T14:45:00.000Z'
        status:
          type: string
          enum:
            - pending
            - completed
            - cancelled
          example: pending
        assigned_to:
          type: string
          example: user_sarah
        created_at:
          type: string
          format: date-time
          example: '2026-10-26T10:00:00.000Z'
  responses:
    ValidationError:
      description: Validation failed (e.g., missing required fields, invalid format)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            success: false
            data: null
            error:
              message: Validation failed
              details:
                - message: Required
                  field: email
                  code: invalid_type
    UnauthorizedError:
      description: Unauthorized (invalid or missing x-api-key)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            success: false
            data: null
            error:
              message: Invalid or missing API key.
    ForbiddenError:
      description: Forbidden (API key lacks required crm:read or crm:write scope)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            success: false
            data: null
            error:
              message: 'Forbidden: insufficient permissions for this operation.'
    NotFoundError:
      description: The requested entity or resource was not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            success: false
            data: null
            error:
              message: Resource not found
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Workspace API key header. The key implicitly determines your workspace
        isolation. Scopes: `crm:read` for GET/HEAD/OPTIONS, `crm:write` for
        POST/PATCH/PUT/DELETE.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.