Skip to main content

Service Account API Reference

Customer-hosted cloud features

note

Some features are only available on customer-hosted clouds. Reach out to support@anyscale.com for info.

Service Account CLI

anyscale service-account create

Usage

anyscale service-account create [OPTIONS]

Create a service account.

Options

  • --name/-n: Name for the service account.

anyscale service-account create-api-key

Usage

anyscale service-account create-api-key [OPTIONS]

Create a new API key for a service account.

Options

  • --email: Email of the service account to create the new key for.
  • --name: Name of the service account to create the new key for.

anyscale service-account list

Usage

anyscale service-account list [OPTIONS]

List service accounts.

Options

  • --max-items: Max items to show in list.

anyscale service-account delete

Usage

anyscale service-account delete [OPTIONS]

Delete a service account.

Options

  • --email: Email of the service account to delete.
  • --name: Name of the service account to delete.

anyscale service-account rotate-api-keys

Usage

anyscale service-account rotate-api-keys [OPTIONS]

Rotate all api keys of a service account.

Options

  • --email: Rotate API keys for the service account with this email.
  • --name: Rotate API keys for the service account with this name.

Service Account SDK

anyscale.service_account.create

Create a service account and return the API key.

Arguments

  • name (str): Name for the service account.

Returns: str

Examples

import anyscale

api_key = anyscale.service_account.create(
name="my-service-account",
)

anyscale.service_account.create_api_key

Create an API key for the service account and return the API key.

Arguments

  • email (str | None) = None: Email of the service account to create the new key for.
  • name (str | None) = None: Name of the service account to create the new key for.

Returns: str

Examples

import anyscale

api_key = anyscale.service_account.create_api_key(
name="my-service-account",
)

anyscale.service_account.list

List service accounts.

Arguments

  • max_items (int) = 20: Maximum number of items to return.

Returns: List[ServiceAccount]

Examples

import anyscale

anyscale.service_account.list(
max_items=20,
)

anyscale.service_account.delete

Delete a service account.

Arguments

  • email (str | None) = None: Email of the service account to delete.
  • name (str | None) = None: Name of the service account to delete.

Examples

import anyscale

anyscale.service_account.delete(
name="my-service-account",
)

anyscale.service_account.rotate_api_keys

Rotate all api keys of a service account and return the new API key.

Arguments

  • email (str | None) = None: Rotate API keys for the service account with this email.
  • name (str | None) = None: Rotate API keys for the service account with this name.

Returns: str

Examples

import anyscale

anyscale.service_account.rotate_api_keys(
name="my-service-account",
)

Service Account Models

ServiceAccount

Service account

Fields

  • name (str): Name of the service account.
  • created_at (datetime): The timestamp when this service account was created.
  • permission_level (OrganizationPermissionLevel): The organization permission level of the service account.
  • email (str): Email of the service account.

Python Methods

def to_dict(self) -> Dict[str, Any]
"""Return a dictionary representation of the model."""

Examples

import anyscale
from anyscale.service_account.models import ServiceAccount

service_accounts: List[ServiceAccount] = anyscale.service_account.list()

OrganizationPermissionLevel

An enumeration.

Values

  • OWNER: Owner permission level for the organization
  • COLLABORATOR: Collaborator permission level for the organization