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
If you run into any issues or have questions, join our Developers Community to find answers or raise your questions.

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
Java
Node.js

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:

Copy
Copied
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

  1. Open Terminal: You can search for terminal through Spotlight Search or find it in the Applications folder.
  2. Edit bash profile: To open the profile file in a text editor, enter the command nano ~/.bash_profile or nano ~/.zshrc (for newer MacOS versions).
  3. 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 and your-client-secret with your client secret:
    Copy
    Copied
    export ZUORA_CLIENT_ID='your-client-id'
    export ZUORA_CLIENT_SECRET='your-client-secret'
  4. Save the changes: To save the changes, press Ctrl + O. At the filename prompt, press Enter, then press Control + X to exit the editor.
  5. Load the updated profile: Use the command source ~/.bash_profile or source ~/.zshrc to load the updated profile.
  6. Setup verification: Verify the setup by entering echo $ZUORA_CLIENT_ID in the Terminal. It should display your client ID. Enter echo $ZUORA_CLIENT_SECRET in the Terminal and it should display your client secret.
  7. Create a bearer token: Send a request to Create an OAuth token to generate an OAuth bearer token.
    Copy
    Copied
    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

    Copy
    Copied
    {
        "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

  1. Open Command Prompt: You can find it by searching cmd in the Start menu.
  2. 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 replace your-client-id with your client ID:
      Copy
      Copied
      setx ZUORA_CLIENT_ID "your-client-id"
      To set the ZUORA_CLIENT_SECRET environment variable in the current session, use the following command and replace your-client-secret with your client secret:
      Copy
      Copied
      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:
      1. Right-click the This PC or My Computer option, and select Properties.
      2. Click Advanced system settings.
      3. Click the Environment Variables button.
      4. In the System variables section, click New..., and enter ZUORA_CLIENT_ID as the variable name and your client ID as the variable value.
      5. In the System variables section, click New..., and enter ZUORA_CLIENT_SECRET as the variable name and your client secret as the variable value.
  3. Setup verification: Reopen the Command Prompt and enter the following command. It should display your client ID and secret:
    Copy
    Copied
    echo %ZUORA_CLIENT_ID%
    echo %ZUORA_CLIENT_SECRET%
  4. Create a bearer token: Send a request to Create an OAuth token to generate an OAuth bearer token.
    Copy
    Copied
    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

    Copy
    Copied
    {
        "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 replace your-bearer-token with the bearer token you generated in Step 2.
Copy
Copied
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.