> ## Documentation Index
> Fetch the complete documentation index at: https://docs.codeant.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Team

> Creates a new developer team. Teams can be organized around **developers** (by adding members), **repositories** (by assigning repos), or **both**. You can also create empty teams and add members/repos later via the update and member endpoints.

Use cases:
- **Developer-based team**: Pass `members` to group developers (e.g. a frontend squad). You can optionally pass `repositories` as a filter to scope metrics to specific repos for this team.
- **Repository-based team**: Pass only `repositories` to group repos (e.g. all microservices). No members - metrics are aggregated across the listed repos.
- **Mixed team**: Pass both `members` and `repositories` - metrics are scoped to these members across these repos.
- **Disabled lists**: Create special teams named `codeant-disabled-members` or `codeant-disabled-repos` to exclude specific developers or repositories from all metrics calculations across the organization.

Optionally assign one or more `team_leads` (by login) and categorize teams with `tags`. Teams can be nested using `parent_team_id`.



## OpenAPI

````yaml /openapi.json post /api/metrics/developer/teams/create
openapi: 3.0.3
info:
  title: CodeAnt AI API
  description: >-
    API for code analysis (SAST, SCA, secrets, IaC) and developer productivity
    metrics. Supports GitHub, GitLab, Bitbucket, and Azure DevOps.
  version: 1.0.0
servers:
  - url: https://api.codeant.ai
    description: Production server
security: []
tags:
  - name: Analysis
    description: Code analysis operations
  - name: Agent Analysis
    description: >-
      AI-powered agent analysis operations. Uses LLM-based code exploration
      agents to perform deep security threat hunting, bug finding, and custom
      analysis with reflection-based false positive filtering.
  - name: Developer Metrics - Teams
    description: >-
      Manage developer teams: create, update, delete teams and manage team
      membership. Teams are used to organize developers and scope metrics.
  - name: Developer Metrics
    description: >-
      Developer productivity and activity metrics: active developers, PR
      throughput, individual comparisons, and AI-generated summaries. All
      endpoints support GitHub, GitLab, Bitbucket, and Azure DevOps.
  - name: Audit Logs
    description: >-
      Read-only access to your organization's audit trail for compliance, ETL
      and SIEM ingestion. Events are immutable, retained for 180 days, and cover
      security-relevant actions: user management, access control, credentials,
      scan triggers, configuration changes and data exports. Secrets and tokens
      are redacted and never appear in any response format.
  - name: Container Scanning
    description: >-
      Container image vulnerability scanning across AWS ECR, Azure ACR, and GCP
      GAR registries. List tracked containers with their latest scan, then fetch
      the full vulnerability findings of a scan — the same data shown on the
      Cloud Security → Container Scanning page. Authenticate with a CodeAnt API
      token (requires the `view_cloud_security: read` permission when token
      scoping is configured).
  - name: Security Hotlist
    description: >-
      The organization-wide security Hotlist: every SCA, SAST, secrets, IaC,
      cloud (CSPM) and AI-exploitation finding, deduplicated and priority-scored
      into one ranked list with live ticket, assignee and SLA state. Query it
      with filters, facets and cursor pagination, or export the full filtered
      list as an Excel workbook. Authenticate with a CodeAnt API token (requires
      the `view_code_security: read` permission when token scoping is
      configured).
paths:
  /api/metrics/developer/teams/create:
    post:
      tags:
        - Developer Metrics - Teams
      summary: Create Team
      description: >-
        Creates a new developer team. Teams can be organized around
        **developers** (by adding members), **repositories** (by assigning
        repos), or **both**. You can also create empty teams and add
        members/repos later via the update and member endpoints.


        Use cases:

        - **Developer-based team**: Pass `members` to group developers (e.g. a
        frontend squad). You can optionally pass `repositories` as a filter to
        scope metrics to specific repos for this team.

        - **Repository-based team**: Pass only `repositories` to group repos
        (e.g. all microservices). No members - metrics are aggregated across the
        listed repos.

        - **Mixed team**: Pass both `members` and `repositories` - metrics are
        scoped to these members across these repos.

        - **Disabled lists**: Create special teams named
        `codeant-disabled-members` or `codeant-disabled-repos` to exclude
        specific developers or repositories from all metrics calculations across
        the organization.


        Optionally assign one or more `team_leads` (by login) and categorize
        teams with `tags`. Teams can be nested using `parent_team_id`.
      operationId: createTeam
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTeamRequest'
            examples:
              github:
                summary: GitHub - developer-based team
                value:
                  platform: github
                  org: my-org
                  name: Backend Squad
                  description: Backend API developers
                  members:
                    - user_login: jane@example.com
                      user_name: Jane Doe
                      role: lead
                    - user_login: john@example.com
                      user_name: John Smith
                      role: member
                  team_leads:
                    - jane@example.com
              gitlab:
                summary: GitLab - repository-based team
                value:
                  platform: gitlab
                  org: my-group
                  name: Microservices
                  description: All microservice repositories
                  repositories:
                    - my-group/auth-service
                    - my-group/payment-service
                    - my-group/user-service
              bitbucket:
                summary: Bitbucket - mixed team (members + repos)
                value:
                  platform: bitbucket
                  org: my-workspace
                  name: Platform Team
                  description: Platform engineering team and their repos
                  members:
                    - user_login: alice@example.com
                      user_name: Alice
                      role: lead
                  repositories:
                    - my-workspace/infra
                    - my-workspace/ci-tools
                  tags:
                    - platform
                    - infra
              azure_devops:
                summary: Azure DevOps - empty team (add members later)
                value:
                  platform: azure_devops
                  org: my-org
                  name: New Project Team
                  description: Team for the upcoming project
      responses:
        '201':
          description: Team created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: success
                  message:
                    type: string
                    example: Team created successfully
                  team:
                    $ref: '#/components/schemas/Team'
        '400':
          description: Bad request - missing or invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DevMetricsErrorResponse'
              example:
                error: 'Missing required parameters: platform, org'
        '401':
          description: Unauthorized - missing, invalid, or insufficient access token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DevMetricsErrorResponse'
              examples:
                missing_token:
                  summary: Missing Authorization header
                  value:
                    error: Missing Authorization header. Use 'Bearer <access_token>'
                invalid_token:
                  summary: Invalid or insufficient token
                  value:
                    error: >-
                      Access token invalid or does not have access to this
                      organization
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DevMetricsStatusResponse'
              example:
                status: error
                message: Internal server error
      security:
        - BearerAuth: []
components:
  schemas:
    CreateTeamRequest:
      allOf:
        - $ref: '#/components/schemas/DevMetricsBaseRequest'
        - type: object
          required:
            - name
          properties:
            name:
              type: string
              minLength: 2
              description: Team name (min 2 characters)
              example: Backend Team
            description:
              type: string
              description: Team description
              example: Responsible for API services
            color:
              type: string
              description: Hex color code
              example: '#1570EF'
            team_leads:
              type: array
              items:
                type: string
              example:
                - lead@example.com
            repositories:
              type: array
              items:
                type: string
              example:
                - my-org/backend-api
            members:
              type: array
              description: >-
                Initial team members to add at creation. You can create a team
                with members, repositories, or both.
              items:
                type: object
                required:
                  - user_login
                properties:
                  user_login:
                    type: string
                    description: Unique login or email of the developer
                    example: jane@example.com
                  user_name:
                    type: string
                    description: Display name (defaults to user_login if omitted)
                    example: Jane Doe
                  role:
                    type: string
                    enum:
                      - member
                      - lead
                    default: member
                    description: Role within the team
              example:
                - user_login: jane@example.com
                  user_name: Jane Doe
                  role: lead
                - user_login: john@example.com
                  user_name: John Smith
                  role: member
            tags:
              type: array
              items:
                type: string
              description: Tags for categorizing the team
              example:
                - backend
                - api
            parent_team_id:
              type: string
              format: uuid
              description: Parent team ID for creating nested/sub-teams
              example: ''
            created_by:
              type: string
              description: Identifier of who created the team
              default: system
              example: admin@example.com
    Team:
      type: object
      description: A developer team with members, metadata, and repository assignments
      properties:
        id:
          type: string
          format: uuid
          description: Unique team identifier
        name:
          type: string
          description: Team name
          example: Backend Team
        description:
          type: string
          description: Team description
          example: Responsible for API services
        color:
          type: string
          description: Hex color for UI display
          example: '#1570EF'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        created_by:
          type: string
        team_leads:
          type: array
          items:
            type: string
          description: List of team lead identifiers
        members:
          type: array
          items:
            $ref: '#/components/schemas/TeamMember'
        tags:
          type: array
          items:
            type: string
        parent_team_id:
          type: string
          description: Parent team ID for nested teams
        repositories:
          type: array
          items:
            type: string
          description: Assigned repository names
          example:
            - my-org/backend-api
        is_active:
          type: boolean
          description: Whether the team is active
    DevMetricsErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Error message
    DevMetricsStatusResponse:
      type: object
      properties:
        status:
          type: string
          enum:
            - success
            - error
        message:
          type: string
          description: Human-readable status message
    DevMetricsBaseRequest:
      type: object
      required:
        - platform
        - org
      properties:
        platform:
          type: string
          description: Version control platform
          enum:
            - github
            - gitlab
            - bitbucket
            - azure_devops
            - azuredevops
          example: github
        org:
          type: string
          description: Organization, workspace, or group name on the platform
          example: my-org
        github_base_url:
          type: string
          description: Base URL for GitHub (use for GitHub Enterprise Server)
          default: https://github.com
          example: https://github.com
        gitlab_base_url:
          type: string
          description: Base URL for GitLab (use for self-hosted GitLab instances)
          default: https://gitlab.com
          example: https://gitlab.com
        azure_devops_base_url:
          type: string
          description: Base URL for Azure DevOps (use for Azure DevOps Server)
          default: https://dev.azure.com
          example: https://dev.azure.com
        bitbucket_base_url:
          type: string
          description: Base URL for Bitbucket (use for Bitbucket Data Center/Server)
          default: https://api.bitbucket.org/2.0
          example: https://api.bitbucket.org/2.0
    TeamMember:
      type: object
      description: A member of a team
      properties:
        user_login:
          type: string
          description: Unique login/email identifier of the member
          example: jane@example.com
        user_name:
          type: string
          description: Display name of the member
          example: Jane Doe
        joined_at:
          type: string
          format: date-time
          description: When the member joined the team
        role:
          type: string
          enum:
            - member
            - lead
          description: Role within the team
          example: member
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        CodeAnt API token (`cdt_...`), created on the Settings → API Tokens
        page. Pass via `Authorization: Bearer <token>` header.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.