Caller context

When the phone rings, knowing who's calling turns a cold call into a warm one. The Caller context endpoint takes a phone number, queries every integration you've connected to your Phone.inc account, and returns matching data in a generic, structured format.

The caller context model

The endpoint returns an array of contexts — one per provider that found a match. Each context contains sections — either key-value fields or tables — with optional format hints so your UI can render money, dates, and badges appropriately.

Partner OAuth tokens need caller_context:read to call this lookup API. This does not grant outbound delivery of caller numbers to the partner. Embedded contact fields require contacts:read and are omitted without it. API-key behavior is unchanged.

Shopify returns up to three recent orders. The order table separates payment status (status) from fulfillment status (fulfillment). Shipment field sections include up to three fulfillments per order and two tracking entries per fulfillment, with carrier, tracking number, safe HTTPS links, and estimated delivery when available. Estimates are not guarantees. Cancelled or failed shipments have no actionable tracking links. Render tracking links using the existing field url property. The get_caller_context MCP tool returns the same sections.

Each Shopify order row includes details: up to five ordered line items as plain-text quantity, product title, and variant. Quantities include refunded or removed units. A final More items in Shopify entry indicates that the list is incomplete; follow the order URL for the full order. Deleted products remain visible through Shopify's saved line-item titles.

These are the matched customer's recent orders, not evidence that a particular call concerns one of them. The inbox queries Shopify when a thread is selected or the page is reloaded; it does not poll or subscribe to shipment updates while the thread stays open. Shopify's carrier data may lag. Historical call snapshots can be older than the live order data.

Top-level properties

  • Name
    contexts
    Type
    array
    Description

    One entry per provider that matched the phone number. Empty if no integration recognized the caller.

  • Name
    enriched_at
    Type
    timestamp
    Description

    ISO 8601 timestamp of when the lookup was performed. null if no providers were queried.

  • Name
    contact
    Type
    object | null
    Description

    The matching Phone.inc contact, if one exists for this number.

Context entry

  • Name
    provider
    Type
    string
    Description

    Machine-readable identifier for the source system, e.g. shopify, custom_endpoint.

  • Name
    label
    Type
    string
    Description

    Human-readable name shown in the UI, e.g. Shopify, Internal CRM.

  • Name
    source
    Type
    string
    Description

    The store, workspace, or account identifier, e.g. acme.myshopify.com.

  • Name
    url
    Type
    string | null
    Description

    Deep link to the matched record in the provider's admin UI.

  • Name
    contact
    Type
    object | null
    Description

    Identity returned by the provider. When it includes a name, Phone.inc creates a contact for the lookup phone number or fills blank fields on the existing contact. If multiple providers match, identities are merged in priority order: custom endpoint, Shopify, then Dinero.

  • Name
    sections
    Type
    array
    Description

    Array of section objects. Each section is either a fields section or a table section.

Provider contact

  • Name
    name
    Type
    string
    Description

    Contact name. Required for Phone.inc to cache the identity. Maximum 128 characters.

  • Name
    email
    Type
    string | null
    Description

    Valid email address, truncated to 320 characters before validation. Invalid values are ignored.

  • Name
    company_name
    Type
    string | null
    Description

    Business or employer name. Maximum 128 characters.

  • Name
    note
    Type
    string | null
    Description

    Optional note copied to the contact. Maximum 10,000 characters.

Fields section

  • Name
    type
    Type
    string
    Description

    Always "fields".

  • Name
    label
    Type
    string
    Description

    Optional heading above the field list.

  • Name
    fields
    Type
    array
    Description

    Array of field objects with label, value, optional format, url, and bold.

Table section

  • Name
    type
    Type
    string
    Description

    Always "table".

  • Name
    label
    Type
    string
    Description

    Required heading above the table.

  • Name
    columns
    Type
    array
    Description

    Column definitions with key, label, and optional format.

  • Name
    rows
    Type
    array
    Description

    Row objects with url (optional link for the row), values (a map of column key to value), and optional details (a plain-text sublist). Details contain at most six strings of 500 characters each. The web caller-context sidebar renders them beneath the row; clients that do not support sublists can ignore them.

Format hints

Values can include a format hint to control rendering:

FormatValue shapeRendering
textString (default)Rendered as-is
money{ "amount": "89", "currency": "DKK" }Locale-formatted with currency symbol
dateISO 8601 stringRelative or absolute date
emailStringClickable mailto link
phoneString (E.164)Tap-to-call on mobile
badgeStringColored status pill

To make any value clickable, use the field-level url property instead of a format hint.


GET/v1/caller_context

Look up a caller

Query every connected integration for the given phone number and return the matched data. Designed to be called the moment an inbound call rings — the response is fast enough to surface customer context before the employee picks up.

Pass the caller's phone number in E.164 format. Other formats are accepted on a best-effort basis, but E.164 produces the most reliable matches.

If no integration is connected, or none recognizes the number, you'll get an empty contexts array — that's the success path, not an error.

Required query parameters

  • Name
    phone
    Type
    string
    Description

    The caller's phone number, ideally in E.164 (e.g. +14155551234). Required — calling the endpoint without it returns 400.

Request

GET
/v1/caller_context
curl -G https://app.phone.inc/api/v1/caller_context \
  -H "X-Api-Key: $PHONE_INC_API_KEY" \
  --data-urlencode phone=+14085550199

Response

{
  "contexts": [
    {
      "provider": "shopify",
      "label": "Shopify",
      "source": "acme-store.myshopify.com",
      "url": "https://acme-store.myshopify.com/admin/customers/8123456789",
      "contact": {
        "name": "Jamie Rivera",
        "email": "jamie@example.com"
      },
      "sections": [
        {
          "type": "fields",
          "fields": [
            { "label": "Customer", "value": "Jamie Rivera", "url": "https://acme-store.myshopify.com/admin/customers/8123456789" },
            { "label": "Email", "value": "jamie@example.com", "format": "email" },
            { "label": "Phone", "value": "+14085550199", "format": "phone" }
          ]
        },
        {
          "type": "table",
          "label": "Orders",
          "columns": [
            { "key": "name", "label": "Order" },
            { "key": "date", "label": "Date", "format": "date" },
            { "key": "total", "label": "Total", "format": "money" },
            { "key": "status", "label": "Status", "format": "badge" }
          ],
          "rows": [
            {
              "url": "https://acme-store.myshopify.com/admin/orders/4112233445",
              "values": {
                "name": "#1042",
                "date": "2026-05-09T22:14:01Z",
                "total": { "amount": "129.95", "currency": "USD" },
                "status": "Paid"
              }
            }
          ]
        }
      ]
    }
  ],
  "enriched_at": "2026-05-11T16:45:09Z",
  "contact": null
}

Missing phone

{
  "error": "phone parameter required"
}

Signed partner lookups

A company-owned SaaS app can register a context_endpoint_url and enable caller_context:provide. Phone.inc sends a signed POST to that endpoint only when the connected installation grants caller_context:provide. This scope requires an app context endpoint and can be granted alone for a context-only installation; it does not grant lookup API access. caller_context:read alone never enables outbound delivery. This is a synchronous lookup requiring an immediate JSON response, not an asynchronous webhook or a new Phone.inc API route. Apps without an endpoint remain valid API-only integrations.

To verify an installed partner endpoint without creating or updating contacts, use the partner caller-context test. It sends the same signed request, strictly validates the response for preview, and keeps the same SSRF protections. The integration reference covers permissions, E.164 input, and diagnostic errors.

The request has Content-Type: application/json and a JSON object containing exactly these three fields:

Lookup request body

{
  "installation_id": "019daef1-085e-73f0-85f6-a71e2d8dd2cc",
  "company_id": "019daef1-085e-73f0-85f6-a71e2d8dd2cd",
  "phone": "+4512345678"
}

Use the installation_id mapping saved at OAuth token exchange to resolve your SaaS tenant, and check the associated company_id. Do not select a tenant from the phone number alone.

Verify the signature

HeaderValue
X-Phone-Inc-TimestampUnix timestamp in seconds
X-Phone-Inc-Signaturev1= followed by a hex HMAC-SHA256 digest

The digest uses the separate context signing secret, not the OAuth client secret. Its message is the timestamp header, a literal ., and the exact raw request body bytes:

v1=<hex HMAC-SHA256(context_signing_secret, timestamp + "." + raw_request_body)>

Capture the raw bytes before JSON parsing. Reject missing or malformed headers, reject stale timestamps (a five-minute tolerance is recommended), and compare the expected and received digests in constant time. Re-serializing parsed JSON changes the signed bytes and can invalidate the signature. Keep the signing secret server-side. Phone.inc does not send its OAuth bearer tokens to your endpoint; do not require or forward one for these lookups.

Return caller context

Return a JSON context object using the existing context-entry schema above: provider, label, source, url, contact, and sections. Do not wrap it in a new delivery envelope. Phone.inc sanitizes the response and overrides provider and label with the registered app identity. The integration provider slug is partner.

Existing display limits apply: at most 5 sections, 15 fields per fields section, 8 columns and 10 rows per table, and 500-character display strings. The provider-contact limits above apply to contact identity. Contact enrichment fills blank fields only; it never overwrites populated customer contact fields.

ResponseLookup behavior
200 with valid context JSONSanitize and display matching context
204 or 404No match
429Transient failure; contributes to endpoint backoff
Other failures, timeouts, or invalid responsesSkip context without interrupting call routing; contributes to endpoint backoff

The endpoint must use HTTPS without credentials, query parameters, or a fragment. Phone.inc verifies TLS, checks DNS and destination IPs to prevent SSRF, and does not follow redirects. Requests have 3-second connect and read timeouts within an overall 5-second budget. Responses are bounded to 256 KiB. Keep responses small and fast; do not acknowledge the request and deliver results asynchronously.

After three consecutive failures, Phone.inc pauses that application's caller-context endpoint across all installations for 60 seconds. Requests during the cooldown skip the endpoint; previews report the temporary pause. After the delay, one request probes recovery while other requests remain paused. A successful context response or healthy 204/404 clears the failures; a failed probe starts another cooldown. Previews use this same backoff and the separate partner test budget. An application suspension stops lookups independently of this automatic backoff.

Adding enabled application scopes does not stop existing caller lookups. Removing caller_context:provide from the installation or application stops lookups; removing unrelated permissions does not, while that permission remains granted. Removing every installed permission disconnects the installation. Disconnecting an installation, deleting the app, rotating its secrets, or changing redirects or the endpoint still stops lookups until fresh authorization. Previously stored call context is retained. See the incremental permission lifecycle.