Start a sign-in from a terminal

Get a code a person approves in the console; no credential needed

POST/v1/cli/logins

Starts a sign-in for a command-line tool. It takes no credential and reads no x-mapier-version. Show the person userCode and verificationUrl, or open verificationUrlComplete, which has the code filled in. They sign in to the console, choose an organization and approve. Meanwhile, poll POST /v1/cli/logins/token with deviceCode every interval seconds.

The login works once, for 10 minutes. Keep deviceCode inside the tool and never show it: whoever holds it receives the token once the person approves.

Body

The body is optional. deviceName is what to call this machine: the token is named CLI on <deviceName>, or CLI without one. It keeps letters, digits, spaces and . - _ ( ) @ ', at most 64 characters, and drops anything else. The person approving sees it marked as sent by this request, not checked.

Example request

curl -X POST https://api.mapier.ai/v1/cli/logins \
  -H "Content-Type: application/json" \
  -d '{ "deviceName": "build-box" }'

Response

201 Created
{
  "deviceCode": "mp_cli_example-not-a-real-device-code",
  "userCode": "KQ7M-2PXD",
  "verificationUrl": "https://convo.mapier.ai/app/cli",
  "verificationUrlComplete": "https://convo.mapier.ai/app/cli?code=KQ7M-2PXD",
  "expiresAt": "2026-09-02T14:20:00.000Z",
  "expiresIn": 600,
  "interval": 5
}

Errors

StatusCodeReasonWhenChannels
400bad_requestThe body is not valid JSON, the channel rejected the request as malformed, or a header the call needs is missing.All
413payload_too_largeThe body is over 65,536 bytes.All
422validation_failedA field is wrong, and details names each one at its path.All
429rate_limitedToo many requests for this route's budget.All
500internal_errorMapier failed on its side, and has been alerted.All
503service_busyMapier is busy and did nothing with this request. details.retryAfter says how many seconds to wait.All
503upstream_unavailableThe channel did not take the command, or gave no answer Mapier could use.All