Skip to content

GitHub: Create a Git Hub-hosted runner for an organization

GitHub actions.actionsCreateHostedRunnerForOrg: arguments, response, policy and SDK examples.

← Actions operations · Get started

Operation github.actions_create_hosted_runner_for_org

Provider route: POST /orgs/{org}/actions/hosted-runners. Alter supplies the connection’s credentials and routing.

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["actions"]["actionsCreateHostedRunnerForOrg"]>[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.actions.actionsCreateHostedRunnerForOrg(input);
const result = await call.wait();
return result.bodyJson();
} finally {
await app.close();
}
}
import os
from alter_sdk import App
from 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.actions.actions_create_hosted_runner_for_org(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
pathobjectRequired within parentAdditional keys: not allowed
path.orgstringRequired within parent
bodyobjectRequired within parent
body.enable_static_ipbooleanOptionalWhether this runner should be created with a static public IP. Note limit on account. To list limits on account, use `GET actions/hosted-runners/limits`
body.imageobjectRequired within parentThe image of runner. To list all available images, use `GET /actions/hosted-runners/images/github-owned` or `GET /actions/hosted-runners/images/partner`.
body.image.idstringOptionalThe unique identifier of the runner image.
body.image.sourcestringOptionalThe source of the runner image.
One of: github, partner, custom
body.image.versionJSONOptional
body.image.version (anyOf 1)stringAlternativeThe version of the runner image to deploy. This is relevant only for runners using custom images.
body.image.version (anyOf 2)nullAlternative
body.image_genbooleanOptionalWhether this runner should be used to generate custom images.
Default: false
body.maximum_runnersintegerOptionalThe maximum amount of runners to scale up to. Runners will not auto-scale above this number. Use this setting to limit your cost.
body.namestringRequired within parentName of the runner. Must be between 1 and 64 characters and may only contain upper and lowercase letters a-z, numbers 0-9, ’.’, ’-’, and ’_’.
body.runner_group_idintegerRequired within parentThe existing runner group to add this runner to.
body.sizestringRequired within parentThe machine size of the runner. To list available sizes, use `GET actions/hosted-runners/machine-sizes`

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$ModelRootExpand Get a Git Hub-hosted runner for an organization — response body

Referenced models: Get a Git Hub-hosted runner for an organization — response body

Get a Git Hub-hosted runner for an organization — response body
FieldTypePresenceDescription and constraints
$objectRootA Github-hosted hosted runner.
idJSONRequired within parent
id (anyOf 1)integerAlternativeThe unique identifier of the hosted runner.
id (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
image_detailsModelRequired within parentExpand Get a Git Hub-hosted runner for an organization — response body — image details
image_genbooleanOptionalWhether custom image generation is enabled for the hosted runners.
last_active_onJSONOptional
last_active_on (anyOf 1)stringAlternativeThe time at which the runner was last used, in ISO 8601 format.
Format: date-time
last_active_on (anyOf 2)nullAlternative
machine_size_detailsModelRequired within parentExpand Get a Git Hub-hosted runner for an organization — response body — machine size details
maximum_runnersJSONOptional
maximum_runners (anyOf 1)integerAlternativeThe maximum amount of hosted runners. Runners will not scale automatically above this number. Use this setting to limit your cost.
Default: 10
maximum_runners (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
namestringRequired within parentThe name of the hosted runner.
platformstringRequired within parentThe operating system of the image.
public_ip_enabledbooleanRequired within parentWhether public IP is enabled for the hosted runners.
public_ipsarrayOptionalThe public IP ranges when public IP is enabled for the hosted runners.
public_ips[]ModelEach itemExpand Get a Git Hub-hosted runner for an organization — response body — public ips item
runner_group_idJSONOptional
runner_group_id (anyOf 1)integerAlternativeThe unique identifier of the group that the hosted runner belongs to.
runner_group_id (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
statusstringRequired within parentThe status of the runner.
Known values: Ready, Provisioning, Shutdown, Deleting, Stuck

Referenced models: Get a Git Hub-hosted runner for an organization — response body — machine size details, Get a Git Hub-hosted runner for an organization — response body — image details, Get a Git Hub-hosted runner for an organization — response body — public ips item

Get a Git Hub-hosted runner for an organization — response body — machine size details
FieldTypePresenceDescription and constraints
$objectRootProvides details of a particular machine spec.
cpu_coresJSONRequired within parent
cpu_cores (anyOf 1)integerAlternativeThe number of cores.
cpu_cores (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
idstringRequired within parentThe ID used for the `size` parameter when creating a new runner.
memory_gbJSONRequired within parent
memory_gb (anyOf 1)integerAlternativeThe available RAM for the machine spec.
memory_gb (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
storage_gbJSONRequired within parent
storage_gb (anyOf 1)integerAlternativeThe available SSD storage for the machine spec.
storage_gb (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
Get a Git Hub-hosted runner for an organization — response body — image details
FieldTypePresenceDescription and constraints
$JSONRoot
$ (anyOf 1)objectAlternativeProvides details of a hosted runner image
$ (anyOf 1).display_namestringRequired within parentDisplay name for this image.
$ (anyOf 1).idstringRequired within parentThe ID of the image. Use this ID for the `image` parameter when creating a new larger runner.
$ (anyOf 1).size_gbJSONRequired within parent
$ (anyOf 1).size_gb (anyOf 1)integerAlternativeImage size in GB.
$ (anyOf 1).size_gb (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
$ (anyOf 1).sourcestringRequired within parentThe image provider.
Known values: github, partner, custom
$ (anyOf 1).versionstringOptionalThe image version of the hosted runner pool.
$ (anyOf 2)nullAlternative
Get a Git Hub-hosted runner for an organization — response body — public ips item
FieldTypePresenceDescription and constraints
$objectRootProvides details of Public IP for a GitHub-hosted larger runners
enabledbooleanOptionalWhether public IP is enabled.
lengthJSONOptional
length (anyOf 1)integerAlternativeThe length of the IP prefix.
length (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
prefixstringOptionalThe prefix for the public IP.

SDK function policy ID: github.actions_create_hosted_runner_for_org. Catalog operation: actions/create-hosted-runner-for-org. 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"}

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.