POST
/organization/projects/{project_id}/service_accountsCreate a project service account
Creates a new service account in a project and, by default, returns an unredacted API key for that account. Supply name and optionally control default account setup and key expiration with create_service_account_only and expires_in_seconds.
- RetriesRetries up to 2×, 500ms backoff, 30s timeout.
project_idstringrequired
The unique identifier of the project in which to create the service account.
Project service account creation details, including its name and optional default-role and API-key expiration settings.
namestringrequired
The name of the service account being created.
create_service_account_onlybooleanoptional
Whether to create the service account without default roles or an API key; provide a boolean or `null`.
expires_in_secondsintegeroptional
Number of seconds until the initial API key expires. If omitted or null, the key does not expire unless the effective organization or project policy requires an expiration. When a policy sets a maximum lifetime, this value must be provided and must not exceed that limit. A non-null value cannot be used when `create_service_account_only` is true.
200Returns the created service account with its object type, unique identifier, name, role, Unix creation timestamp, and an API key when one was created.
objectstringrequired
idstringrequired
namestringrequired
rolestringrequired
Service accounts created with default project membership have role `member`. Accounts created with `create_service_account_only` have role `none`.
created_atintegerrequired
api_keyobjectrequired
400Returned when the project is archived.
errorobjectrequired
Error handling
A 400 is returned when the project is archived. name is required, create_service_account_only must be a boolean or null, and expires_in_seconds must be between 1 and 31536000 when provided; organization or project expiration policies can impose a lower maximum.