Find a conversation

Find the conversation a line has with an address, before that person writes again

POST/v1/conversation-lookup

Returns the id of the one-to-one conversation a line has with an address: the id target.conversationId, GET /v1/conversations/{conversationId}/messages and the stream's events use. Use it when you need that id before the person writes again, for example when you move your own message history onto this API and have people you last talked to before you started streaming.

On an iMessage line Mapier also asks the line itself, which knows conversations from before the line's first message through Mapier. When the line knows a conversation Mapier has no record of yet, Mapier opens it, the way a first send would, and emits conversation.created. Nothing is sent, and no contact is created. The person's next message, and your next send to them, land in the conversation the lookup named.

Like the handle check, this is a synchronous read: the answer is in the HTTP response, and nothing arrives on the stream.

Body

Prop

Type

curl https://api.mapier.ai/v1/conversation-lookup \
  -H "Authorization: Bearer $MAPIER_API_KEY" \
  -H "x-mapier-version: 2026-12-01" \
  -H "Content-Type: application/json" \
  -d '{ "lineId": "0195f3a2-5c1e-7b4d-9a8e-2f6c1d3b4a50", "address": "+14155550100" }'

Response

200
{
  "id": "0195f3a2-6d2f-7c5e-8b9f-3a7d2e4c5b61",
  "isGroup": false,
  "firstObservedAt": "2026-07-14T09:30:00.000Z"
}

Prop

Type

When there is no conversation

404 not_found means the line has no conversation with the address: the line's channel said so, or the line keeps no history to ask (a retired line, or a channel that keeps none) and Mapier has no conversation with the address either. A line this key cannot see is the same 404, with a message that says so. A 404 is never the answer when the channel could not be asked.

When the lookup cannot run

When the line's channel could not be asked, the lookup never answers 404. If Mapier already has the conversation, the answer is still a 200, with firstObservedAt: null. If it does not, you get the channel's refusal, a 503 upstream_unavailable or 503 line_unavailable with details.reason, and the question is worth asking again later.

Errors

StatusCodeCause
400bad_requestThe body is not JSON, or the channel refused the request as malformed (details.reason is its word); or, with a personal access token, no x-mapier-project header
401invalid_credentialsNo key, or one that is unknown, revoked or expired
403forbiddenA personal access token not made for this environment, or whose owner's role no longer allows this
403insufficient_scopeThe key does not carry the messages:read scope
404not_foundThe line has never had a conversation with the address, or the line is not one this key can see
404unsupported_commandreason: shared_line: the line is a test line on a shared number, which does not answer this lookup
409project_archivedThe project is archived
413payload_too_largeBody over 65,536 bytes
422validation_failedlineId is not a UUID, or address is missing or not a form the line's channel accepts
429rate_limited30 requests per minute, per key; the Retry-After header says how long to wait (a channel's own rate limit may give the same seconds in details.retryAfter too)
500internal_errorAn unexpected error on Mapier's side; quote the error's requestId to support
503line_unavailable · upstream_unavailableThe line's channel could not be asked (see When the lookup cannot run); details.retryAfter, when present, says when to ask again
503service_busyMapier was too busy to take the request and did nothing; wait details.retryAfter seconds and ask again

Guide