Skip to main content

organization_secrets

Creates, updates, deletes, gets or lists an organization_secrets resource.

Overview

Nameorganization_secrets
TypeResource
Idgithub.codespaces.organization_secrets

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
namestringThe name of the secret (example: SECRET_NAME)
created_atstring (date-time)The date and time at which the secret was created, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ.
selected_repositories_urlstring (uri)The API URL at which the list of repositories this secret is visible to can be retrieved (example: https://api.github.com/orgs/ORGANIZATION/codespaces/secrets/SECRET_NAME/repositories)
updated_atstring (date-time)The date and time at which the secret was created, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ.
visibilitystringThe type of repositories in the organization that the secret is visible to (all, private, selected)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_org_secretselectorg, secret_nameGets an organization development environment secret without revealing its encrypted value.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
list_org_secretsselectorgper_page, pageLists all Codespaces development environment secrets available at the organization-level without revealing their encrypted
values.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
create_or_update_org_secretinsertorg, secret_name, visibilityCreates or updates an organization development environment secret with an encrypted value. Encrypt your secret using
LibSodium. For more information, see "Encrypting secrets for the REST API."

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
delete_org_secretdeleteorg, secret_nameDeletes an organization development environment secret using the secret name.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
orgstringThe organization name. The name is not case sensitive.
secret_namestringThe name of the secret.
pageintegerThe page number of the results to fetch. For more information, see "Using pagination in the REST API."
per_pageintegerThe number of results per page (max 100). For more information, see "Using pagination in the REST API."

SELECT examples

Gets an organization development environment secret without revealing its encrypted value.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

SELECT
name,
created_at,
selected_repositories_url,
updated_at,
visibility
FROM github.codespaces.organization_secrets
WHERE org = '{{ org }}' -- required
AND secret_name = '{{ secret_name }}' -- required
;

INSERT examples

Creates or updates an organization development environment secret with an encrypted value. Encrypt your secret using
LibSodium. For more information, see "Encrypting secrets for the REST API."

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

INSERT INTO github.codespaces.organization_secrets (
encrypted_value,
key_id,
visibility,
selected_repository_ids,
org,
secret_name
)
SELECT
'{{ encrypted_value }}',
'{{ key_id }}',
'{{ visibility }}' /* required */,
'{{ selected_repository_ids }}',
'{{ org }}',
'{{ secret_name }}'
;

DELETE examples

Deletes an organization development environment secret using the secret name.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

DELETE FROM github.codespaces.organization_secrets
WHERE org = '{{ org }}' --required
AND secret_name = '{{ secret_name }}' --required
;