> For the complete documentation index, see [llms.txt](https://docs.datasaur.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.datasaur.ai/integrations/robosaur/commands/apply-project-tags.md).

# Apply Project Tags

## How it works

```bash
$ npm run start -- apply-tags -h
Usage: robosaur apply-tags [options] <configFile>

Applies tags to projects based on the given config file

Options:
  -h, --help  display help for command
```

* Robosaur applies tags to projects based on the configuration file, or from a separate CSV file. The CSV file can be stored in your local drive or one of our supported cloud object storage.
* If a tag does not already exist in the team, Robosaur automatically creates it before applying it to the project.
* The behavior is controlled through the `applyTags` configuration.

## Payload

### JSON format

```json
{
  ...
  "applyTags": {
    "teamId": "<TEAM_ID>",
    "source": "inline",
    "payload": [
      {
        "projectId": "<PROJECT_ID_1>",
        "tags": ["<TAG_1>", "<TAG_2>"]
      },
      {
        "projectId": "<PROJECT_ID_2>",
        "tags": ["<TAG_3>"]
      }
    ]
  }
  ...
}
```

### CSV format

CSV files are supported for all storage methods. If multiple tags are specified in the `tags` column, Robosaur applies all tags to the project. Use a comma (`,`) to separate multiple tags.

Example:

```
tags,projectId
"<TAG_1>,<TAG_4>",<PROJECT_ID_1>
<TAG_2>,<PROJECT_ID_1>
<TAG_3>,<PROJECT_ID_2>
```

## Object storage

The `applyTags` source supports inline, local filesystem, and cloud object storage. For more details, refer to [Storage Options](/integrations/robosaur/storage-options.md).

### Local file example

```json
{
  ...
  "applyTags": {
    "teamId": "<TEAM_ID>",
    "source": "local",
    "path": "<path/to/csv/file>"
  }
  ...
}
```

### Cloud object storage example

```json
{
  ...
  "credentials": {
    ...
  },
  "applyTags": {
    "teamId": "<TEAM_ID>",
    "source": "s3 | gcs | azure",
    "bucketName": "<BUCKET_NAME>",
    "path": "<path/to/csv/file/on/bucket>",
  }
  ...
}
```
