GitHub: List codespaces for the organization
GitHub codespaces.codespacesListInOrganization: arguments, response, policy and SDK examples.
← Codespaces operations · Get started
Operation github.codespaces_list_in_organization
Provider route: GET /orgs/{org}/codespaces. 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["codespaces"]["codespacesListInOrganization"]>[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.codespaces.codespacesListInOrganization(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.codespaces.codespaces_list_in_organization(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.org | string | Required within parent | |
query | object | Optional | Additional keys: not allowed |
query.per_page | integer | Optional | Default: 30 |
query.page | integer | Optional | Default: 1 |
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 |
|---|---|---|---|
$ | object | Root | |
codespaces | array | Required within parent | |
codespaces[] | Model | Each item | Expand Stop a codespace for an organization user — response body |
total_count | JSON | Required within parent | |
total_count (anyOf 1) | integer | Alternative | |
total_count (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Referenced models: Stop a codespace for an organization user — response body
Schemas
Section titled “Schemas”5 more schemas are linked from the tables above, on the schema pages.
Stop a codespace for an organization user — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A codespace. |
billable_owner | Model | Required within parent | Expand List users — response body — item |
created_at | string | Required within parent | Format: date-time |
devcontainer_path | JSON | Optional | |
devcontainer_path (anyOf 1) | string | Alternative | Path to devcontainer.json from repo root used to create Codespace. |
devcontainer_path (anyOf 2) | null | Alternative | |
display_name | JSON | Optional | |
display_name (anyOf 1) | string | Alternative | Display name for this codespace. |
display_name (anyOf 2) | null | Alternative | |
environment_id | JSON | Required within parent | |
environment_id (anyOf 1) | string | Alternative | UUID identifying this codespace's environment. |
environment_id (anyOf 2) | null | Alternative | |
git_status | Model | Required within parent | Expand Stop a codespace for an organization user — response body — git status |
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]+)?$ |
idle_timeout_minutes | JSON | Required within parent | |
idle_timeout_minutes (anyOf 1) | JSON | Alternative | |
idle_timeout_minutes (anyOf 1) (anyOf 1) | integer | Alternative | The number of minutes of inactivity after which this codespace will be automatically stopped. |
idle_timeout_minutes (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
idle_timeout_minutes (anyOf 2) | null | Alternative | |
idle_timeout_notice | JSON | Optional | |
idle_timeout_notice (anyOf 1) | string | Alternative | Text to show user when codespace idle timeout minutes has been overriden by an organization policy |
idle_timeout_notice (anyOf 2) | null | Alternative | |
last_known_stop_notice | JSON | Optional | |
last_known_stop_notice (anyOf 1) | string | Alternative | The text to display to a user when a codespace has been stopped for a potentially actionable reason. |
last_known_stop_notice (anyOf 2) | null | Alternative | |
last_used_at | string | Required within parent | Last known time this codespace was started. Format: date-time |
location | string | Required within parent | The initally assigned location of a new codespace. Known values: EastUs, SouthEastAsia, WestEurope, WestUs2 |
machine | Model | Required within parent | Expand Stop a codespace for an organization user — response body — machine |
machines_url | string | Required within parent | API URL to access available alternate machine types for this codespace. Format: uri |
name | string | Required within parent | Automatically generated name of this codespace. |
owner | Model | Required within parent | Expand List users — response body — item |
pending_operation | JSON | Optional | |
pending_operation (anyOf 1) | boolean | Alternative | Whether or not a codespace has a pending async operation. This would mean that the codespace is temporarily unavailable. The only thing that you can do with a codespace in this state is delete it. |
pending_operation (anyOf 2) | null | Alternative | |
pending_operation_disabled_reason | JSON | Optional | |
pending_operation_disabled_reason (anyOf 1) | string | Alternative | Text to show user when codespace is disabled by a pending operation |
pending_operation_disabled_reason (anyOf 2) | null | Alternative | |
prebuild | JSON | Required within parent | |
prebuild (anyOf 1) | boolean | Alternative | Whether the codespace was created from a prebuild. |
prebuild (anyOf 2) | null | Alternative | |
publish_url | JSON | Optional | |
publish_url (anyOf 1) | string | Alternative | API URL to publish this codespace to a new repository. Format: uri |
publish_url (anyOf 2) | null | Alternative | |
pulls_url | JSON | Required within parent | |
pulls_url (anyOf 1) | string | Alternative | API URL for the Pull Request associated with this codespace, if any. Format: uri |
pulls_url (anyOf 2) | null | Alternative | |
recent_folders | array | Required within parent | |
recent_folders[] | string | Each item | |
repository | Model | Required within parent | Expand Transfer a repository — response body |
retention_expires_at | JSON | Optional | |
retention_expires_at (anyOf 1) | string | Alternative | When a codespace will be auto-deleted based on the "retention_period_minutes" and "last_used_at" Format: date-time |
retention_expires_at (anyOf 2) | null | Alternative | |
retention_period_minutes | JSON | Optional | |
retention_period_minutes (anyOf 1) | JSON | Alternative | |
retention_period_minutes (anyOf 1) (anyOf 1) | integer | Alternative | Duration in minutes after codespace has gone idle in which it will be deleted. Must be integer minutes between 0 and 43200 (30 days). |
retention_period_minutes (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
retention_period_minutes (anyOf 2) | null | Alternative | |
runtime_constraints | object | Optional | |
runtime_constraints.allowed_port_privacy_settings | JSON | Optional | |
runtime_constraints.allowed_port_privacy_settings (anyOf 1) | array | Alternative | The privacy settings a user can select from when forwarding a port. |
runtime_constraints.allowed_port_privacy_settings (anyOf 1)[] | string | Each item | |
runtime_constraints.allowed_port_privacy_settings (anyOf 2) | null | Alternative | |
start_url | string | Required within parent | API URL to start this codespace. Format: uri |
state | string | Required within parent | State of this codespace. Known values: Unknown, Created, Queued, Provisioning, Available, Awaiting, Unavailable, Deleted, Moved, Shutdown, Archived, Starting, ShuttingDown, Failed, Exporting, Updating, Rebuilding |
stop_url | string | Required within parent | API URL to stop this codespace. Format: uri |
updated_at | string | Required within parent | Format: date-time |
url | string | Required within parent | API URL for this codespace. Format: uri |
web_url | string | Required within parent | URL to access this codespace on the web. Format: uri |
Referenced models: Transfer a repository — response body, Stop a codespace for an organization user — response body — machine, List users — response body — item, Stop a codespace for an organization user — response body — git status
Stop a codespace for an organization user — response body — machine
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | JSON | Root | |
$ (anyOf 1) | Model | Alternative | Expand Stop a codespace for an organization user — response body — machine A description of the machine powering a codespace |
$ (anyOf 2) | null | Alternative |
Referenced models: Stop a codespace for an organization user — response body — machine A description of the machine powering a codespace
List users — response body — item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A GitHub user. |
avatar_url | string | Required within parent | Format: uri |
email | JSON | Optional | |
email (anyOf 1) | string | Alternative | |
email (anyOf 2) | null | Alternative | |
events_url | string | Required within parent | |
followers_url | string | Required within parent | Format: uri |
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 | |
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]+)?$ |
login | string | Required within parent | |
name | JSON | Optional | |
name (anyOf 1) | string | Alternative | |
name (anyOf 2) | null | Alternative | |
node_id | string | Required within parent | |
organizations_url | string | Required within parent | Format: uri |
received_events_url | string | Required within parent | Format: uri |
repos_url | string | Required within parent | Format: uri |
site_admin | boolean | Required within parent | |
starred_at | string | Optional | |
starred_url | string | Required within parent | |
subscriptions_url | string | Required within parent | Format: uri |
type | string | Required within parent | |
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.codespaces_list_in_organization. Catalog operation: codespaces/list-in-organization. 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"}