Spaces#

class SpacesClient(*, sdk_config: SDKConfiguration, generated_client: ApiClient)[source]#

Bases: object

Client for managing Arize spaces.

This class is primarily intended for internal use within the SDK. Users are highly encouraged to access resource-specific functionality via arize.ArizeClient.

The spaces client is a thin wrapper around the generated REST API client, using the shared generated API client owned by arize.config.SDKConfiguration.

Parameters:
  • sdk_config (SDKConfiguration) – Resolved SDK configuration.

  • generated_client (ApiClient) – Shared generated API client instance.

list(*, organization_id: str | None = None, name: str | None = None, limit: int = DEFAULT_LIST_LIMIT, cursor: str | None = None) ListSpacesResponse[source]#

List spaces the user has access to.

This endpoint supports cursor-based pagination. When provided, organization_id filters results to a particular organization. name filters results to spaces whose name contains the given substring (case-insensitive).

Parameters:
  • organization_id (str | None) – Optional organization ID to filter results.

  • name (str | None) – Optional case-insensitive substring filter on space name.

  • limit (int) – Maximum number of spaces to return. The server may enforce an upper bound.

  • cursor (str | None) – Opaque pagination cursor from a previous response.

Returns:

A paginated space list response from the Arize REST API.

Raises:

ApiException – If the API request fails.

Return type:

ListSpacesResponse

get(*, space: str) Space[source]#

Get a space by ID or name.

Parameters:

space (str) – Space ID or name to retrieve.

Returns:

The space object.

Raises:

ApiException – If the API request fails (for example, space not found).

Return type:

Space

create(*, name: str, organization_id: str, description: str | None = None, is_private: bool | None = None) Space[source]#

Create a new space.

Space names must be unique within the target organization.

Parameters:
  • name (str) – Space name (must be unique within organization_id).

  • organization_id (str) – Organization ID to create the space in.

  • description (str | None) – Optional description of the space’s purpose.

  • is_private (bool | None) – Whether to create the space as private. Private spaces are only visible to their members and account/org/space admins. Defaults to False (public) if omitted.

Returns:

The created space object.

Raises:

ApiException – If the API request fails.

Return type:

Space

delete(*, space: str) None[source]#

Delete a space by ID or name.

This operation is irreversible. It deletes the space and all resources that belong to it (models, monitors, dashboards, datasets, custom metrics, etc).

Parameters:

space (str) – Space ID or name to delete.

Returns:

This method returns None on success (204 No Content response).

Raises:

ApiException – If the API request fails (for example, space not found or insufficient permissions).

Return type:

None

update(*, space: str, name: str | None = None, description: str | None = None, is_private: bool | None = None) Space[source]#

Update a space by ID or name.

Parameters:
  • space (str) – Space ID or name to update.

  • name (str | None) – Updated name for the space.

  • description (str | None) – Updated description for the space.

  • is_private (bool | None) – Updated visibility for the space. Set to True to make the space private (visible only to members and admins), or False to make it public. When None, the existing visibility is preserved.

Returns:

The updated space object.

Raises:
  • ValueError – If none of name, description, or is_private is provided.

  • ApiException – If the API request fails (for example, space not found or insufficient permissions).

Return type:

Space

add_user(*, space: str, user_id: str, role: PredefinedSpaceRole | CustomSpaceRole) SpaceMembership[source]#

Add a user to a space (or update their role if already a member).

If the user is already a member of the space, their role is updated to the specified value (upsert). The user must already be a member of the space’s parent organization — auto-enrollment is not performed.

Role constraints

  • Users with an annotator account role can only be assigned the annotator predefined space role.

  • Users with a non-annotator account role cannot be assigned the annotator predefined space role.

Requires space admin role for predefined roles, or ROLE_BINDING_CREATE permission for custom roles.

Parameters:
  • space (str) – Space ID or name.

  • user_id (str) – Global ID of the user to add.

  • role (PredefinedSpaceRole | CustomSpaceRole) – Role assignment for the user. Use PredefinedSpaceRole(name="<role>") for predefined roles (ADMIN, MEMBER, READ_ONLY, ANNOTATOR), or CustomRoleAssignment(type="CUSTOM", id="<role_id>") for a custom RBAC role.

Returns:

The created or updated space membership record.

Raises:

ApiException – If the API request fails (for example, space or user not found, user not in the parent organization, role constraint violation, or insufficient permissions).

Return type:

SpaceMembership

remove_user(*, space: str, user_id: str) None[source]#

Remove a user from a space.

Removes both the legacy space-membership row and any RBAC role bindings for the user on this space.

Requires space admin role (legacy auth) or ROLE_BINDING_DELETE permission (RBAC).

Parameters:
  • space (str) – Space ID or name.

  • user_id (str) – Global ID of the user to remove.

Returns:

This method returns None on success (204 No Content response).

Raises:

ApiException – If the API request fails (for example, space or user not found, or user is not a member of the space).

Return type:

None

Response Types#

Public type re-exports and SDK-facing role types for the spaces subdomain.

class AddSpaceUserRequest(*, user_id: Annotated[str, Strict(strict=True)], role: SpaceRoleAssignment)[source]#

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
user_id: StrictStr#
role: SpaceRoleAssignment#
model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'protected_namespaces': (), 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

to_str() str[source]#

Returns the string representation of the model using alias

Return type:

str

to_json() str[source]#

Returns the JSON representation of the model using alias

Return type:

str

classmethod from_json(json_str: str) Self | None[source]#

Create an instance of AddSpaceUserRequest from a JSON string

Parameters:

json_str (str)

Return type:

Self | None

to_dict() Dict[str, Any][source]#

Return the dictionary representation of the model using alias.

This has the following differences from calling pydantic’s self.model_dump(by_alias=True):

  • None is only added to the output dict for nullable fields that were set at model initialization. Other fields with value None are ignored.

Return type:

Dict[str, Any]

classmethod from_dict(obj: Dict[str, Any] | None) Self | None[source]#

Create an instance of AddSpaceUserRequest from a dict

Parameters:

obj (Dict[str, Any] | None)

Return type:

Self | None

class CustomSpaceRole(*, type: Literal['CUSTOM'] = 'CUSTOM', id: Annotated[str, Strict(strict=True)], name: Annotated[str, Strict(strict=True)] | None = None)[source]#

Bases: CustomRoleAssignment

A custom RBAC role assignment for a space.

The type discriminator is set to "CUSTOM" automatically.

Parameters:
  • id (Annotated[str, Strict(strict=True)]) – The unique identifier of the custom RBAC role.

  • name (Annotated[str, Strict(strict=True)] | None) – Human-readable name of the custom role (returned in responses only; ignored on input).

  • type (Literal['CUSTOM'])

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

type: Literal['CUSTOM']#
model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'protected_namespaces': (), 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class ListSpacesResponse(*, spaces: List[Space], pagination: PaginationMetadata)[source]#

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
spaces: List[Space]#
pagination: PaginationMetadata#
model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'protected_namespaces': (), 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

to_str() str[source]#

Returns the string representation of the model using alias

Return type:

str

to_json() str[source]#

Returns the JSON representation of the model using alias

Return type:

str

classmethod from_json(json_str: str) Self | None[source]#

Create an instance of ListSpacesResponse from a JSON string

Parameters:

json_str (str)

Return type:

Self | None

to_dict() Dict[str, Any][source]#

Return the dictionary representation of the model using alias.

This has the following differences from calling pydantic’s self.model_dump(by_alias=True):

  • None is only added to the output dict for nullable fields that were set at model initialization. Other fields with value None are ignored.

Return type:

Dict[str, Any]

classmethod from_dict(obj: Dict[str, Any] | None) Self | None[source]#

Create an instance of ListSpacesResponse from a dict

Parameters:

obj (Dict[str, Any] | None)

Return type:

Self | None

to_df(by_alias: bool = False, exclude_none: str | bool = True, json_normalize: bool = False, convert_dtypes: bool = True, expand_field: str = 'additional_properties', expand_prefix: str = '') pd.DataFrame#

Convert a list of objects to a pandas.DataFrame.

Behavior:
  • If an item is a Pydantic v2 model, use .model_dump(by_alias=…).

  • If an item is a mapping (dict-like), use it as-is.

  • Otherwise, raise a ValueError (unsupported row type).

Parameters:
  • self (object) – The object instance containing the field to convert.

  • by_alias (bool) – Use field aliases when dumping Pydantic models.

  • exclude_none (str | bool) – Control None/NaN column dropping. - False: keep Nones as-is - “all”: drop columns where all values are None/NaN - “any”: drop columns where any value is None/NaN - True: alias for “all”

  • json_normalize (bool) – If True, flatten nested dicts via pandas.json_normalize.

  • convert_dtypes (bool) – If True, call DataFrame.convert_dtypes() at the end.

  • expand_field (str) – If set, look for this field in each row and expand its keys into top-level columns.

  • expand_prefix (str) – If set, prefix expanded column names with this string.

Returns:

The converted DataFrame.

Return type:

pandas.DataFrame

class PredefinedSpaceRole(*, type: Literal['PREDEFINED'] = 'PREDEFINED', name: UserSpaceRole)[source]#

Bases: PredefinedRoleAssignment

A predefined space role assignment.

The type discriminator is set to "PREDEFINED" automatically.

Parameters:
  • name (UserSpaceRole) – The predefined role name ("ADMIN", "MEMBER", "READ_ONLY", or "ANNOTATOR").

  • type (Literal['PREDEFINED'])

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

type: Literal['PREDEFINED']#
model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'protected_namespaces': (), 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class Space(*, id: Annotated[str, Strict(strict=True)], name: Annotated[str, Strict(strict=True)], description: Annotated[str, Strict(strict=True)], created_at: datetime, is_private: Annotated[bool, Strict(strict=True)])[source]#

Bases: BaseModel

A space is a container within an organization for grouping related projects, datasets, and experiments. Spaces enable team collaboration or isolated experimentation with role-based access control.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
id: StrictStr#
name: StrictStr#
description: StrictStr#
created_at: datetime#
is_private: StrictBool#
model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'protected_namespaces': (), 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

to_str() str[source]#

Returns the string representation of the model using alias

Return type:

str

to_json() str[source]#

Returns the JSON representation of the model using alias

Return type:

str

classmethod from_json(json_str: str) Self | None[source]#

Create an instance of Space from a JSON string

Parameters:

json_str (str)

Return type:

Self | None

to_dict() Dict[str, Any][source]#

Return the dictionary representation of the model using alias.

This has the following differences from calling pydantic’s self.model_dump(by_alias=True):

  • None is only added to the output dict for nullable fields that were set at model initialization. Other fields with value None are ignored.

Return type:

Dict[str, Any]

classmethod from_dict(obj: Dict[str, Any] | None) Self | None[source]#

Create an instance of Space from a dict

Parameters:

obj (Dict[str, Any] | None)

Return type:

Self | None

class SpaceMembership(*, id: str, user_id: str, space_id: str, role: PredefinedSpaceRole | CustomSpaceRole)[source]#

Bases: BaseModel

A space membership record with domain-typed role.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
id: str#
user_id: str#
space_id: str#
role: Annotated[PredefinedSpaceRole | CustomSpaceRole, FieldInfo(annotation=NoneType, required=True, discriminator='type')]#
model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class SpaceRoleAssignment(*args, oneof_schema_1_validator: PredefinedRoleAssignment | None = None, oneof_schema_2_validator: CustomRoleAssignment | None = None, actual_instance: CustomRoleAssignment | PredefinedRoleAssignment | None = None, one_of_schemas: Set[str] = {'CustomRoleAssignment', 'PredefinedRoleAssignment'}, discriminator_value_class_map: Dict[str, str] = {})[source]#

Bases: BaseModel

Specifies which role to assign within a space. Discriminated by type: - PREDEFINED: a built-in platform role — { “type”: “PREDEFINED”, “name”: “ADMIN” | “MEMBER” | “READ_ONLY” | “ANNOTATOR” } - CUSTOM: a custom RBAC role identified by its ID — { “type”: “CUSTOM”, “id”: “<encoded-role-id>” } Used wherever a space-level role assignment is required (memberships, service key bindings, etc.).

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
oneof_schema_1_validator: PredefinedRoleAssignment | None#
oneof_schema_2_validator: CustomRoleAssignment | None#
actual_instance: CustomRoleAssignment | PredefinedRoleAssignment | None#
one_of_schemas: Set[str]#
model_config: ClassVar[ConfigDict] = {'protected_namespaces': (), 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

discriminator_value_class_map: Dict[str, str]#
classmethod actual_instance_must_validate_oneof(v)[source]#
classmethod from_dict(obj: str | Dict[str, Any]) Self[source]#
Parameters:

obj (str | Dict[str, Any])

Return type:

Self

classmethod from_json(json_str: str) Self[source]#

Returns the object represented by the json string

Parameters:

json_str (str)

Return type:

Self

to_json() str[source]#

Returns the JSON representation of the actual instance

Return type:

str

to_dict() Dict[str, Any] | CustomRoleAssignment | PredefinedRoleAssignment | None[source]#

Returns the dict representation of the actual instance

Return type:

Dict[str, Any] | CustomRoleAssignment | PredefinedRoleAssignment | None

to_str() str[source]#

Returns the string representation of the actual instance

Return type:

str

class UserSpaceRole(value, names=_not_given, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: str, Enum

Space-level role for the user. - ADMIN: Full access to the space and its resources. - MEMBER: Standard access to the space. - READ_ONLY: Read-only access to the space. - ANNOTATOR: Limited access for annotation tasks only.

ADMIN = 'ADMIN'#
MEMBER = 'MEMBER'#
READ_ONLY = 'READ_ONLY'#
ANNOTATOR = 'ANNOTATOR'#
classmethod from_json(json_str: str) Self[source]#

Create an instance of UserSpaceRole from a JSON string

Parameters:

json_str (str)

Return type:

Self