Skip to main content
POST
https://api-dev.weir.ai/
/
org
/
create
/
team
curl -X POST 'https://api.weir.ai/org/create/team' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -H 'x-source: console' \
  -d '{
    "name": "Development Team"
  }'
{
  "data": {
    "teamId": "team_123456789",
    "name": "Development Team",
    "createdAt": "2024-01-15T10:30:00Z",
    "memberCount": 1,
    "status": "active"
  },
  "message": "Team created successfully",
  "status": "success"
}

Create Team

Create a new team within your organization for better collaboration and member management.
curl -X POST 'https://api.weir.ai/org/create/team' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -H 'x-source: console' \
  -d '{
    "name": "Development Team"
  }'
{
  "data": {
    "teamId": "team_123456789",
    "name": "Development Team",
    "createdAt": "2024-01-15T10:30:00Z",
    "memberCount": 1,
    "status": "active"
  },
  "message": "Team created successfully",
  "status": "success"
}

Authentication

This endpoint requires Console API authentication with bearer token and x-source: console header.
Authorization
string
required
Bearer token for authentication. Format: Bearer YOUR_ACCESS_TOKEN
x-source
string
required
Source identifier. Must be set to console for all Console API requests.

Request Body

name
string
required
The name of the team to create. Must be unique within the organization.

Response Fields

data
object
required
Team data object containing the created team information.
message
string
required
Human-readable message describing the result of the operation.
status
string
required
Operation status. Always “success” for successful team creation.

Error Responses

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid request parameters",
    "details": {
      "name": "Team name is required and must be between 2-50 characters"
    }
  },
  "status": "error"
}
Causes:
  • Missing team name
  • Team name too short or too long
  • Invalid characters in team name
{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Invalid or expired token",
    "details": "The provided access token is invalid or has expired"
  },
  "status": "error"
}
Causes:
  • Missing or invalid access token
  • Expired access token
  • Missing x-source header
{
  "error": {
    "code": "FORBIDDEN",
    "message": "Insufficient permissions",
    "details": "You do not have permission to create teams in this organization"
  },
  "status": "error"
}
Causes:
  • User lacks team creation permissions
  • User is not an organization admin
{
  "error": {
    "code": "TEAM_NAME_EXISTS",
    "message": "Team name already exists",
    "details": "A team with this name already exists in your organization"
  },
  "status": "error"
}
Causes:
  • Team name already exists in the organization
  • Duplicate team creation attempt

Usage Examples

const createTeam = async (teamName, accessToken) => {
  try {
    const response = await fetch('https://api.weir.ai/org/create/team', {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${accessToken}`,
        'Content-Type': 'application/json',
        'x-source': 'console'
      },
      body: JSON.stringify({ name: teamName })
    });
    
    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    }
    
    const data = await response.json();
    return data.data;
  } catch (error) {
    console.error('Create team error:', error);
    throw error;
  }
};

// Usage
const team = await createTeam('Development Team', 'your_access_token');
console.log('Created team:', team);

Team Management Workflow

Create Team

Use this endpoint to create a new team with a unique name.

Invite Members

Use the invite team member endpoint to add users to the team.

Manage Roles

Update team member roles as needed for proper access control.

Monitor Team

Use the get teams endpoint to monitor team activity and membership.

Best Practices

  • Use descriptive and clear team names
  • Follow consistent naming conventions
  • Avoid special characters and spaces
  • Keep names under 50 characters
  • Ensure users have proper permissions before team creation
  • Implement role-based access control
  • Monitor team creation activities
  • Handle duplicate team name errors gracefully
  • Provide clear error messages to users
  • Implement retry logic for transient failures
Pro Tip: Create teams with clear, descriptive names that reflect their purpose or department. This makes team management and member assignment much easier.