Table of contents
Official Content
  • This documentation is valid for:

The Organization API via Python SDK - PyGEAI enables you to manage Projects within your Organization.

You can perform the following actions:

  • List projects: Retrieves a list of all Projects within your Organization. You can choose to retrieve a summary or detailed information for each Project.
  • Create project: Creates a new Project within your Organization.
  • Get project data: Retrieves detailed information about a specific Project using its ID.
  • Update project: Updates the name and description of an existing Project.
  • Delete project: Deletes an existing Project.
  • Token management: Retrieves the tokens associated with a specific Project.
  • Add project member: Sends an invitation email to add a user to a Project with specific roles, supporting individual and batch invitations.
  • Access control: Retrieves memberships, roles, and members across Organizations and Projects, and retrieves plugin runtime policies.

To run them, choose one of the following options:

  1. Command Line
  2. Low-Level Service Layer
  3. High-Level Service Layer

List projects

Lists existing Projects within an Organization using Python SDK - PyGEAI. You can choose to display a summary or the full Project information.

1. Command Line

You can list Projects using the following Command Line options:

List projects with summary details (default)

You can list the Projects without additional options, as follows:

geai org list-projects

List projects with full details

Use the optional flag "-d" to indicate full detail. The default is summary.

geai org list-projects -d full

If you need to work with a different API key, you can indicate an alias. For example, suppose you have an 'admin' alias with an organization API key.

List projects using a different API token (alias)

geai --alias <"alias_name"> org list-projects

Replace "alias_name" with the actual alias for your GEAI_API_KEY (e.g., "admin").

Note: Each alias defines a profile with a specific access level. Based on that access level, set GEAI_API_KEY to $GEAI_APITOKEN using either an Organization API token or a Project API token, depending on your needs.

 

2. Low-Level Service Layer

Use the following code snippet to list Projects with the desired detail level, using the Low-Level Service Layer:

from pygeai.organization.clients import OrganizationClient()

client = OrganizationClient()
project_list = client.get_project_list(detail="full")  # Use "summary" for less detail
print(project_list)

3. High-Level Service Layer

Use the following code snippets to list Projects using the High-Level Service Layer:

List projects with default details

You can get the list of Projects by calling the "get_project_list" method from the OrganizationManager class.

from pygeai.organization.managers import OrganizationManager

manager = OrganizationManager()

response = manager.get_project_list()
print(f"response: {response}")

List projects with full details and a specific alias

Also, you can indicate the alias for the desired environment to use.

from pygeai.organization.managers import OrganizationManager

manager = OrganizationManager(alias="sdkorg")

response = manager.get_project_list("full")
print(f"response: {response}")

Create project

Creates a new Project in Globant Enterprise AI using Python SDK - PyGEAI by providing the Project name and the administrator's email address. Optionally, you can add a Project description and set usage limits.

1. Command Line

The simplest way to create a Project is using the Command Line:

  1. Open your terminal or command prompt.
  2. Run the following command, replacing the placeholders with your desired values:
geai org create-project \  
  -n "Project Name" \  
  -e "admin@example.com"  \  
  -d "Project Description"

Where:

  • n: Name of your Project.
  • e: Email address of the Project administrator.
  • d: Optional description for your Project.

2. Low level service layer

For more control, you can use the Low-Level Service Layer. To do so:

  1. Import the necessary modules.
  2. Create an instance of the OrganizationClient class.
  3. Call the create_project method providing the required information.
from pygeai.organization.clients import OrganizationClient()  
name="Project Name"  
description="Project Description"  
email="admin@example.com"

client = OrganizationClient()  
new_project = client.create_project(name=name, email=email, description=description)  
print(new_project)

3. High-Level Service Layer

The High-Level Service Layer offers a more structured approach:

  1. Import the necessary modules.
  2. Create an instance of the OrganizationManager class.
  3. Define the Project usage limits (optional).
  4. Create a Project object with the required information.
  5. Call the create_project method of the OrganizationManager to create the Project.
from pygeai.organization.managers import OrganizationManager
from pygeai.core.models import ProjectUsageLimit, Project

manager = OrganizationManager()

usage_limit = ProjectUsageLimit(
    subscription_type="Monthly",  # Options: Freemium, Daily, Weekly, Monthly
    usage_unit="Requests",        # Options: Cost (Only Cost is allowed for organization limits)
    soft_limit=500.0,             # Recommended usage limit
    hard_limit=1000.0,            # Maximum allowed usage
    renewal_status="Renewable"    # Options: Renewable, NonRenewable
)

project = Project(
    name="Project Name",
    description="Project Description",
    email="admin@example.com",
    usage_limit=usage_limit
)

created_project = manager.create_project(project)

Update project

Updates an existing Project in Globant Enterprise AI using PyGEA </pygeai>. You can modify a Project's name and description by providing its ID and updated information.

To update usage limits, refer to Project Usage Limits.

1. Command Line

Use the following command to update a Project:

geai org update-project \
 --id <project_id> \
 --name "<new_project_name>" \
 --description "<new_project_description>"

Replace the placeholders with the actual values:

  • <project_id>: ID of the Project you want to update.
  • <new_project_name>: New name for the Project.
  • <new_project_description>: New description for the Project.

For example:

geai org update-project \
  --id 12345678-90ab-cdef-1234-567890abcdef \
  --name "Updated Project Name" \
  --description "This is the updated project description"

2. Low-Level Service Layer

Use the following code snippet to update a Project using the Low-Level Service Layer:

from pygeai.organization.clients import OrganizationClient()

project_id="<project_id>"
name="<new_project_name>"
description="<new_project_description>"

client = OrganizationClient()
new_project = client.update_project(
    project_id=project_id,
    name=name,
    description=description
    )
print(new_project)

Replace the placeholders with the actual values for your Project.

3. High-Level Service Layer

Use the following code snippet to update a Project using the High-Level Service Layer:

from pygeai.organization.managers import OrganizationManager
from pygeai.core.models import UsageLimit, Project

client = OrganizationManager()

project = Project(
    d="<project_id>",
    name="<new_project_name>",
    description="<new_project_description>",
    )

project = client.update_project(project)
print(f"project: {project}")

Replace the placeholders with the actual values for your Project.

Delete project

Deletes an existing Project in Globant Enterprise AI using PyGEA </pygeai>. You can delete a Project by providing its Project ID.

A successful deletion results in an empty response. If the Project doesn't exist or if you lack the necessary permissions, an error occurs.

1. Command Line

Use the following command to delete a Project:

geai org delete-project \
--id <project_id>

Replace <project_id> with the actual Project ID. For example:

geai org delete-project \
--id 12345678-90ab-cdef-1234-567890abcdef

2. Low-Level Service Layer

Use the following code snippet to delete a Project using the Low-Level Service Layer:

from pygeai.organization.clients import OrganizationClient()

project_id = "<project_id>"
client = OrganizationClient()
deleted_project = client.delete_project(project_id=project_id)
print(deleted_project)

Replace <project_id> with the actual Project ID. For example:

from pygeai.organization.clients import OrganizationClient()

project_id="12345678-90ab-cdef-1234-567890abcdef"
client = OrganizationClient()
deleted_project = client.delete_project()

3. High-Level Service Layer

Use the following code snippet to delete a Project using the High-Level Service Layer:

from pygeai.organization.managers import OrganizationManager

manager = OrganizationManager()

response = manager.delete_project("<project_id>")
print(f"response: {response}")

Replace <project_id> with the actual Project ID. For example:

from pygeai.core.managers import OrganizationManager

manager = OrganizationManager()
response = manager.delete_project("12345678-90ab-cdef-1234-567890abcdef")
print(f"response: {response}")

Get project data

Retrieves Project data using PyGEA </pygeai>. You can fetch Project details by providing the Project ID.

1. Command Line

Use the following command to retrieve the Project:

geai org get-project \
--id <project_id>

Replace <project_id> with the actual Project ID. For example:

geai org get-project \
--id 12345678-90ab-cdef-1234-567890abcdef

2. Low-Level Service Layer

Use the following code snippet to retrieve Project data using the Low-Level Service Layer:

from pygeai.organization.clients import OrganizationClient()

project_id="<project_id>"
client = OrganizationClient()
project_data = client.get_project_data(project_id=project_id)
print(project_data)

Replace <project_id> with the actual Project ID. For example:

from pygeai.organization.clients import OrganizationClient()

project_id="12345678-90ab-cdef-1234-567890abcdef"
client = OrganizationClient()
project_data = client.get_project_data(project_id=project_id)
print(project_data)

3. High-Level Service Layer

Use the following code snippet to retrieve Project data using the High-Level Service Layer:

from pygeai.organization.managers import OrganizationManager

manager = OrganizationManager(alias="sdkorg")

project = manager.get_project_data(project_id="<project_id>")
print(f"project: {project}")

Replace <project_id> with the actual Project ID. For example:

from pygeai.core.managers import OrganizationManager

manager = OrganizationManager(alias="sdkorg")
project = manager.get_project_data(project_id="12345678-90ab-cdef-1234-567890abcdef")
print(f"project: {project}")

Token Management

You can manage Project tokens, which are essential for authentication and authorization when interacting with specific Projects.

Get Project Tokens

Retrieves the tokens associated with a specific Project using PyGEA. You can fetch these tokens by providing the Project ID.

1. Command Line

Use the following command to retrieve Project tokens:

geai org get-tokens --id <project_id>

Replace <project_id> with the actual Project ID. For example:

geai org get-tokens --id 12345678-90ab-cdef-1234-567890abcdef

2. Low-Level Service Layer

Use the following code snippet to retrieve Project tokens using the Low-Level Service Layer:

from pygeai.organization.clients import OrganizationClient

project_id = "<project_id>"

client = OrganizationClient()
tokens = client.get_project_tokens(project_id=project_id)
print(tokens)

Replace <project_id> with the actual Project ID. For example:

from pygeai.organization.clients import OrganizationClient

project_id = "12345678-90ab-cdef-1234-567890abcdef"

client = OrganizationClient()
tokens = client.get_project_tokens(project_id=project_id)
print(tokens)

3. High-Level Service Layer

Use the following code snippet to retrieve Project tokens using the High-Level Service Layer:

from pygeai.core.managers import OrganizationManager
from pygeai.core.base.models import ProjectTokensResponse

client = OrganizationManager()
project_id = "<project_id>"

tokens: ProjectTokensResponse = client.get_project_tokens(project_id=project_id)
print(f"tokens: {tokens}")

Replace <project_id> with the actual Project ID. For example:

from pygeai.organization.managers import OrganizationManager
from pygeai.core.models import ProjectTokensResponse

client = OrganizationManager()

project_id = "12345678-90ab-cdef-1234-567890abcdef"

tokens: ProjectTokensResponse = client.get_project_tokens(project_id=project_id)
print(f"tokens: {tokens}")

Add Project Member

Sends an invitation email to add a user to a Project using Python SDK - PyGEA. You can add a single user or process multiple invitations in batch mode using a CSV file.

1. Command Line

Add a single user to a Project

Use the following command to invite a user to a Project:

geai org add-project-member \
  --project-id <project_id> \
  --email <user_email> \
  --roles "<role1>,<role2>"

Replace the placeholders with the actual values:

  • <project_id>: Id of the Project.
  • <user_email>: Email address of the user to invite.
  • <role1>,<role2>: Comma-separated list of roles (for example, "Project member,Project administrator").

For example:

geai org add-project-member \
  --project-id 1956c032-3c66-4435-acb8-6a06e52f819f \
  --email user@example.com \
  --roles "Project member,Project administrator"

You can also use the short alias:

geai org apm \
  --project-id 1956c032-3c66-4435-acb8-6a06e52f819f \
  --email user@example.com \
  --roles "Project member"

Add multiple users via CSV file (batch mode)

Use the -b or --batch flag to process multiple invitations from a CSV file:

geai org add-project-member --batch <path_to_csv_file>

Use the following CSV format:

project_id,email,role1,role2,...
1956c032-3c66-4435-acb8-6a06e52f819f,user1@example.com,Project member
1956c032-3c66-4435-acb8-6a06e52f819f,user2@example.com,Project member,Project administrator

For example:

geai org add-project-member --batch project_members.csv

The command processes each line and reports successful and failed invitations.

2. Low-Level Service Layer

Use the following code snippet to invite a user to a Project using the Low-Level Service Layer:

from pygeai.organization.clients import OrganizationClient

project_id = "<project_id>"
email = "<user_email>"
roles = "Project member", "Project administrator"

client = OrganizationClient()
result = client.add_project_member(project_id=project_id, email=email, roles=roles)
print(result)

Replace the placeholders with the actual values. For example:

from pygeai.organization.clients import OrganizationClient

project_id = "1956c032-3c66-4435-acb8-6a06e52f819f"
email = "user@example.com"
roles = "Project member", "Project administrator"

client = OrganizationClient()
result = client.add_project_member(project_id=project_id, email=email, roles=roles)
print(result)

For batch processing, use the following example:

import csv
from pygeai.organization.clients import OrganizationClient

client = OrganizationClient()

with open('project_members.csv', 'r') as file:
    csv_reader = csv.reader(file)
    for row in csv_reader:
        if len(row) >= 3:
            project_id = row0
            email = row1
            roles = row2:
            try:
                result = client.add_project_member(
                    project_id=project_id,
                    email=email,
                    roles=roles
                )
                print(f"✓ Invited {email} to project {project_id}")
            except Exception as e:
                print(f"✗ Failed to invite {email}: {e}")

3. High-Level Service Layer

Use the following code snippet to invite a user to a Project using the High-Level Service Layer:

from pygeai.organization.managers import OrganizationManager

manager = OrganizationManager()

project_id = "<project_id>"
email = "<user_email>"
roles = "Project member", "Project administrator"

response = manager.add_project_member(
    project_id=project_id,
    email=email,
    roles=roles
)
print(f"response: {response}")

Replace the placeholders with the actual values. For example:

from pygeai.organization.managers import OrganizationManager

manager = OrganizationManager()

project_id = "1956c032-3c66-4435-acb8-6a06e52f819f"
email = "user@example.com"
roles = "Project member", "Project administrator"

response = manager.add_project_member(
    project_id=project_id,
    email=email,
    roles=roles
)
print(f"response: {response}")

Access Control

The Access Control API to manage memberships, roles, and members across Organizations and Projects.

You can perform the following actions:

  • Get Memberships: Retrieves Organizations where you are a member.
  • Get Project Memberships: Retrieves Projects where a user is a member.
  • Get Project Roles: Retrieves all roles supported by a specific Project.
  • Get Project Members: Retrieves all members and their roles for a specific Project.
  • Get Organization Members: Retrieves all members and their roles for a specific Organization.
  • Get Plugin Runtime Policies: Retrieves plugin runtime policies defined for an Organization.

Get Memberships

Retrieves all Organizations where you are a member using PyGEA </pygeai>. It supports pagination and filtering options.

1. Command Line

Use the following command to retrieve your Organization memberships:

geai org get-memberships

With optional pagination parameters:

geai org get-memberships \
  --start-page 1 \
  --page-size 10 \
  --order-direction asc

2. Low-Level Service Layer

Use the following code snippet to retrieve memberships:

from pygeai.organization.clients import OrganizationClient

client = OrganizationClient()
result = client.get_memberships(
    start_page=1,
    page_size=10,
    order_direction="asc"
)
print(result)

Get Project Memberships

Retrieves Projects where a specific user is a member using PyGEA </pygeai>. It supports pagination, sorting, and filtering by email.

1. Command Line

Use the following command to retrieve Project memberships for a specific user:

geai org get-project-memberships \
  --email user@example.com \
  --start-page 1 \
  --page-size 10

With optional sorting and filtering:

geai org get-project-memberships \
  --email user@example.com \
  --start-page 1 \
  --page-size 10 \
  --order-key name \
  --order-direction desc \
  --role-types backend,frontend

Where:

  • --email: User email address to filter by (required).
  • --start-page: Page number for pagination (optional, default: 1).
  • --page-size: Number of items per page (optional, default: 20).
  • --order-key: Field for sorting (only 'name' supported, optional).
  • --order-direction: Sort direction: 'asc' or 'desc' (optional, default: 'desc').
  • --role-types: Comma-separated list of role types (optional, case-insensitive).

2. Low-Level Service Layer

Use the following code snippet to retrieve Project memberships:

from pygeai.organization.clients import OrganizationClient

client = OrganizationClient()
result = client.get_project_memberships(
    email="user@example.com",
    start_page=1,
    page_size=10,
    order_key="name",
    order_direction="desc",
    role_types="backend,frontend"
)
print(result)

Get Project Roles

Retrieves all roles supported by a specific Project using PyGEA </pygeai>. It supports pagination, sorting, and filtering by role types.

1. Command Line

Use the following command to retrieve Project roles:

geai org get-project-roles \
  --project-id <project_id>

With optional pagination and filtering:

geai org get-project-roles \
  --project-id 12345678-90ab-cdef-1234-567890abcdef \
  --start-page 1 \
  --page-size 10 \
  --order-key name \
  --order-direction asc \
  --role-types backend

Where:

  • --project-id: The unique identifier (GUID) of the Project (required).
  • --start-page: Page number for pagination (optional, default: 1).
  • --page-size: Number of items per page (optional, default: 20).
  • --order-key: Field for sorting (only 'name' supported, optional).
  • --order-direction: Sort direction: 'asc' or 'desc' (optional, default: 'desc').
  • --role-types: Comma-separated list of role types: 'backend', 'frontend' (optional, case-insensitive).

2. Low-Level Service Layer

Use the following code snippet to retrieve Project roles:

from pygeai.organization.clients import OrganizationClient

project_id = "12345678-90ab-cdef-1234-567890abcdef"

client = OrganizationClient()
result = client.get_project_roles(
    project_id=project_id,
    start_page=1,
    page_size=10,
    order_key="name",
    order_direction="asc",
    role_types="backend"
)
print(result)

Get Project Members

Retrieves all members and their roles for a specific Project using PyGEA </pygeai>. It supports pagination, sorting, and filtering by role types.

1. Command Line

Use the following command to retrieve Project members:

geai org get-project-members \
  --project-id <project_id>

With optional pagination and filtering:

geai org get-project-members \
  --project-id 12345678-90ab-cdef-1234-567890abcdef \
  --start-page 1 \
  --page-size 10 \
  --order-key name \
  --order-direction desc \
  --role-types backend,frontend

Where:

  • --project-id: The unique identifier (GUID) of the Project (required).
  • --start-page: Page number for pagination (optional, default: 1).
  • --page-size: Number of items per page (optional, default: 20).
  • --order-key: Field for sorting (only 'name' supported, optional).
  • --order-direction: Sort direction: 'asc' or 'desc' (optional, default: 'desc').
  • --role-types: Comma-separated list of role types: 'backend', 'frontend' (optional, case-insensitive).

2. Low-Level Service Layer

Use the following code snippet to retrieve Project members:

from pygeai.organization.clients import OrganizationClient

project_id = "12345678-90ab-cdef-1234-567890abcdef"

client = OrganizationClient()
result = client.get_project_members(
    project_id=project_id,
    start_page=1,
    page_size=10,
    order_key="name",
    order_direction="desc",
    role_types="backend,frontend"
)
print(result)

Get Organization Members

Retrieves all members and their roles for a specific Organization using PyGEA </pygeai>. It supports pagination, sorting, and filtering by role types.

1. Command Line

Use the following command to retrieve Organization members:

geai org get-organization-members \
  --organization-id <organization_id>

With optional pagination and filtering:

geai org get-organization-members \
  --organization-id 12345678-90ab-cdef-1234-567890abcdef \
  --start-page 1 \
  --page-size 10 \
  --order-key email \
  --order-direction asc \
  --role-types backend

Where:

  • --organization-id or --oid: The unique identifier (GUID) of the Organization (required).
  • --start-page: Page number for pagination (optional, default: 1).
  • --page-size: Number of items per page (optional, default: 20).
  • --order-key: Field for sorting (only 'email' supported, optional).
  • --order-direction: Sort direction: 'asc' or 'desc' (optional, default: 'desc').
  • --role-types: Comma-separated list of role types. Only 'backend' is supported for Organizations (optional, case-insensitive).

2. Low-Level Service Layer

Use the following code snippet to retrieve Organization members:

from pygeai.organization.clients import OrganizationClient

organization_id = "12345678-90ab-cdef-1234-567890abcdef"

client = OrganizationClient()
result = client.get_organization_members(
    organization_id=organization_id,
    start_page=1,
    page_size=10,
    order_key="email",
    order_direction="asc",
    role_types="backend"
)
print(result)

Get Plugin Runtime Policies

Retrieves the plugin runtime policies defined for an Organization using PyGEA </pygeai>. If no policies are defined, the response indicates that individual policies apply.

Plugin runtime policies control permissions for Organization Agents at The Station, including chat sharing and external execution permissions.

1. Command Line

Use the following command to retrieve plugin runtime policies:

geai org get-plugin-runtime-policies \
  --organization-id <organization_id>

Replace <organization_id> with the actual Organization GUID. For example:

geai org get-plugin-runtime-policies \
  --organization-id 12345678-90ab-cdef-1234-567890abcdef

You can also use the short alias:

geai org get-plugin-runtime-policies --oid 12345678-90ab-cdef-1234-567890abcdef

Response Examples:

Organizations without policies:

{
  "messages": {
    "description": "Organization plugin runtime policies not defined. Individual policy will apply."
  }
}

Organizations with policies:

{
  "policies": {
    "chatSharingPermissions": "project",
    "externalExecutionPermissions": "organization"
  }
}

Where:

  • chatSharingPermissions: Maximum execution permissions for Organization Agents. Values: "none", "project", "organization".
  • externalExecutionPermissions: Allows sharing conversation by anonymous users. Values: "none", "project", "organization".

2. Low-Level Service Layer

Use the following code snippet to retrieve plugin runtime policies:

from pygeai.organization.clients import OrganizationClient

organization_id = "12345678-90ab-cdef-1234-567890abcdef"

client = OrganizationClient()
result = client.get_plugin_runtime_policies(organization_id=organization_id)
print(result)
Last update: December 2025 | © GeneXus. All rights reserved. GeneXus Powered by Globant