Import Users from a CSV
To add users in bulk, you can use the following methods with a comma-separated value (CSV) list:
Import Users With a Self-Serve Ruby Script
You can use the following Ruby script to import users on your own:
You need the following:
- A general access REST API key.
- The email address of the user making the change.
- The path to your CSV file as a command-line argument. The CSV file can have any name, however the path to the file must be correct.
Example
ruby import_users.rb -a tKvs3QDNi84Nl326Krdz -e [email protected] -f ./users.csvYou can find the usage instructions for the tool by executing the script with a -h or --help flag:
import_users.rb -h
Usage: import_users.rb [options]
-a, --access-token [String] Access Token
-e, --requester-email [String] Requester Email
-f, --csv-path [String] Path to CSV fileCSV Format
The CSV file should be in the following format:
name,email,role,title,country code,phone number,team 1;team 2;team 3
- There is no need to include a header in the file, and the title and Teams fields are optional. If the user is on multiple Teams, separate each Team with a semicolon.
- The script creates SMS, phone call, and email notification rules using the email address and phone number provided. The notification rules notify users immediately when they are assigned to an incident, however users can adjust these settings later on their User Profile.
- The user's role can be
admin,user,limited_user,observer,restricted_access,read_only_user(Full Stakeholder), orread_only_limited_user(Limited Stakeholder). If a role is not specified, the script defaults touser. To see how these values map to values on the webpage, refer to our section on Roles in the REST API and SAML. You can find additional information on user roles and permissions in the following articles:
Example
Joe User,[email protected],user,Operations Engineer,1,5555555555,Engineering;Operations
Bob Dobbs,[email protected],admin,Director of Engineering,86,15555555554,Engineering;Operations;LeadershipRequest Help From PagerDuty Support
Required RoleOnly the Account Owner can request user import assistance from Support.
If you do not have the Account Owner base role, you can find your Account Owner by navigating to People Users and setting the Base roles filter to Account Owner.
To add 25 or more users, the Account Owner of your PagerDuty account can request that PagerDuty Support creates a write-scoped API Key in your account to import the users for you.
Create a spreadsheet with the following columns, in this order:
| Name | Role | Title | Country Code | Phone Number | Teams | Team Role |
|---|
The following spreadsheet templates are available for your use:
After populating a spreadsheet in this format, export it as a spreadsheet file (e.g., .CSV, .XLSX, .NUMBERS) and have the Account Owner contact our Support Team to request help importing the users.
Field Details
| Field | Description |
|---|---|
| Name (Required) | First and last name. |
| Email (Required) | Login email address; must be unique to this user. |
| Role (Required) | A valid REST API user role (admin, user, limited_user, observer, restricted_access, read_only_user, read_only_limited_user). The read_only_user and read_only_limited_user roles require Stakeholder user licenses. Read Billing, Invoices and Payments for more information about Stakeholder users. |
| Title | Job title. |
| Country Code | 1-3 digit country calling code. Refer to Supported Countries for more information about valid country codes. |
| Phone Number | The user's phone number where they will receive SMS and phone call notifications. |
| Teams | Teams that the user should be added to. This can include multiple Teams separated by semicolons (;). If the Team does not exist, it will be created when the script runs. |
| Team Role | User role that will be applied to the given Teams. Must be a valid Team role (i.e., Responder, Observer, Manager). |
