Quickstart
To complete this excercise, you will need to be part of an organization that is an active Opkit customer. If this does not describe you, please reach out to Opkit sales.
This quickstart is designed to help get your local development environment setup and send your first API request. If you are an experienced developer or want to just dive into using the Opkit API, we recommend heading straight our API reference. During this quickstart, you will learn:
- How to setup your development environment
- How to create an API key
- Some of the basic concepts of the Opkit API
- How to send your first API request
If you run into any challenges or have questions getting started, please contact Opkit support.
Steps
Step 1: Install curl
Curl is a popular command line tool used by developers to send HTTP requests.
Many operating systems include curl by default. You can check if you have
curl installed by opening your terminal application and running the
following command: curl https://google.com
. If curl is set up and you are
connected to the Internet, this command will send an HTTP request to fetch
the contents of “google.com”. If you get a “curl not found” error, it means
curl is not installed on your machine; you can install it by following the
instructions on the curl homepage.
Step 2: Create an API Key
After installing curl, you should locate an Opkit API key. If your organization has not already provided you with one, you will need to create it. For security reasons, Opkit doesn’t allow users to do this manually. Instead, they must reach out to an Opkit team member. Please send an email to support@opkit.co with the subject line “API Key”. Make sure to send this email from the account associated with the Opkit customer organization. (Don’t send it from your personal Gmail address!) Our team will respond with a new API key that is valid for your organization. Copy this value some where safe. Don’t lose it or expose it to the public!
Step 3: Set the OPKIT_API_KEY Environment Variable
Once you have an API key, you should set this value to the OPKIT_API_KEY
environment
variable in your terminal application. This ensures that it is always available when you
start a new terminal session. The instructions for completing this step vary based on
your operating system:
MacOS:
- Open the Terminal application.
- Open your shell profile in a text editor. Use the command
open ~/.bash_profile
oropen ~/.zshrc
(for newer MacOS versions). Windows: - Add the
OPKIT_API_KEY
enviornment variable to your shell profile by inserting the line below. Make sure to replace<YOUR-API-KEY>
with the value of your actual API key:
- Safe the file and exit the text editor.
- Reload your shell profile in the current terminal session. Use the command
source ~/.bash_profile
orsource ~/.zshrc
(for newer MacOS versions). - Verify the environment variable is present by running the following command:
echo $OPKIT_API_KEY
. It should output your API key.
Windows:
- Open the Command Prompt application. You can find it by searching “cmd” in the start menu.
- Set environment variable in the current session by running the command below. Make sure to replace
<YOUR-API-KEY>
with the value of your actual API key:
- Verify the environment variable is present by running the following command:
echo %OPKIT_API_KEY%
. It should output your API key.
Step 4: Send an API Request
Finally, it’s time to send an API request!
Let’s start with a simple request to one of Opkit’s “list” endpoints: GET /targets
.
(A target is a resource that represents a unique phone number that can be
contacted through the Opkit platform.) Run the following command in your terminal application:
If the request succeeded, you should see a JSON response object containing target resources in your terminal output. If you do not see this, make sure you completed the steps above correctly and refer to our documentation on errors. If after doing these things you are still experiencing problems, contact Opkit support.
Next Steps
Now that you’ve sent your first few API request, it’s time to explore what else is possible. We recommend heading over to the API reference, where you can see a complete list of resources, endpoints, and operations.