Get the next line
Which of your lines someone new would get right now
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 Mapier would give somebody new right now.
It picks the line the same way a first send to a new person does. It considers only your active lines on the channel whose connection is up and that still have room for new people. Among those, it prefers, in order:
- the line with the healthiest connection;
- a line that has not reached today's pace for new people;
- the line with the most room left before its limit;
- the oldest line.
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 the line counts them. If they are already on another of your lines, they stay pinned there, and this line counts them too. Later sends that name no line go out on the line 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" \
-H "x-mapier-version: 2026-12-01"Request
Prop
Type
Response
{
"lineId": "0192a7b0-3e4f-7051-8c6d-7e8f9a0b1c2d",
"address": "+14155550142",
"channel": "imessage"
}Prop
Type
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_linewhen there is no active line at all;capacity_exhaustedwhen every line is full;line_unavailablewithdetails.reason: "transport_down"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
| Status | Code | Cause |
|---|---|---|
400 | bad_request | With a personal access token, no x-mapier-project header |
401 | invalid_credentials | No key, or one that is unknown, revoked or expired |
403 | forbidden | A personal access token not made for this environment, or whose owner's role no longer allows this |
403 | insufficient_scope | A personal access token without the lines:read scope |
404 | not_found | With a personal access token, an x-mapier-project it cannot reach |
409 | project_archived | The project is archived |
422 | validation_failed | channel is not a channel the API knows, or is omitted on a project with lines on more than one channel, which details[].channels lists |
429 | rate_limited | 120 requests per minute, per key; the Retry-After header says how long to wait |
500 | internal_error | Mapier failed on its side; give requestId to support |
503 | no_line · capacity_exhausted · line_unavailable | No line can take somebody new right now; see When no line can take somebody new |
503 | service_busy | Mapier is busy and did nothing; wait details.retryAfter seconds and call again |
503 | upstream_unavailable | Mapier could not answer right now; retry with backoff |