# Creating and using the import file

## How the import file works

This feature only works with Bitbucket and Azure.

When the `snyk-scm-contributors-count` tool connects both to your Snyk account and your SCM account, the tools finds out which repos/projects are monitored by Snyk and which are not.

When you apply the `importConfDir` and `importFileRepoType` flags to the command, the tool generates an import file populated with the unmonitored repo data, to be used with the [**snyk-api-import** ](#using-the-snyk-api-import-tool)tool to import the missing repos to your Snyk account.

* If the Snyk token was exported and the related Snyk account has an integration set for the specific SCM that is being scanned by the tool, the tool will try to find and match the OrgID and IntegrationID from Snyk as needed by the `snyk-api-import` tool and automatically add it to the import file.
* If a Snyk token was not exported or the user has no Snyk account yet, this feature can be used to map all repos in the SCM and create the import file to be later used by the `snyk-api-import` tool. In this case or if the tool can not find an OrgID or IntegrationID, the tool prompts the user to supply these IDs (once) and automatically adds them to the import file.

## The import flags

`importConfDir` - This flag indicates that a query for unmonitored repos should be made and expects a path to a folder (with write privileges) in which to create the json import files, for example :

```
snyk-scm-contributors-count <command> --token TOKEN -- importConfDir /snyk/import/
```

By default, this command populates the json import files with all types of unmonitored repos found when scanning the SCM.

`importFileRepoType` - This flag can be set with the values of `all,` `private`, or `public` (case **insensitive**) to fill the import file with only data from the given repo type, for example:

```
snyk-scm-contributors-count <command> --token TOKEN -- importConfDir /snyk/import/ --importFileRepoType 'private'
```

{% hint style="info" %}
The import file requires an OrgID and IntegrationID from the user in order to import them to the right organization and integration at Snyk.

The tool will try to find these two values from Snyk (provided that a SNYK\_TOKEN was exported and that the org mapping at Snyk is mirrored to that of the SCM) and if the tool can not find those values, the user will be prompted to supply them in the command line.

Once the user has stated the values for OrgID and IntegrationID once, these values will be set for ALL the entries in the import file (meaning that all the imported repos will be under the same org in Snyk).
{% endhint %}

## Using the snyk-api-import tool

The snyk-api-import tool helps users import new repos in their Snyk account in a secure and robust way.

This tool requires a json file with the repos data to be imported. This file can be auto-generated by the **snyk-contributors-count** tool as described in the preceding sections.

## More information

For more information about the **snyk-api-import** tool see:

* <https://github.com/snyk/snyk-api-import>
* <https://github.com/snyk/snyk-api-import/blob/master/docs/import.md>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.snyk.io/developer-tools/snyk-cli/scan-and-maintain-projects-using-the-cli/cli-tools/snyk-scm-contributors-count/creating-and-using-the-import-file.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
