Before getting started, it’s important to note that API access is only available on Professional, Enterprise, Performance, Unlimited, and Developer Edition orgs. It is enabled by default on Enterprise, Performance, Unlimited, and Developer Edition orgs — for Professional Edition orgs, you will need to add API access as an add-on. If your Salesforce org falls outside of the mentioned editions, you will not be able to create an Access Token or use Salesforce API.
API access allows you to interact with your Salesforce org through an Access Token. To create an Access Token, you need to use an admin account with access and management rights to your Salesforce org. If you already have such an admin account, follow the steps below to generate an Access Token:
Generate Salesforce Access Token
- Install Salesforce CLI on your computer. Salesforce CLI is an official software provided by Salesforce, allowing you to interact with your Salesforce Org through a command line (terminal on macOS and Linux, or command prompt on Windows). Follow these instructions to download and install it on your computer: Download and install Salesforce CLI.
- Once Salesforce CLI is installed, open the command line and enter the following command:
sf org login web
A web browser window will open to the page https://login.salesforce.com.
- On the web page, log in to your Salesforce Org with your admin account.
- After logging in, click Allow to grant access. Then switch back to the command line window, and you’ll see a confirmation message similar to the one below:
Successfully authorized [email protected] with org ID 00D2x00004ux64EA
- In the command line window, enter the following command structure to retrieve the Access Token:
sf org display --target-org <username>
Here,
<username>
is the email/username you use to log in to your Salesforce Org. For example:sf org display --target-org [email protected]
- After running the above command, you’ll receive a message similar to the one below:
=== Org Description
KEY VALUE
───────────────── ────────────────
Access Token 00D2x00AQAV9lgu.AgQiTgsBY8v1DjA_9bct6Ew4JYH
Api Version 60.0
Client Id PlatformCLI
Connected Status Connected
Id 00D2x00004ux64EA
Instance Url https://petshop.my.salesforce.com
Username [email protected]Make a note of the Access Token and Instance Url. You’ll need to input them into the migration tool to start the migration process.
*Note: The generated Access Token will expire after a certain period of time. When this happens, simply repeat steps 2 through 6 to obtain a new Access Token.