Documentation Index
Fetch the complete documentation index at: https://docs.alterauth.com/llms.txt
Use this file to discover all available pages before exploring further.
request()
Make a token-injected request to a provider API. The most common SDK call.
Signature
Parameters
| Name | Type | Description |
|---|---|---|
method | HttpMethod | str | HTTP method (required). |
url | str | Full upstream URL (required). |
grant_id | str | None | Explicit grant. Mutually exclusive with provider. |
provider | str | None | Resolves to a grant via user_token_getter. Requires JWT mode. |
account | str | None | Disambiguator when a user has multiple accounts on one provider. |
json | Any | None | JSON-serialized body. |
body | bytes | str | None | Raw body. |
extra_headers | dict[str, str] | None | Additional headers (Auth header is set by the SDK). |
query_params, path_params | dict | None | Templated URL inputs. |
reason | str | None | Human-readable explanation, surfaces in audit logs. |
context | dict[str, str] | None | Per-call audit metadata. |
user_token | str | None | Per-call JWT override. |
Returns
Anhttpx.Response. Adds a retry_info: RetryInfo \| None attribute carrying retry metadata from this call.
Raises
GrantNotFoundError, GrantExpiredError, GrantRevokedError, AmbiguousGrantError, NoDelegatedGrantError, PolicyViolationError, ScopeReauthRequiredError, ProviderAPIError, NetworkError. See Errors.
Example
proxy_request()
Forwards an HTTP exchange through the Alter backend. Use when the call must run server-side (AWS SigV4 with role assumption, approval-gated calls, backend rate limiting).
Signature
Authorization, Cookie, x-api-key, x-amz-security-token) are forbidden — the backend injects credentials at execution time.
Returns
ApprovalResultif the call ran inline. The body is base64-encoded onbody_b64— decode withbody_text()/body_json()/body_bytes().PendingApprovalif policy required human approval. Pass theapproval_idtoawait_approval(). See Approvals.