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

# Create a team

> Creates a team and optionally assigns members, explicit projects, project-tag selectors, and repository URL fragment selectors. Requires the `user_management.change_content_access` permission.



## OpenAPI

````yaml /api-reference/openapi.json post /teams
openapi: 3.0.0
info:
  title: Corgea API
  version: 1.0.0
  description: >-
    API for interacting with Corgea's scanning and vulnerability management
    features
servers:
  - url: https://www.corgea.app/api/v1
    description: Production server
security:
  - CorgeaToken: []
  - BearerAuth: []
paths:
  /teams:
    post:
      tags:
        - Teams
      summary: Create a team
      description: >-
        Creates a team and optionally assigns members, explicit projects,
        project-tag selectors, and repository URL fragment selectors. Requires
        the `user_management.change_content_access` permission.
      operationId: createTeam
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTeamRequest'
      responses:
        '201':
          description: Team created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TeamResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: One or more users or projects were not found
        '409':
          description: A team with this name already exists
components:
  schemas:
    CreateTeamRequest:
      type: object
      required:
        - name
      additionalProperties: false
      properties:
        name:
          type: string
        member_ids:
          type: array
          items:
            type: integer
        project_ids:
          type: array
          description: Project IDs to assign explicitly.
          items:
            type: integer
        project_tags:
          type: array
          description: Tags that dynamically grant access to matching projects.
          items:
            type: string
        repo_url_patterns:
          type: array
          description: >-
            Repository URL fragments that dynamically grant access to matching
            projects.
          items:
            type: string
            minLength: 3
      example:
        name: Payments Team
        member_ids:
          - 12
          - 34
        project_ids:
          - 101
        project_tags:
          - payments
          - backend
        repo_url_patterns:
          - github.com/acme/payments-
    TeamResponse:
      type: object
      required:
        - team
      properties:
        team:
          $ref: '#/components/schemas/Team'
    Team:
      type: object
      required:
        - id
        - name
        - active
        - members
        - project_ids
        - project_tags
        - repo_url_patterns
        - project_count
        - created_at
        - updated_at
      properties:
        id:
          type: integer
        name:
          type: string
        active:
          type: boolean
        members:
          type: array
          items:
            $ref: '#/components/schemas/TeamMember'
        project_ids:
          type: array
          description: Projects assigned explicitly to the team.
          items:
            type: integer
        project_tags:
          type: array
          description: A project matches when it contains any listed tag.
          items:
            type: string
        repo_url_patterns:
          type: array
          description: >-
            A project matches when its repository URL contains any listed
            fragment, case-insensitively.
          items:
            type: string
            minLength: 3
        project_count:
          type: integer
          description: >-
            Distinct projects currently resolved through explicit assignment or
            selectors.
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    TeamMember:
      type: object
      required:
        - id
        - email
        - first_name
        - last_name
      properties:
        id:
          type: integer
        email:
          type: string
          format: email
        first_name:
          type: string
        last_name:
          type: string
  responses:
    BadRequest:
      description: Invalid request
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: Invalid JSON body
    Unauthorized:
      description: Invalid or missing token
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: Missing or invalid authorization header
    Forbidden:
      description: Permission denied or feature unavailable
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: Permission denied
  securitySchemes:
    CorgeaToken:
      type: apiKey
      in: header
      name: CORGEA-TOKEN
      description: API key for authentication
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: OAuth2 access token (JWT) in the Authorization header

````