Poll a sign-in from a terminal
Where a sign-in stands, and its tokens once it is approved
Where a sign-in started from a terminal
stands, by its deviceCode. It takes no credential and reads no
x-mapier-version. An unknown device code is a 404.
status | Means |
|---|---|
pending | Nobody has approved or denied it yet. Poll after interval |
slow_down | You polled too soon; interval has grown. Wait it out |
denied | The person denied it. Start again |
expired | Ten minutes passed before the tokens were handed over |
used | Its tokens were already handed over. Start again |
approved | Approved: this answer carries the tokens |
approved is answered once, to the first poll after the approval, and carries
two tokens. accessToken is a
personal access token
to send as the bearer, which lasts an hour. refreshToken is never a bearer:
exchange it at POST /v1/cli/tokens/renew for a
new pair. Store both now; no request returns either again.
The sign-in carries every scope the person's role allowed when they approved,
every project, live, and ends 60 days later however often it renews. A person
who already holds ten active tokens in that organization gets a
409 limit_reached: once they revoke one, the next poll succeeds while the
login lasts.
Example request
curl -X POST https://api.mapier.ai/v1/cli/logins/token \
-H "Content-Type: application/json" \
-d '{ "deviceCode": "mp_cli_example-not-a-real-device-code" }'Response
{ "status": "pending", "interval": 5 }{
"status": "approved",
"accessToken": "mp_pat_example-not-a-real-token",
"accessTokenExpiresAt": "2026-09-02T15:12:00.000Z",
"refreshToken": "mp_refresh_example-not-a-real-token",
"refreshTokenExpiresAt": "2026-11-01T14:12:00.000Z",
"tokenId": "0192a7f3-6f70-7182-9d93-0f1a2b3c4d5e",
"organization": {
"id": "0192a7a0-0b1c-7d2e-8f3a-4b5c6d7e8f90",
"slug": "acme",
"name": "Acme"
},
"role": "developer",
"scopes": ["projects:read", "projects:write", "messages:read", "messages:send"]
}role is the role its owner holds in the organization now; the token never
does more. tokenId is the sign-in as the console lists it, the same across
renewals.
Errors
| Status | Code | Reason | When | Channels |
|---|---|---|---|---|
| 400 | bad_request | The body is not valid JSON, the channel rejected the request as malformed, or a header the call needs is missing. | All | |
| 404 | not_found | Nothing with that id exists in this project. | All | |
| 409 | limit_reached | A limit is reached: a test line's daily cap, or the dedicated lines your organization pays for. | All | |
| 413 | payload_too_large | The body is over 65,536 bytes. | All | |
| 422 | validation_failed | A field is wrong, and details names each one at its path. | All | |
| 429 | rate_limited | Too many requests for this route's budget. | All | |
| 500 | internal_error | Mapier failed on its side, and has been alerted. | All | |
| 503 | upstream_unavailable | The channel did not take the command, or gave no answer Mapier could use. | All |