Start a setup

Start adding a line, with a link for the person who holds the account

POST/v1/line-setups

Starts adding a line on one channel, by one method. key names both, as <channel>/<method>, such as imessage/operator; each channel's page in What works where lists its methods and their keys under Connect, and GET /v1/capabilities lists them under each channel's setupMethods. The body takes only what is not secret. The key you call with must carry the lines:write scope.

When the method needs secrets — a token, an app secret — the answer carries handoffUrl, a page where the person who holds the account pastes them. Give them the link; do not ask them for the token. A body naming a secret's field (appSecret, botToken, configToken, pageToken, signingSecret, token) is a 422 at that field with expected: "handoff". Nothing is bought and no account is created until the person finishes on that page.

Example request

curl -X POST https://api.mapier.ai/v1/line-setups \
  -H "Authorization: Bearer $MAPIER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: setup-support-line" \
  -H "x-mapier-version: 2026-12-01" \
  -d '{"key": "imessage/operator"}'

Response

201 Created
{
  "id": "0192a7d0-7a8b-7c9d-8eaf-b0c1d2e3f405",
  "channel": "imessage",
  "method": "operator",
  "purpose": "connect",
  "state": "verifying",
  "checks": {
    "credentials": {
      "state": "pending",
      "detail": "Mapier is attaching a number.",
      "reason": null,
      "retryable": true,
      "checkedAt": null,
      "docUrl": "https://docs.mapier.ai/convo/guides/connect/imessage#request-a-line",
      "fixUrl": null,
      "sub": null
    },
    "webhook": {
      "state": "pending",
      "detail": "Waiting for the line to connect.",
      "reason": null,
      "retryable": true,
      "checkedAt": null,
      "docUrl": "https://docs.mapier.ai/convo/guides/connect/imessage#request-a-line",
      "fixUrl": null,
      "sub": null
    },
    "platform_approval": {
      "state": "n/a",
      "detail": "Not needed.",
      "reason": null,
      "retryable": false,
      "checkedAt": null,
      "docUrl": null,
      "fixUrl": null,
      "sub": null
    },
    "policy_ack": {
      "state": "n/a",
      "detail": "Not needed.",
      "reason": null,
      "retryable": false,
      "checkedAt": null,
      "docUrl": null,
      "fixUrl": null,
      "sub": null
    },
    "inbound_proof": {
      "state": "n/a",
      "detail": "Not needed.",
      "reason": null,
      "retryable": false,
      "checkedAt": null,
      "docUrl": null,
      "fixUrl": null,
      "sub": null
    },
    "outbound_proof": {
      "state": "n/a",
      "detail": "Not needed.",
      "reason": null,
      "retryable": false,
      "checkedAt": null,
      "docUrl": null,
      "fixUrl": null,
      "sub": null
    }
  },
  "nextStep": {
    "kind": "wait",
    "reason": "operator_attaching",
    "etaSeconds": null
  },
  "handoffUrl": null,
  "handoffExpiresAt": null,
  "identity": null,
  "lineId": null,
  "number": null,
  "failureReason": null,
  "createdAt": "2026-10-18T17:02:11.000Z",
  "updatedAt": "2026-10-18T17:02:11.000Z",
  "expiresAt": null
}

What happens next

Follow the setup with GET /v1/line-setups/{setupId} or the line.setup_changed webhook. Its checks say what has passed, and a check the method does not need is n/a. Each failed check's docUrl opens the step on the channel's Connect page that fixes it. A line it binds takes new contacts once the setup is verified.

stateMeans
awaiting_inputA person must act: nextStep or handoffUrl says what.
awaiting_humanWaiting on the person who holds the account.
verifyingMapier is checking, or a person at Mapier is setting up an iMessage number; nothing to do.
readyEvery check passed and the line is bound. It becomes verified on its own, within a minute.
verifiedThe line is added and takes new contacts.
failedIt stopped; failureReason says why. Start a new setup.
cancelledYou cancelled it.

handoffUrl appears only in the response that created the setup: a retry with the same Idempotency-Key returns the same setup with handoffUrl: null. Without an Idempotency-Key, every request starts a new setup.

The next step

nextStep is the one thing a person does next, or null when nobody has anything to do or handoffUrl covers it. Show it to the person who holds the account as it is.

nextStep.kindThe person
oauth_authorizeOpens url and approves the app, before expiresAt.
deep_linkOpens url in the channel's own app, such as a chat with its setup bot, before expiresAt.
inviteOpens url to add the bot to a server they manage.
paste_backCopies callbackUrl and verifyToken into the channel's webhook settings, in the fields fields names. verifyToken appears only in the response that created the step, and is null after it.
message_usSends a message to address from their own account, as hint says.
waitNothing. reason is number_ordering, otp_pending or operator_attaching; etaSeconds is an estimate, or null.

The body each method takes

Every method takes key, an optional displayName and, to reconnect a line you have, its lineId. The rest is per method: each channel's Connect page gives its methods' bodies under From the API, such as Connect iMessage, with what each field means, and the OpenAPI document's createLineSetup request lists them all. A field a method requires and the body leaves out is 422 validation_failed at that field. Some fields are the account owner's own answers, such as a policy they accept: ask the account owner for those, and never fill them in yourself.

Errors

| Status | Code | Cause | | ------ | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | | 400 | bad_request | The body is not JSON; or, with a personal access token, no x-mapier-project header | | 401 | invalid_credentials | No key, or one that is unknown, revoked or expired | | 403 | channel_not_entitled | This channel is not turned on for your project yet; details.reason says why | | | 403 | forbidden | A personal access token not made for this environment, or whose owner's role no longer allows this | | 403 | insufficient_scope | The key does not carry the lines:write scope | | 404 | not_found | A lineId to reconnect that this key cannot see | | 409 | conflict | The channel's service refused the account for its own reason (details.reason); wait details.retryAfter seconds when it gives one. For a dedicated iMessage line, also while a payment has failed, until it is paid | | 409 | limit_reached | A dedicated iMessage line past the lines your organization pays for (details.limit is purchasedLines); add lines on the Billing page | | 409 | project_archived | The project is archived | | 413 | payload_too_large | The body is over 65,536 bytes | | 422 | validation_failed | A body this method does not take — a secret's field (expected: "handoff"), a missing field — or an unknown x-mapier-version | | 429 | rate_limited | Over this route's budget; the Retry-After header says how long to wait | | 500 | internal_error | Mapier failed on its side; give requestId to support | | 503 | line_unavailable | Mapier cannot reach the channel's service right now; details.reason says why | | 503 | service_busy | Mapier is busy and did nothing; wait details.retryAfter seconds and call again | | 503 | upstream_unavailable | The channel's service did not answer; retry with backoff |

Guide