data-src=../../../../../includes/commerce-only.md

createCompanyTeam mutation

Use the createCompanyTeam mutation to create a new team for your company.

The target_id input attribute allows you to specify which node in the company structure will be the parent node of the company team. If you do not specify a value, the team will be assigned to the top-level (root) node of the company structure.

You can get the target_id with the company query.

This mutation requires a valid customer authentication token.

Syntax

mutation {
    createCompanyTeam(
        input: CompanyTeamCreateInput!
    ) {
        CreateCompanyTeamOutput
    }
}

Reference

The createCompanyTeam reference provides detailed information about the types and fields defined in this mutation.

Example usage

The following example shows the minimal payload for adding a new team to a customer's company.

Request:

mutation {
  createCompanyTeam(
    input: {
      name: "Test Team"
    }
  ) {
    team {
      id
      name
      description
    }
  }
}

Response:

{
  "data": {
    "createCompanyTeam": {
      "team": {
        "id": "MQ==",
        "name": "Test Team",
        "description": null
      }
    }
  }
}

This example creates a child team of the parent team specified in the target_id field.

Request:

mutation {
  createCompanyTeam(
    input: {
      name: "Test Child Team"
      description: "Test Child Team description"
      target_id: "MQ=="
    }
  ) {
    team {
      id
      name
      description
    }
  }
}

Response:

{
  "data": {
    "createCompanyTeam": {
      "team": {
        "id": "Mg==",
        "name": "Test Child Team",
        "description": "Test Child Team description"
      }
    }
  }
}
data-slots=text
data-backgroundcolor=gray
Thanks to Atwix for contributing this topic!