GET /v1/lines/available

Which of your numbers somebody new would get right now, so your app can show it to a person who is about to text you.

GET /v1/lines/available?channel=imessage

Use this when a person is about to write to you first — on a sign-up page, in an app, on a printed card — and you need to tell them which number to text. If your project has several lines, it answers with the one the platform would give somebody new right now.

It picks the line the same way a first send to a new person does. Of your active lines on the channel whose connection is up and that have a place left, it takes the one with the healthiest connection, then one that has not reached today's pace for new people, then the one with the most places left, then the oldest. Lines that are paused, full or whose connection is down are never picked.

It reserves nothing. Two people shown the same number can both text it, and a send in between can change the answer. Ask again each time you show a number, rather than caching one.

If the person is new to your project, texting that number pins them to that line and takes a place on it. Someone already on another of your lines keeps that as their first line, and their message opens a conversation on this one. Later sends that name no line go out on the number they last wrote to, so on this one; the whole order is in Replying.

curl "https://api.mapier.ai/v1/lines/available?channel=imessage" \
  -H "Authorization: Bearer $MAPIER_API_KEY"

Request

Prop

Type

Response

200 OK
{
  "lineId": "0192a7b0-3e4f-7051-8c6d-7e8f9a0b1c2d",
  "address": "+14155550142",
  "channel": "imessage"
}

Prop

Type

With a test key

A test key answers with the sandbox's line for the channel. The sandbox has one number, so the address is the same every time.

When no line can take somebody new

When every line on that channel is full, paused or down, this answers with the same 503 a first send to somebody new would get — no_line when there is no active line at all, no_line_capacity when every line is full (capacity_exhausted at x-mapier-version: 2026-10-15 or later), and line_unavailable with details.reason: "relay_down" (transport_down at 2026-10-15 or later) when every line's connection is down. Show the person something other than a number until it clears. GET /v1/whoami shows each line's room in contactsAssigned, maxContacts and takesNewContacts.

Errors

StatusCodeCause
401invalid_credentialsNo key, or one that is unknown, revoked or expired
409project_archivedThe project is archived
422validation_failedchannel is not a channel the API knows, or is omitted on a project with lines on more than one channel, which details[].channels lists
429rate_limited120 requests per minute, per key; the Retry-After header says how long to wait
500internal_errorAn unhandled failure, reported; details.requestId names the log line when present
503no_line · no_line_capacity · capacity_exhausted · line_unavailableNo line can take somebody new right now; see When no line can take somebody new
503service_busyThe platform had no database connection free in time and did nothing; wait details.retryAfter seconds and ask again
503upstream_unavailableThe service could not answer

On this page