Exchange a CLI authorization for a session credential
const url = 'https://api.aetherpush.com/v1/auth/cli/token';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"grantType":"authorization_code","code":"example","codeVerifier":"example","redirectUri":"example","deviceCode":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.aetherpush.com/v1/auth/cli/token \ --header 'Content-Type: application/json' \ --data '{ "grantType": "authorization_code", "code": "example", "codeVerifier": "example", "redirectUri": "example", "deviceCode": "example" }'The only endpoint that returns the CLI’s bearer token. Both grants are single use: a replay, a mismatched verifier, or a mismatched redirect URI terminates the request rather than merely failing.
For device_code, the pending states authorization_pending and
slow_down are returned with HTTP 400 per RFC 8628 and are expected
during normal polling. The RFC 8628 error codes appear on 400 only;
429 and 500 carry the standard { error, requestId } envelope with a
human-readable message, so branch on the status code first.
Either grant answers 400 with account_pending_deletion when the
account has a deletion scheduled; the CLI can sign in again once the
owner cancels the deletion from the dashboard.
Request Bodyrequired
Section titled “Request Bodyrequired”Either an authorization-code exchange (loopback flow) or a device-code poll. The grant type selects which other fields are required.
object
Authorization code from the loopback redirect. Required for authorization_code.
The original PKCE verifier. Required for authorization_code.
Must byte-match the URI registered when the request was created.
Required for device_code.
Responses
Section titled “Responses”Credential issued.
object
The session bearer. Returned only here, only once, and never to the browser. Non-prefixed, so it resolves through the access-key path.
Identifies this device for DELETE /v1/cli/devices/{credentialId}.
object
Example
{ "expires": 1792049845916, "account": { "email": "user@example.com" }}Pending, throttled, denied, expired, or invalid.
RFC 8628 error codes. authorization_pending and slow_down are normal polling states, not failures.
object
Also returned in the X-Request-Id header.
Example
{ "error": "authorization_pending"}Too many token requests from this address.
Standard error envelope. code is the stable machine identifier for
client branching and i18n. The wording of error is a human-readable
fallback and is not part of the contract. Specialized responses keep
narrower code enums where clients already branch on them.
object
Human-readable error message.
Stable machine code. Prefer this over matching on error. The
values this API can answer with are listed in the ApiErrorCode
schema of the raw document at
https://api.aetherpush.com/openapi.yaml. The field stays an
open string here so that a release adding a value does not
invalidate this response.
Unique identifier for the request, also exposed as the X-Request-Id response header.
Example
{ "error": "The requested resource was not found.", "code": "not_found", "requestId": "req_abc123"}Internal server error.
Standard error envelope. code is the stable machine identifier for
client branching and i18n. The wording of error is a human-readable
fallback and is not part of the contract. Specialized responses keep
narrower code enums where clients already branch on them.
object
Human-readable error message.
Stable machine code. Prefer this over matching on error. The
values this API can answer with are listed in the ApiErrorCode
schema of the raw document at
https://api.aetherpush.com/openapi.yaml. The field stays an
open string here so that a release adding a value does not
invalidate this response.
Unique identifier for the request, also exposed as the X-Request-Id response header.
Example
{ "error": "The requested resource was not found.", "code": "not_found", "requestId": "req_abc123"}