GitHub: Get a user
GitHub users.usersGetByUsername: arguments, response, policy and SDK examples.
← Users operations · Get started
Operation github.users_get_by_username
Provider route: GET /users/{username}. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/github with npm, or alter-sdk-github with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { GitHubIntegration } from "@alter-ai/github";
async function execute(input: Parameters<GitHubIntegration["users"]["usersGetByUsername"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new GitHubIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.users.usersGetByUsername(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_github import GitHubIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = GitHubIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.users.users_get_by_username(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
path | object | Required within parent | Additional keys: not allowed |
path.username | string | Required within parent |
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | JSON | Root | discriminator: {“mapping”: {“private”: ”#/components/schemas/private-user”, “public”: ”#/components/schemas/public-user”}, “propertyName”: “user_view_type”} |
$ (anyOf 1) | Model | Alternative | Expand Update the authenticated user — response body |
$ (anyOf 2) | Model | Alternative | Expand Get a user — response body — Public User |
Referenced models: Update the authenticated user — response body, Get a user — response body — Public User
Schemas
Section titled “Schemas”1 more schema is linked from the tables above, on the schema pages.
Update the authenticated user — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Private User |
avatar_url | string | Required within parent | Format: uri |
bio | JSON | Required within parent | |
bio (anyOf 1) | string | Alternative | |
bio (anyOf 2) | null | Alternative | |
blog | JSON | Required within parent | |
blog (anyOf 1) | string | Alternative | |
blog (anyOf 2) | null | Alternative | |
business_plus | boolean | Optional | |
collaborators | JSON | Required within parent | |
collaborators (anyOf 1) | integer | Alternative | |
collaborators (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
company | JSON | Required within parent | |
company (anyOf 1) | string | Alternative | |
company (anyOf 2) | null | Alternative | |
created_at | string | Required within parent | Format: date-time |
disk_usage | JSON | Required within parent | |
disk_usage (anyOf 1) | integer | Alternative | |
disk_usage (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
email | JSON | Required within parent | |
email (anyOf 1) | string | Alternative | Format: email |
email (anyOf 2) | null | Alternative | |
events_url | string | Required within parent | |
followers | JSON | Required within parent | |
followers (anyOf 1) | integer | Alternative | |
followers (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
followers_url | string | Required within parent | Format: uri |
following | JSON | Required within parent | |
following (anyOf 1) | integer | Alternative | |
following (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
following_url | string | Required within parent | |
gists_url | string | Required within parent | |
gravatar_id | JSON | Required within parent | |
gravatar_id (anyOf 1) | string | Alternative | |
gravatar_id (anyOf 2) | null | Alternative | |
hireable | JSON | Required within parent | |
hireable (anyOf 1) | boolean | Alternative | |
hireable (anyOf 2) | null | Alternative | |
html_url | string | Required within parent | Format: uri |
id | JSON | Required within parent | |
id (anyOf 1) | integer | Alternative | Format: int64 |
id (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
ldap_dn | string | Optional | |
location | JSON | Required within parent | |
location (anyOf 1) | string | Alternative | |
location (anyOf 2) | null | Alternative | |
login | string | Required within parent | |
name | JSON | Required within parent | |
name (anyOf 1) | string | Alternative | |
name (anyOf 2) | null | Alternative | |
node_id | string | Required within parent | |
notification_email | JSON | Optional | |
notification_email (anyOf 1) | string | Alternative | Format: email |
notification_email (anyOf 2) | null | Alternative | |
organizations_url | string | Required within parent | Format: uri |
owned_private_repos | JSON | Required within parent | |
owned_private_repos (anyOf 1) | integer | Alternative | |
owned_private_repos (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
plan | object | Optional | |
plan.collaborators | JSON | Required within parent | |
plan.collaborators (anyOf 1) | integer | Alternative | |
plan.collaborators (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
plan.name | string | Required within parent | |
plan.private_repos | JSON | Required within parent | |
plan.private_repos (anyOf 1) | integer | Alternative | |
plan.private_repos (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
plan.space | JSON | Required within parent | |
plan.space (anyOf 1) | integer | Alternative | |
plan.space (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
private_gists | JSON | Required within parent | |
private_gists (anyOf 1) | integer | Alternative | |
private_gists (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
public_gists | JSON | Required within parent | |
public_gists (anyOf 1) | integer | Alternative | |
public_gists (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
public_repos | JSON | Required within parent | |
public_repos (anyOf 1) | integer | Alternative | |
public_repos (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
received_events_url | string | Required within parent | Format: uri |
repos_url | string | Required within parent | Format: uri |
site_admin | boolean | Required within parent | |
starred_url | string | Required within parent | |
subscriptions_url | string | Required within parent | Format: uri |
total_private_repos | JSON | Required within parent | |
total_private_repos (anyOf 1) | integer | Alternative | |
total_private_repos (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
twitter_username | JSON | Optional | |
twitter_username (anyOf 1) | string | Alternative | |
twitter_username (anyOf 2) | null | Alternative | |
two_factor_authentication | boolean | Required within parent | |
type | string | Required within parent | |
updated_at | string | Required within parent | Format: date-time |
url | string | Required within parent | Format: uri |
user_view_type | string | Optional |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: github.users_get_by_username. Catalog operation: users/get-by-username. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.
Pinned headers: {"X-GitHub-Api-Version": "2026-03-10", "User-Agent": "Alter", "Accept": "application/vnd.github+json"}