Get Started
Use this content as a guide to set up your local development environment and send your first API request. If you want to start using the API immediately, the Quickstart API reference is a great place to start. This content will guide you through:
- How to set up your development environment
- How to install the latest client libraries
- Some basic concepts
- How to send your first API request
Tenant setup
If you do not already have a Zuora tenant, sign up for a free trial.
Role setup
First, sign in as an administrator. Next, from the Administration Settings page, click Manage User Roles and Add New Role. Give the role a name and check API write access.
User setup
From the Administration Settings page, click manage users and add single user, select the role you created in the previous section and click save. An activation email will be sent to the work email address you specified. Click the link in the email and set a password to activate the user.
Client setup
From the Administration Settings page, click all users, locate the user you created in the previous section, confirm the user is active and click the name of the user. Give the client a name and click create. Finally, note down the client ID and client secret displayed and click OK.
Getting started language selection
Select tool or language you want to use to get started.
cURL is a popular command-line tool for transferring data using network protocols like HTTP and HTTPS. It requires minimal setup but is less capable than fully-featured programming languages like Java or JavaScript. With cURL installed, you can enter the cURL commands in the Terminal or Command Prompt and see the response immediately.
Step 1. Set up cURL
cURL is pre-installed on some operating systems by default, for example, MacOS. Check whether you have cURL installed by opening your Terminal or command line interface by entering the command:
curl https://developer.zuora.com/quickstart-api/getting-started/ --compressed
With cURL set up this will send an HTTP request to fetch the contents of "developer.zuora.com/quickstart-api/getting-started/".
If you see an error indicating that cURL is not found, you should install it by following the instructions on the Install curl and libcurl.Step 2: Set up authentication credentials
After you confirm that cURL is installed, you can set up your credentials in your Terminal or Command Prompt.
MacOS
- Open Terminal: You can search for
terminal
through Spotlight Search or find it in the Applications folder. - Edit bash profile: To open the profile file in a text editor, enter the command
nano ~/.bash_profile
ornano ~/.zshrc
(for newer MacOS versions). - Add your client credentials as environment variables: In the editor, add the following lines to the profile file, replacing
your-client-id
with your client ID andyour-client-secret
with your client secret:export ZUORA_CLIENT_ID='your-client-id' export ZUORA_CLIENT_SECRET='your-client-secret'
- Save the changes: To save the changes, press
Ctrl
+O
. At the filename prompt, pressEnter
, then pressControl
+X
to exit the editor. - Load the updated profile: Use the command
source ~/.bash_profile
orsource ~/.zshrc
to load the updated profile. - Setup verification: Verify the setup by entering
echo $ZUORA_CLIENT_ID
in the Terminal. It should display your client ID. Enterecho $ZUORA_CLIENT_SECRET
in the Terminal and it should display your client secret. - Create a bearer token: Send a request to Create an OAuth token to generate an OAuth bearer token.
curl --request POST \ --url https://rest.test.zuora.com/oauth/token \ --header 'Accept: application/json' \ --header 'Content-type: application/x-www-form-urlencoded' \ --data client_id=$ZUORA_CLIENT_ID \ --data-urlencode client_secret=$ZUORA_CLIENT_SECRET \ --data grant_type=client_credentials
Response body
{ "access_token": "6447d349d8854f0d8d5535484b0b862b", "token_type": "bearer", "expires_in": 3598, "scope": "entity.11e643f4-a3ee-8bad-b061-0025904c57d6 platform.write service.genesis.read service.genesis.write service.usage.delete service.usage.update service.usage.write tenant.12270 user.2c92c0f86680fd7777777ad86e455692", "jti": "6447d34955555f0d8d5535484b0b862b" }
Each bearer token is valid for an hour. When it expires, repeat this step again.
Windows
- Open Command Prompt: You can find it by searching
cmd
in the Start menu. - Configure environment variable, in the current session or permanently.
- Set environment variables in the current session: To set the
ZUORA_CLIENT_ID
environment variable in the current session, use the following command and replaceyour-client-id
with your client ID:To set thesetx ZUORA_CLIENT_ID "your-client-id"
ZUORA_CLIENT_SECRET
environment variable in the current session, use the following command and replaceyour-client-secret
with your client secret:setx ZUORA_CLIENT_SECRET "your-client-secret"
- Permanent setup: Alternative to setting variables for the session, you can make the setup permanent by adding your client credentials as system properties:
- Right-click the This PC or My Computer option, and select Properties.
- Click Advanced system settings.
- Click the Environment Variables button.
- In the System variables section, click New..., and enter
ZUORA_CLIENT_ID
as the variable name and your client ID as the variable value. - In the System variables section, click New..., and enter
ZUORA_CLIENT_SECRET
as the variable name and your client secret as the variable value.
- Set environment variables in the current session: To set the
- Setup verification: Reopen the Command Prompt and enter the following command. It should display your client ID and secret:
echo %ZUORA_CLIENT_ID% echo %ZUORA_CLIENT_SECRET%
- Create a bearer token: Send a request to Create an OAuth token to generate an OAuth bearer token.
curl --request POST \ --url https://rest.test.zuora.com/oauth/token \ --header 'Accept: application/json' \ --header 'Content-type: application/x-www-form-urlencoded' \ --data client_id=$ZUORA_CLIENT_ID \ --data-urlencode client_secret=$ZUORA_CLIENT_SECRET \ --data grant_type=client_credentials
Response body
{ "access_token": "6447d349d8854f0d8d5535484b0b862b", "token_type": "bearer", "expires_in": 3598, "scope": "entity.11e643f4-a3ee-8bad-b061-0025904c57d6 platform.write service.genesis.read service.genesis.write service.usage.delete service.usage.update service.usage.write tenant.12270 user.2c92c0f86680fd7777777ad86e455692", "jti": "6447d34955555f0d8d5535484b0b862b" }
Each bearer token is valid for an hour. When it expires, you just repeat this step again.
Step 3. Make your first API request
Now, you can send your first API request. A sample cURL request to create an account is provided below. Note that you should replaceyour-bearer-token
with the bearer token you generated in Step 2.curl --request POST \
--url 'https://rest.test.zuora.com/v2/accounts' \
--header 'Authorization: Bearer your-bearer-token' \
--header 'Content-Type: application/json' \
--data '{
"name": "Amy Lawrence’s account",
"bill_to": {
"first_name": "Amy",
"last_name": "Lawrence",
"address": {
"country": "USA",
"state": "CA"
}
},
"currency": "USD"
}'
You will receive an Account object with account details if the request succeeds.
Step 4. Verify the result
After the account is created, you can verify the result in the Zuora UI or through the GET API operations for the Account object.
- To verify the result through the Zuora UI, you can find the created account displayed at the top of the All Customer Accounts page by navigating to Customers > Customer Accounts.
- To verify the result through the Quickstart API, you can use one of the following operations:
Next steps
You can then proceed to create products. See Tutorials for instructions.