Skip to main content

Understanding Team Context in RunGen.AI

In the RunGen.AI platform, users can manage their own resources or collaborate within teams. The behavior of API requests depends on the presence of the x-team-id header, which determines whether the action is performed in the user's personal context or within the team context.


How x-team-id Affects API Behavior

With x-team-id Header

When the x-team-id header is included in an API request:

  • The request will operate within the context of the specified team.
  • Actions such as creating, editing, or deleting resources will affect the team’s shared resources.
  • The user must be a member of the specified team and have sufficient permissions (e.g., OWNER, ADMIN, or MEMBER) to perform the requested action.
  • Resources created in this mode (e.g., apps, jobs) will belong to the team and will be accessible to all members of the team.

Example Header with Team Context:

x-team-id: 123e4567-e89b-12d3-a456-426614174000

Without x-team-id Header

When the x-team-id header is omitted:

  • The request operates within the user's personal area.
  • Resources created or modified will belong exclusively to the user.
  • Team members will not have access to these resources unless explicitly shared or transferred.

Key Points to Note

  1. Same API Key: The same API key is used for both personal and team contexts. The x-team-id header simply switches the operational scope.
  2. Permissions: The user must have sufficient permissions within the team to perform actions. For example:
    • OWNER or ADMIN can perform all actions, including creating and deleting resources.
    • MEMBER can typically create and edit resources, depending on the team’s permission settings.
  3. Resource Visibility:
    • Resources created in the team context are visible to all team members.
    • Personal resources remain private and are not accessible to the team.

Practical Examples

Example 1: Create an App in the Team Context

curl --location 'https://api.rungen.ai/app' \
--header 'x-api-key: 12324234' \
--header 'x-team-id: 123e4567-e89b-12d3-a456-426614174000' \
--header 'Content-Type: application/json' \
--data '{
"name": "Team App",
"description": "An app shared with the team",
"configuration": {
"gpu_tier": "STANDARD"
},
"workflow": {
"model_url": "https://huggingface.co/example-model",
}
}'

In this example:

  • The app will be created in the team with the ID 123e4567-e89b-12d3-a456-426614174000.
  • All members of the team will have access to this app.

Example 2: Create an App in the Personal Context

curl --location 'https://api.rungen.ai/app' \
--header 'x-api-key: 12324234' \
--header 'Content-Type: application/json' \
--data '{
"name": "Personal App",
"description": "An app created in my personal area",
"configuration": {
"gpu_tier": "STANDARD"
},
"workflow": {
"model_url": "https://huggingface.co/example-model",
}
}'

In this example:

  • The app will be created in the user’s personal area.
  • It will not be accessible to team members.

Best Practices

  • Include the x-team-id Header When Working in a Team Context: Always specify the x-team-id header when performing actions intended for a team.
  • Verify Your Permissions: Ensure you have the necessary permissions to perform actions within the team.
  • Understand Resource Ownership: Be mindful of where resources are created to avoid confusion between personal and team resources.