Renew a terminal sign-in
Exchange the newest refresh token for a new pair
Exchanges the newest refreshToken for a new pair: a new access token for the
next hour, and a new refresh token that replaces the one sent. There is no
bearer: the refresh token is in the body, and the route reads no
x-mapier-version.
Renew before the access token expires. An access token already issued keeps
working until its own expiry, so a call or a stream holding it is not cut off.
Keep only the newest refresh token. One already replaced, sent again, ends the
whole sign-in, unless it comes within 30 seconds of its replacement: then it is
only refused, so two processes renewing at once cost one of them a retry with
the pair the other stored. Renewing never widens the sign-in's scopes, and never
moves refreshTokenExpiresAt, when the sign-in ends.
Every refusal is the same 401, whatever its reason: an unknown, replaced or
expired refresh token, a revoked sign-in, or one whose owner left the
organization.
Example request
curl -X POST https://api.mapier.ai/v1/cli/tokens/renew \
-H "Content-Type: application/json" \
-d '{ "refreshToken": "mp_refresh_example-not-a-real-token" }'Response
{
"accessToken": "mp_pat_example-not-a-real-token-2",
"accessTokenExpiresAt": "2026-09-02T16:10:00.000Z",
"refreshToken": "mp_refresh_example-not-a-real-token-2",
"refreshTokenExpiresAt": "2026-11-01T14:12:00.000Z",
"tokenId": "0192a7f3-6f70-7182-9d93-0f1a2b3c4d5e"
}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 | |
| 401 | invalid_credentials | The API key or personal access token is missing, malformed, unknown, revoked or expired. | 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 |