Admin Portal Guide

Red Hat 3scale 2-saas

Manage aspects related to Red Hat 3scale.

Red Hat Customer Content Services


This guide provides the information to manage Red Hat 3scale.


This guide will help you to use the available functions in the Admin Portal to manage your 3scale installation.

Part I. Account settings

Chapter 1. Account configuration

After creating your account, update basic information about your company. Set your location and add your contact information.

The account view is only visible to administrators, not to members.

1.1. Add your company information

Once you have created your new account, add you company information with these steps:

  1. Click the gear icon located in the right of the top navigation bar. You will see the Overview window.
  2. Next to the Account Details heading, click the Edit link.
  3. Fill in the information for your account.

The address you specify here has two goals:

  • If you are on a paid plan, we use this address for billing purposes.
  • If you use the billing and payment modules, this address is also what your user will see on your invoices.

1.2. Select your preferred time zone

On the same page you can also select the time zone you will use on all system displays. This setting affects analytics graphs. However, billing cycle calculations are made according to UTC time.

Chapter 2. Red Hat Single Sign On for the 3scale Admin Portal

This guide provides information about how to configure and use Red Hat Single Sign On (RH-SSO) with the 3scale Admin Portal.

2.1. Enable RH-SSO or Auth0 member authentication

3scale supports single sign-on (SS0) authentication for your members and administrators.

The 3scale Admin Portal supports the following SSO providers, each which support a number of identity brokering and member federation options:


You can enable multiple SSO member authentication types

Only users that have been added to RH-SSO or Auth0 will be able to access your 3scale Admin Portal through SSO. If you want to further restrict the access by either roles or user groups you should refer to the corresponding step by step tutorials on the RH-SSO or Auth0 support portals.

Once you have established SSO through your chosen provider, you must configure it and enable it on the 3scale Admin Portal.

2.1.1. RH SSO prerequisites

2.1.2. Auth0 prerequisites

  • An Auth0 Subscription and account

2.1.3. Enable RH-SSO

As an administrator, perform the following steps in the 3scale Admin Portal to enable RH-SSO or Auth0:

  1. Ensure your preferred SSO provider, highlighted in the prerequisites, has been properly configured
  2. Navigate to SSO Integrations in the Account Settings:

    • Click the gear icon in the upper right corner of the page
    • Navigate to Account Settings (gear icon) > Users > SSO Integrations, and click New SSO Integration.
  3. Select your SSO provider from the dropdown list
  4. Enter the required information, provided when you configured your SSO:

    • Client
    • Client Secret
    • Realm or Site
  5. Click Create Authentication Provider

If, during testing, you encounter a callback URL mismatch, add the callback URL shown in the error message to your Auth0 allowed callback URLs.

2.2. Using RH-SSO with 3scale

Once you have configured SSO, members can sign on using the account credentials in connected IdPs.

Follow these steps to log in to the 3scale Admin Portal using SSO:

  1. Navigate to your 3scale login page:

  2. Authorize 3scale with your IdP
  3. If necessary, complete sign up by entering any needed information

Once you successfully sign up, you will have a member account under the API provider organization, and you will be automatically logged in.

2.3. Redirecting a 3scale login to a RH-SSO option

This section describes the redirection to an Identity Provider (IdP) login window via RH-SSO. As a 3scale API Management administrator, complete these steps to have your 3scale account accessible through an optional single sign-on (SSO) login page.

2.3.1. Prerequisites

  • 3scale 2-saas
  • An RH-SSO instance and realm configured as described under the Configuring RH-SSO section of the Developer Portal documentation.

Before you can integrate RH-SSO with 3scale, you must have a working RH-SSO instance. Refer to the RH-SSO documentation for installation instructions: Installing RH-SSO 7.2.

2.3.2. Required steps

  1. Access and follow the instructions for setting up RH-SSO under the Red Hat Single Sign-On for the 3scale Admin Portal section of the 3scale documentation.
  2. Provide your RH-SSO administrator with your 3scale URL that will form the basis for a redirect within RH-SSO for your secure logon. Use the following URL format:

  3. <system_name> can be fetched via the SSO Integration detail page of the Admin Portal:

  4. keycloak_0123456aaaaa can also be found via the SSO Integration detail page in the Callback URL for OAuth flow test field, which looks like the following:


Chapter 3. Inviting users and managing rights


The invite feature is only available for Pro and Enterprise customers.

In order to share the workload of administering your APIs, you may wish to invite team members from your organization to access the 3scale Admin Portal. The instructions below describe how to give access rights to the 3scale Admin Portal, to one or more team members.

With users, we refer to the members of your team. The 3scale Admin Portal has two types of users:

  • Admins: Which have full access to all areas and services, and can invite other members (if your plan allows it).
  • Members: Which have limited access to areas of the product (e.g. Analytics, Developer Portal) and, if you are an enterprise customer, also to services.

3.2. Send an invitation

From the list of users, you can invite a new team member. To send the invitation:

  1. Click on the Invite user link, located on the upper-right side above the list.
  2. Enter the email address of the person you want to invite and click Send.
  3. As a confirmation of the sending, on the upper-right corner of the window you will see a message: Invitation was successfully sent..

An invitation email will be sent to the address you entered. If the email does not arrive, make sure it was not marked as spam in the recipient’s email account.

Additionally, you can find the list and status of sent invitations in Users > Invitations.

3.3. Accept the invitation

Your new administrator or member must click the link in the invitation email and complete the form to complete the process. Once the form is submitted, their account will be activated.

3.4. Give new users rights

There are two main type of rights you can give to members of your team:

  • By area: Such as analytics, billing, or developer administration.
  • By service: Choose which services to give access to members amongst all of your services. Note: This feature is only available for enterprise customers.

To give a new user rights, edit the new user by selecting them from the user menu and clicking on Edit. You have the following user roles:

  • Changing their rights to Admin will give them full access to control the Admin Portal.
  • Changing their rights to Member will give you the option of choosing which areas and services the team member has access to.

    • As Member, select an area to list all the available services related to said area.

Giving access to certain areas of the Admin Portal will give members access only to the equivalent API:

  • Developer accounts — Applications: Gives access to the Account management API
  • Analytics: Gives access to the Analytics API
  • Billing: Gives access to the Billing API
Rights by area and service

Chapter 4. Notifications

Notifications are sent to admins and members to make it easier to parse developer activity (new account

4.1. Types of notifications

There are different types of notifications:

  • Accounts
  • Billing
  • Applications
  • Service subscriptions
  • Usage alerts

4.2. Visibility

Admin users have access to all notifications.

Member users have access only to notifications of the areas they have been given access to. For example, a member will only have access to notifications related to billing if they have access to the billing section.

For enterprise accounts, member users will only have access to notifications regarding activity of the services they have been granted access to.

4.3. Subscribing to notifications by email

Subscriptions are personal and can only be modified by the person receiving those notifications. To edit your subscriptions:

  1. Navigate to Account Settings (gear icon in the navigation bar) > Personal > Notification Preferences.
  2. Select the notifications you would like to receive.
  3. Click Update Notification Preferences.

4.4. Web notifications

In addition to email notifications, you can find information about the last activities in your Dashboard:

Accounts dashboard

Chapter 5. Personal settings

In Personal settings you can edit your preferences as a team member. If you are an admin, you will also be able to edit the account preferences. For that, check out the account configuration tutorial.

To edit your personal settings:

  1. Click on the gear icon in the navigation bar.
  2. On the left panel, navigate to Personal. There are 3 types of settings you can edit from here:

    • Personal Details: Name, email, password, etc.
    • Tokens: Create access tokens to authenticate against the 3scale APIs – Billing, Account Management, and Analytics – and try them out using our ActiveDocs (interactive documentation). Learn more about 3scale tokens.
    • Notification Preferences: Select which notifications you’d like to receive. Note: If you are an enterprise customer, and if you are a member, these are filtered by area and service. This means you will only be able to subscribe to notifications regarding areas and services you have been given access to. More on notification preferences here.

Chapter 6. Tokens

This tutorial contains information about 3scale tokens: what are they, how they work, and how to create them.

3scale has two types of tokens: Access tokens (created by the user) and Service tokens (automatically created when you create a new service in 3scale).

6.1. Access tokens

Access tokens allow API provider admins and members to authenticate against the 3scale APIs – Billing, Account management, and Analytics – and try them out using our ActiveDocs (interactive documentation).

An access token may provide either read and write access, or read only.

An important thing to take into account is how access tokens work, which is according to the member’s rights. Admins can create tokens to authenticate against all three 3scale APIs. Members will be limited by their permissions to access the different parts of the Admin Portal. For example, if a member does not have access to the Billing area, they will not be able to create a token to authenticate against the Billing API.

6.2. Creating access tokens

Access tokens can be created on the tokens page. To create tokens, follow these steps:

  1. Click on the gear icon in the navigation bar.
  2. Navigate to Personal > Tokens.
  3. Click Add Access Token.
  4. Specify a name, select one or more scopes, and choose the permission for the token.
  5. To save the new token, click Create Access token.

Note that if you are a member, you might not see all the APIs – just the ones you have been given access to by the admin of your account.

You can create as many access tokens as you need. For security reasons, the tokens will not be stored on 3scale. When you create a new token, you will be alerted to save the token so you can then use it to make requests to the 3scale API.

If you lose a token, we recommend that you delete it – which will disable it and render it invalid – then create a new one.

6.3. Using access tokens

When using your access token to make calls to the 3scale APIs the results will be filtered by the services you have access to.

For example, when deploying APIcast self-managed, you’ll need an access token so your APIcast API gateway can pull the configuration of the service using the Account Management API.

The way it works is if your organization has set up three services on 3scale, and as a member, you have access to Service 1, but not 2 and 3, and you also have access to the Account Management API, when you create a token and make a request to the Account Management API you will only get the applications which are using Service 1.

Following the same example, if you have access to the Account Management API, but access to zero services, when making a call, you’ll get "access denied" error.

6.3.1. Service tokens

Service tokens are used to authenticate against 3scale Service Management API. Service tokens are generated automatically when a new service is created in 3scale, and are unique per service. They are shared among the users of the 3scale account.

You can find the service tokens for the services that the user has access to in the Admin Portal’s Dashboard: Account Settings (gear icon) > Personal > Tokens.

Part II. Access control

Chapter 7. Defining your API (Methods And Metrics)

You can define your API by adding methods and metrics at both the API product and backend levels. An API product is a bundle of one or more API backends. At the product level, methods and metrics enable you to set limits and pricing rules for any of the product’s application plans. At the backend level, methods and metrics can be used to set the limits and pricing rules of the application plan of any product that bundles the backend.

Metrics are suitable to track the usage of your API, both at product and backend levels. Hits is the built-in metric that exists in each API and is used to track the hits made to your API. You can achieve finer granularity for the API usage tracking by defining Methods under the Hits metric. Reporting traffic to a method automatically increases counters for the method and for the Hits metric. You can define separate methods for each endpoint of your API backend, or a combination of endpoint and HTTP method. See the Mapping rules section to learn how to map the endpoints of your API to the methods defined here.

For measuring usage of your API apart from hits, you can define a new Metric and report the usage in different units. A unit should be quantifiable and apply a meaning for your business goals such as megabytes, CPU time, the number of elements returned by the API, and so on. All metrics other than hits, such as CPU time or mb, are not included by default on 3scale and must be reported using an endpoint periodically called by an external service configured by the user.

Methods and metrics are also the scaffolding to package your API: each application plan enables you to define different usage limits and pricing rules for each method and metric. See the API analytics section to learn more about the usage reported to metrics and methods.

Additional resources

For more details on API products and backends, see Getting started with 3scale.

7.1. Adding methods and metrics

To add a new method to a product or backend, follow these steps:

  1. Navigate to [Your_product_name] > Integration > Methods & Metrics or [Your_backend_name] > Methods & Metrics.
  2. Click on the New method link, placed on the right above the list of methods.
  3. Specify the parameters:

    • Friendly name is a short description of the method, it is shown in different sections of the 3scale Admin Portal. This name must be unique for the product.
    • System name is the name of the method which will be used to report the usage through the 3scale Service Management API. It also must be unique, and it should only contain alphanumeric characters, underscore _, hyphen - and forward slash / without spaces. Other than that, you are free to decide what the system name will look like, it can be exactly the same as the endpoint (/status), or for example can include the method and the path (GET_/status).
    • The Description field can be used for a more detailed description of the method, it is optional.

      New Method Details
  4. Finally, click Create Method.

You can later change the definition of the method. Just click on the method name (in the column Method), update the fields and click on Update Method.

Be very careful with changing the system name of the methods and metrics or deleting them. These changes can break your already deployed 3scale integration if there are mapping rules pointing to the previous system name of the method.

For creating a new metric, click on New metric and provide the required parameters. When specifying the unit, use a singular noun (e.g. "hit"), as it will be pluralized automatically in the Analytics charts.

These new methods and metrics will be available in all of your current and future plans. You can now edit limits and pricing rules for them on each plan by going to [Your_product_name] > Applications > Application Plans > [plan_you_want_to_edit].

7.2. Importing your methods and metrics automatically

If your API has a lot of endpoints, we offer two additional ways of automatically creating your methods and metrics on 3scale:

Chapter 8. Application plans

Application Plans define the different sets of access rights you might want to allow for consumers of your API. These can determine anything from rate limits, which methods or resources are accessible and which features are enabled.

8.1. How to create an application plan

By default, when your 3scale account is created, you are given two plans: Basic and Unlimited. You can keep and edit these or create your own. You can create as many plans as you need.

To create a new application plan, follow these steps:

  1. Navigate to [Your_product_name] > Applications > Application Plans.
  2. Click the Create Application Plan button.
  3. On the Create Application Plan page, enter a name and a system name (system names must be unique) for your new plan.
  4. If you want to require applications to get approval before they can access your API, select the Applications require approval? check box.

Once you have created a plan, you can provision rate limits and set up paid plans.

8.2. Setting up a default application plan

After you have created all your plans, you can select a default plan for when people sign up to register their applications.

To select a default application plan:

  1. Navigate to [Your_product_name] > Applications > Application Plans.
  2. From the drop-down list under Default Plan, select a plan.

If you do not indicate a default application plan, when a new user signs up to get access to your API, they will not be created an application by default. In other words, the user will not be able to get access to your API.

Chapter 9. Mapping rules

After defining your API by adding methods and metrics, you can map your API endpoints or paths to the methods you have defined in the Definition page. To do so:

  1. Navigate to [Your_product_name] > Integration > Mapping Rules.
  2. Click the Add Mapping Rule link.
  3. Select an HTTP method, a pattern, a metric (or method), and its increment.
  4. Click the Create Mapping Rule button.
  5. To verify your mapping rules, navigate to [Your_product_name] > Integration > Methods & Metrics. Each method and metric should have a check mark in the Mapped column.

    Mapping Rules verified

Chapter 10. Provisioning paid plans

One of the most popular ways to monetize an API, either products or backends, is by defining subscription fees based on usage. This section focuses on how to use application plans to provision pricing tiers, and how to set up a paid plan. It is also possible to apply pricing rules at the account, as well as at the product and backend levels – these topics are covered in advanced guides.

10.1. Deciding your pricing model

The first decision to make is how to differentiate between the tiers in your pricing model. The tiers can be driven by volume or usage, API functionality, access to other resources, or a combination of them:

  • Volume / Usage. The most common way to differentiate between tiers is based on volume because volume usually has a strong correlation to value to the customer as well as cost to serve. You can apply a global hit count for calls on the product or a more granular measurement at the method level. Volume drivers are applied at the level of the global hits metric, or for individual methods under hits. Multiple pricing rules can be applied to any metric. Note that the hits calculation is cumulated over a one-month billing cycle.
  • Functionality. You can enable or disable access to parts of your product depending on the tier. This is a good approach to distinguish between standard and premium levels.
  • Resources. You can also create tiers based on access to any other resources that provide value to the customer or drive costs in your infrastructure – for example, gigabytes of bandwidth consumed, number of users, or transaction values. Resource drivers are similar to volume drivers but are applied on custom metrics.

Once you have decided on your pricing drivers, you must decide whether the tiers will be based on a flat rate subscription, a variable rate, or a one-off upfront charge. All three of the pricing drivers above are compatible with the one off, or monthly flat rate subscriptions. If you decide your pricing will be based on volume of hits or resource consumption, there will of course be a variable element to your pricing.

10.2. Configuring an application plan with your pricing rules

You can either create a new application plan or edit an existing one. When creating a new application plan, you can enter any upfront charges or flat rate subscriptions.

Create new application plan or edit existing

In the edit application view, you can enter or modify the upfront charges and subscriptions.

Next, set up the pricing drivers you selected in Section 10.1, “Deciding your pricing model”:

  1. Navigate to [Your_product_name] > Overview > Applications > Application Plans
  2. Click on an application plan name.
  3. Go to Metrics, Methods, Limits & Pricing Rules. Here, pricing can be defined at the level of total hits, the granularity of methods, or for any custom metric.

If some of them already exist as metrics, you can edit the item.

Once you are finished setting up your pricing rules, click Update Application plan.

10.3. Creating further pricing tiers

You can define an API paid plan with a single application plan. Usually this would be the case if all your pricing rules are defined by volume or resource drivers. However if you want to offer separate plans for different segments of your developer community, add more application plans.

The easiest way to do this is to copy the first application plan from the application plan overview page. This way, it will be pre-populated with all the existing metrics and pricing rules. The more care you take to create a full plan the first time, the more time you will save with the plan copy feature.

10.4. Provisioning the paid plans

In order to provision the plans, your developers must create new applications and select one of the new paid plans. You can also do this on their behalf from the admin console. For any existing applications, it is also possible to change from an existing plan to one of the new paid plans.

10.5. Additional references

In conjunction with flat-rate pricing plans it is common to differentiate between tiers using rate limits. This is explained in provision rate limits

Chapter 11. Provisioning rate limits

Rate limits allow you to throttle access to your API resources, products and backends. You can configure different limits for separate developer segments through the use of application plans.

Once you have rate limits in place, these limits will control the responses a developer receives when they make authorization request calls to the 3scale back end.

11.1. Configuring the application plan

If you do not have an application plan defined yet, create one first. Otherwise, select the plan you want to set rate limits for and click edit.

For more details about creating application plans, see Application plans.

11.2. Setting the rate limits

To set the rate limits:

  1. Navigate to [Your_product_name] > Overview > Applications > Application plan.
  2. Click on the name of the application plan you want to configure.
  3. Scroll down to Metrics, Methods, Limits and Pricing Rules.
  4. Click on Limits.
  5. Configure the limits on the product or the backend level.
  6. When you are finished setting the limits you require, save your changes by clicking Update Application plan.

11.3. Putting the new rate limits into action

Now that you have your rate limits defined, the following will happen:

  • If you have alerts configured, the new limits will be used to decide when notifications are sent.
  • When you exceed the number of calls to the 3scale back end, the limits are considered and you will see the relevant error message. For more details about APIcast error messages, see Configuring error messages.

Once your rate limits are operational, you will see the users who are reaching the limits on your dashboard, making it quick and easy to check for potential plan upgrade candidates. For more information about soft and hard limits, refer to the Getting Started guide in Configure your API access policies with application plans for the Advanced path.

11.4. More information

Besides setting rate limits, you can also set variable pricing rules for the same metrics – see provision paid plans

Part III. Billing

Chapter 12. Configuring Billing Settings

This document describes how the Billing feature works in Red Hat 3scale.

Billing settings are divided into Charging & Gateway and Credit Card Policies, both can be found in Audience > Billing in the Admin Portal.

12.1. Billing modes (Charging & Gateway)

Billing in 3scale is based on the calendar month, and can be Prepaid and Postpaid.

  • In the Prepaid mode, all fixed fees and setup fees are billed at the beginning of the month or at the beginning of any prorated billing period. Variable costs are always calculated and billed at the beginning of the following month.
  • In Postpaid mode, all fixed fees as well as variable costs are billed at the beginning of the following month.

For more details see Automated billing process.

12.2. Charging enabled (Charging & Gateway)

This setting enables credit card transactions. When this setting is on, all due invoices will be charged using the selected payment gateway. If you leave this setting off, billing will take place and invoices will be issued, but no real payment transaction will take place.

12.3. Currency (Charging & Gateway)

Select the currency in which billing and the credit card transactions will be made. Please make sure that the selected currency is supported by your payment gateway. This setting is global and applies to all invoices and transactions; it is not possible to set different currencies for different developer accounts.

12.4. Invoice footnote (Charging & Gateway)

The text introduced in the Invoice footnote field will appear at the bottom of every PDF invoice. You can use this field to provide additional information about the charging and billing policy for your customers.

If the text of the footnote is changed, it doesn’t automatically apply to the invoices, for which the PDF has already been generated. However, it is possible to apply the change by regenerating the PDF of the invoices.

12.5. Text to show if VAT/Sales Tax is 0% (Charging & Gateway)

This field is used to add a text message to the PDF invoice, in case VAT / Sales Tax is 0% for the billed account. This line will only appear if the VAT / Sales Tax is set to 0 explicitly, otherwise it will not be shown. This text will also appear on the Invoice page in the Admin Portal.

See more about this setting in VAT / Sales Tax section

12.6. YAML configuration for currencies

The currencies.yml file allows you to configure a list of currencies for your 3scale deployment. 3scale uses three-letter currency codes based on ISO 4217.

  • Ensure that the payment gateway supports the selected currency.
  • 3scale integrates with the following payment gateways for credit card transactions:

    • Braintree
    • Stripe

12.6.1. Changing the currencies configuration in OpenShift

To change the currencies config, do the following:


  1. Add the source for the new content of currencies.yml as an entry of the system config map. The following example shows you how to add and additional currency, the ARS - Argentine Peso to the default list of currencies:

    oc patch configmap system --type merge -p "{\"data\": {\"currencies.yml\": \"production:\n  'USD - American Dollar': 'USD'\n  'EUR - Euro': 'EUR'\n  'GBP - British Pound': 'GBP'\n  'NZD - New Zealand dollar': 'NZD'\n  'CNY - Chinese Yuan Renminbi': 'CNY'\n  'CAD - Canadian Dollar': 'CAD'\n  'AUD - Australian Dollar': 'AUD'\n  'JPY - Japanese Yen': 'JPY'\n  'CHF - Swiss Franc': 'CHF'\n  'SAR - Saudi Riyal': 'SAR'\n  'ARS - Argentine peso': 'ARS'\n\"}}"

    To see an example of content for the currencies.yml config file, access the default YAML file: currencies.yml. The file shows a default configuration of a new 3scale deployment:

    base: &default
      'USD - American Dollar': 'USD'
      'EUR - Euro': 'EUR'
      'GBP - British Pound': 'GBP'
      'NZD - New Zealand dollar': 'NZD'
      'CNY - Chinese Yuan Renminbi': 'CNY'
      'CAD - Canadian Dollar': 'CAD'
      'AUD - Australian Dollar': 'AUD'
      'JPY - Japanese Yen': 'JPY'
      'CHF - Swiss Franc': 'CHF'
      'SAR - Saudi Riyal': 'SAR'
      <<: *default
      <<: *default
  2. Include the new ConfigMap entry currencies.yml in the system-config volume of system-(app|sidekiq) DeploymentConfig. This will mount the new the content inside the relevant containers and activate the new config.

    export PATCH_SYSTEM_VOLUMES='{"spec":{"template":{"spec":{"volumes":[{"configMap":{"items":[{"key":"zync.yml","path":"zync.yml"},{"key":"rolling_updates.yml","path":"rolling_updates.yml"},{"key":"service_discovery.yml","path":"service_discovery.yml"},{"key":"currencies.yml","path":"currencies.yml"}],"name":"system"},"name":"system-config"}]}}}}'
    oc patch dc system-app -p $PATCH_SYSTEM_VOLUMES
    oc patch dc system-sidekiq -p $PATCH_SYSTEM_VOLUMES

12.6.2. Verifying the new currencies

To verify the currencies are available in your 3scale Admin Portal, do the following:


  1. Go to Audience > Billing > Charging & Gateway.
  2. Check that the list of currencies is available from the Currency drop-down list.
  3. Choose the currency you intend to use.

12.7. Billing periods for invoice ids (Charging & Gateway)

Invoices in 3scale have two types of identifiers:

Actual ID
which uniquely identifies the invoice in the database. This is a numeric ID, which appears in the invoice URL (i.e. https://<dashboard_domain>/buyers/accounts/<acount_id>/invoices/<invoice_id>) and is used as the invoice ID in the Billing API.
Friendly ID
which appears on the invoice, is a user-friendly identifier. It should be unique per 3scale account, although it is technically possible to have duplicated friendly identifiers. In case that 3scale recognizes duplicate identifiers, you will see a warning message similar to: This invoice id is already in use and should probably be changed. If the friendly identifier is displayed as fix for more than 24 hours, contact support.

This setting defines the format of the Friendly ID of the invoice:

monthly (default)
YYYY-MM-XXXXXXXX, i.e. the ID includes the year, the month and the number of the invoice. Example: 2018-02-00000013
YYYY-XXXXXXXX, i.e. it only includes the year and the number. Example: 2018-00000001

The only effect of changing the Billing periods for invoice identifiers from monthly to yearly is changing the friendly identifier format. This modification does not change the billing cycle period. Only monthly billing is supported by 3scale API Management. Changing the format of the invoice indetifiers to yearly can be used, if there is such a requirement from your accounting department.

If you need to charge the customers yearly, billing should be handled manually – you can create a new invoice and add a line item with the yearly cost. If you prefer to use yearly charging, you may also want to set your application plans to be free, to make sure the invoices are not generated and/or charged automatically each month.

12.8. Credit Card Policies

Here you can configure the path to the following pages:

  • Legal Terms page
  • Privacy page
  • Refund page

12.9. Credit Card Gateways

3scale integrates with the following payment gateways for credit card transactions:

  • Braintree
  • Stripe

Online payment services must display a mandate when collecting credit card data. A mandate is a record of the permission a customer has given you to debit their payment method. The mandate should state clearly that the supplied payment method will be used to collect subsequent payments for services. For more information regarding mandates for Stripe and Braintree, see the following external documentation links:


Adyen, Authorize.Net and Ogone integrations are deprecated. New integrations with these gateways are not supported. Existing integrations can be supported, but the recommendation is to migrate to one of the fully supported payment gateways: Stripe and Braintree.

12.9.1. Stripe integration (recommended)

After completing these steps you will have configured Stripe as a payment gateway for your account. This will allow your developers to enter their credit card details, and you can automatically charge them through Stripe for access to your API, according to the calculated invoices.

If you enable credit card charging for your paid API, then one key step is to setup your payment gateway. There are a number of alternative payment gateways which you can use with your 3scale account. Here we cover the steps for Stripe. Prerequisites

Before you start these steps, you will need to open an account with Stripe. Getting your API keys from Stripe

Log in to your Stripe account, and get your API keys at You will need two keys: a "secret" one, and a "publishable" one. Use the "test" set when you’re doing tests and the "live" ones when you are ready to start charging.

Stripe Integration Configuring settings in 3scale

You need to tell 3scale to start using these API keys. To do this, log in to your 3scale Admin Portal. and go to Audience > Billing > Charging & Gateway.

Billing page

If the Charging Enabled flag is not active, enable it and click Save.

Enable charging

You should see a drop-down called Gateway near the bottom of the page. Change it to Stripe.

Billing gateway

The form below the drop-down should change to show two fields. Insert your Stripe API keys and click Save.

Stripe billing gateway

You might see a couple of alerts when you change your payment gateway. This is expected. Read them and accept them if they appear.

The payment gateway is now set up, but your users might not be able to use it yet since the it’s not configured in the CMS. Go to Developer portal, and click on the template called Payment Gateway / Show on the left navigation pane.

Developer portal - Billing

If it’s not there already, add the following code before {% when "braintree_blue" %}:

{% when "stripe" %}
 <p><a href="{{ current_account.edit_stripe_billing_address_url }}">Edit billing address</a></p>

 {% if current_account.has_billing_address? %}
   {% stripe_form "Edit Credit Card Details" %}
 {% else %}
   <p>After entering billing address, the option to enter credit card will be enabled.</p>
 {% endif %}

Finally click Save and Publish. Your users should now be able to pay you using the Stripe gateway.


In order to map your data from Stripe with your data on 3scale, you can use the Stripe field called metadata.3scale_account_reference which is composed of 3scale-[PROVIDER_ID]-[DEVELOPER_ACCOUNT_ID]

12.9.2. Braintree integration

These are the steps to set up the Braintree gateway in order to to charge for use of your API. Getting your API keys from Braintree

You’ll need to open an account with Braintree. You need a Gateway and Merchant account plus Vault. As an optional extra, you can choose to allow American Express cards as a payment method.

To begin, log in to your Braintree account. Then find your API keys in the Account > MyUser area:

Braintree Settings

The API keys page still hides the private key, so select the option to view it:

Braintree keys

Finally you have the Public Key, Private Key, and Merchant ID that you’ll need for the 3scale billing settings:

Braintree keys Configuring settings in 3scale

You need to tell 3scale to start using these API keys. To do this, log in to your 3scale Admin Portal and go to Audience > Billing > Charging & Gateway.

Ensure that the currency type specified on the billing page matches the currency type used in your Braintree merchant account.


If the Charging Enabled flag is not active, enable it and click Save.

Billing charging enabled

You should see a drop-down called Gateway near the bottom of the page. Change it to Braintree (Blue Platform).

Billing Gateway

The form below the drop-down should change to show two fields. Insert your Braintree keys and click Save.

Ogone billing gateway

You might see a couple of alerts when you change your payment gateway. This is expected. Read and accept them if they appear.

Your users should now be able to pay you using the Braintree gateway.


In order to map your data from Braintree with your data on 3scale, you can use the Braintree field called which is composed of 3scale-[PROVIDER_ID]-[DEVELOPER_ACCOUNT_ID] Troubleshooting

In case your account is in the sandbox mode and you encounter any problems, you will have to change it to production.

12.9.3. Deprecated payment gateways

This section provides general information about deprecated payment gateways: Adyen, OGone and The information here is for existing integrations only. New integrations with these gateways are not supported. Adyen integration


Adyen integration is deprecated. New integrations are not supported. For integrations existing before 22nd of August 2019, Red Hat provides support, but recommends to migrate to one of the fully supported payment gateways: Stripe and Braintree.

After completing these steps, you will have configured Adyen as a payment gateway for your account. This will allow your developers to enter their credit card details, and you can automatically charge them through Adyen for access to your API, according to the calculated invoices.

Setting up your payment gateway is a key step enabling credit card charging for use of your paid API. There are a number of alternative payment gateways you can use with your 3scale account. Here we cover the steps for Adyen. Prerequisites
  • Before you start these steps, you will need to open an account with Adyen.
  • You need a Company account and a Merchant account within it (sub-account).
  • There are a number of requirements that must be fulfilled before you can apply for a live account with Adyen. You can see what those requirements are here.
  • The account should be in production mode. Configuring Adyen integration

Find the information in your Adyen account

  1. To begin, log into your Adyen account. Then find your credentials in the Settings > Users area, and select System from the dropdown menu in the following view:
docs billing Adyen settings
  1. Click on the Company account (the account at the top of the list). You will then be taken to the Company account settings view:
docs billing Adyen view credentials
  1. Finally you have access to the Login, Secret Password, Client Encryption Public Key, Merchant ID, and Library location that you will need for the 3scale billing settings.
  2. To view the Public Key, you must click on Generate Password and copy this password somewhere.
docs billing Adyen credentials

Configure your payment gateway in your 3scale account

  1. In Audience > Billing > Charging & Gateway, enable charging by checking the box and click Save.
  2. You will see all the fields you need to setup to create the link to your Adyen gateway.
  3. You must select Adyen from the Gateway dropdown menu and save changes.
docs billing Adyen settings

Enable the alias additional data in the Adyen API response

By default when credit card authorization requests are sent from 3scale to Adyen, the returned response does not include the unique identifier of the credit card.

To ensure that the correct credit card reference is saved in 3scale and the correct card is charged, this additional data needs to be enabled.

Contact Adyen support to enable the alias additional data in the response for the authorization request.

Test your billing workflow

  1. Make sure you accelerate the test cycle by enabling Prepaid Mode to generate the charge within a day or so.
  2. Then choose an existing test account and create an invoice with a line item charge added.

    1. Charge the account immediately.
    2. This testing approach will incur some minor costs, but it is worth it for the peace of mind that everything works fine, before you have real paying developers using your API.

The payment gateway is now set up, but your users might not be able to use it yet since it is not configured in the CMS. Go to the developer portal tab, and find the template called Payment Gateway / Show on the left navigation pane.

If it is not there already, add the following snippet after the block of code beginning with {% when "stripe" %}

{% when "adyen12" %}
{% if current_account.has_billing_address? %}
  {% adyen12_form %}
{% else %}
  <p><a href="{{ current_account.edit_adyen12_billing_address_url }}">First add a billing address</a></p>
{% endif %}
  • For accounts created before 11th May 2016 you must add the snippet above manually. After said date this will be included in the template by default.
  • In order to map your data from Adyen with your data on 3scale, you can use the Adyen field called shopperReference which is composed of 3scale-[PROVIDER_ID]-[DEVELOPER_ACCOUNT_ID] Ogone Integration


Ogone integration is deprecated. New integrations are not supported. For integrations existing before 27th of July 2018, Red Hat provides support, but recommends to migrate to one of the fully supported payment gateways: Stripe and Braintree.

These are the steps to set up the Ogone gateway in order to to charge for use of your API. Step 1: Get your API keys from Ogone

You’ll need to open an account with Ogone. You need a premium Ogone ecommerce account – the Horizon activated with Alias Manager option. It’s a paid option, which can be activated by Ogone or by Merchant through backoffice > options > your options.

The PSPID is used to log into your Ogone account. Then you can find the UserID under Configuration > Users.

Billing Ogone ids

Make sure that the technical settings of your Ogone account are active. On the Transaction Feedback page, you’ll find the SHA-OUT passphrase. On this page you should also ensure that the two settings have checkboxes marked as shown:

Billing Ogone SHA-out

Finally the SHA-IN passphrase is found on the Date and origin verification page:

Billing Ogone SHA-in Step 2: Configure your settings in 3scale

You need to tell 3scale to start using these API keys. To do this, log in to your 3scale Admin Portal and go to Settings > Billing.


If the Charging Enabled flag is not active, enable it and click Save.

Billing charging enabled

You should see a drop-down called Gateway near the bottom of the page. Change it to Ogone.

Billing Gateway

The form below the drop-down should change to show two fields. Insert your Ogone API keys and click Save.

Ogone billing gateway

You might see a couple of alerts when you change your payment gateway. This is expected. Read and accept them if they appear.

The payment gateway is now set up, but your users might not be able to use it yet since it’s not configured in the CMS. Go to the Developer Portal page and click on the template called Payment Gateway / Show on the left navigation pane.

Developer Portal - Billing

If it’s not there already, add the following code before {% when "braintree_blue" %}:

{% when "ogone" %}
  {% if current_account.has_billing_address? %}
    {% if current_account.credit_card_stored? %}
      {% ogone_form "Edit Credit Card Details" %}
    {% else %}
      {% ogone_form "Add Credit Card Details" %}
    {% endif %}
  {% else %}
    <p><a href="{{ current_account.edit_ogone_billing_address_url }}">First add a billing address</a></p>
  {% endif %}

Finally click Save and Publish. Your users should now be able to pay using the Ogone gateway. Note

In order to map your data from Ogone with your data on 3scale, you can use the Ogone field called alias which is composed of 3scale-[PROVIDER_ID]-[DEVELOPER_ACCOUNT_ID] Troubleshooting

In case something is not working, you can try checking the following tips:

  • An overview of all payment methods that work with the alias manager can be found in this document: Payment methods processing/procedure overview.
  • In the Ogone admin console go to Technical information → Transaction feedback. Scroll to Directlink/Dynamic Parameters and select all parameters. This will allow you to troubleshoot the error easier (as the error message will be included in the invoice).
  • Try to change your ogone password and update this setting in the 3scale console
  • Verify if your user was created in your Ogone account with the checkbox "Special user for API (no access to the admin)" checked. You can also search the Ogone Support FAQ for "API user" for the details.
  • Make sure that you are entering in 3scale the password of the "API user", and not the password of Ogone PSPID-account
  • In case you are using the sandbox mode in Ogone and encounter any errors, change it to production. Authorize.Net Integration


Authorize.Net integration is deprecated. New integrations are not supported. For integrations existing before 27th of July 2018, Red Hat provides support, but recommends to migrate to one of the fully supported payment gateways: Stripe and Braintree.

Integrate the Authorize.Net payment gateway with the Red Hat 3scale billing system.


  • A valid Authorize.Net account
  • The following Authorize.Net credentials

    • API login ID
    • Transaction key

Configure 3scale API Management:

  1. Log in to your 3scale admin portal.
  2. Navigate to the SettingsBilling page.
  3. Under the Basics section, select Authorize.Net from the dropdown menu.
  4. Under the Authorize.Net Options section, enter your Authorize.Net API login ID and transaction key.
  5. Select the Save Changes button.

Chapter 13. Pricing

This section describes different ways you can charge your developers for using your API.

Setup fee
is a one-time charge applied upon subscription to the service, it is not charged when switching to another plan. It appear in the invoice/credit card only on the first month of a subscription. Can be configured on application plans, service plans, and account plans.
Cost per month
is a recurring cost charged monthly. It is prorated if the subscription occurred in the middle of the month. Sometimes it it referred to as "fixed fee". Can be configured on application plans, service plans, and account plans.
Variable costs
are the costs derived from the pricing rules applied to each method/metric configured in the application plan. They are based on the usage of your API and therefore cannot be known in advance, only when the billing period has concluded. Only available on application plans.

Service and account plans are only available in 3scale SaaS Enterprise plans.


If you have a plan with monthly cost of $10, but want to charge your developer a $5 setup fee. The initial charge would be for $15, while all subsequent charges would be for $10.

13.1. Pricing rules

Pricing rules define the cost of each API request. Multiple pricing rules on the same metric divide up the ranges of when a pricing rule applies. Pricing rules are based on calendar month, and the counter is reset at 00:00 UTC of the 1st day of each month.

Example 1

Until 100 calls per month (from 1 to 100) each API call can be charged at $0.04, and starting from the call 101 (from 101 to infinity) the calls are charged at $0.10.

Example 2

The first 1000 calls are not charged (cost $0), because they are included in the plan which has a monthly fixed cost. Starting from call 1001, each call is charged at $0.50.

Example 3

Calls from 1 to 100 are charged at $0.30, 100 to 500 – at $0.40, and 500 and further – at $0.50.


Pricing rules are defined for metrics and methods. The actual API requests are mapped to these metrics and methods through the Mapping Rules.

13.2. Setting pricing rules

  1. Go to [Your_API_service] > Applications > Application Plans.
  2. Select an existing application plan or create a new one.
  3. In the section Metrics, Methods, Limits & Pricing Rules click Pricing (x) to open the pricing section.
  4. Click new pricing rule.
  5. Set the values From, To and Cost per Unit and click Create pricing rule.

Repeat the last two steps to create all the necessary pricing rules ranges.

Leave the To field empty to set the rule to "to infinity".

The maximum number of decimals is set to 4 for the cost of metric, if a number is added with more decimals, the value is rounded to a number with 4 decimal places.

13.3. Update existing pricing rules

  1. Click on edit.
  2. Make the necessary adjustments to the From, To and Cost per Unit fields.
  3. Click Update pricing rule.

Chapter 14. Billing

The billing process creates invoices under the developer account, if it is subscribed to any paid services. The invoices are charged using the configured payment gateway.

14.1. Listing invoices

In the Audience > Billing > Earning by month section you can find an overview of your due and received payments, calculated as the sum of all invoices issued that month, depending on their state:

all invoices excluding cancelled
In process
Open, Finalized and Pending invoices
Failed and Unpaid invoices
Paid invoices

By clicking on a specific month you can list all invoices for that month.

You can also see the list of invoices by going to Audience > Billing > Invoices, where you can find invoices by their ID (friendly ID), the account name, and also filter by month and state.

The invoices of a specific developer account can also be found under X Invoices in the breadcrumbs of the account details page at Audience > Accounts > Listing > [selected account], where X is the number of invoices the account has.

14.2. Invoice view

If you click on the invoice friendly ID from the invoices list, you will see the details of the invoice.

14.2.1. Invoice details

The title includes the month and year of the invoice, and also shows whether the invoice was created manually or by automated billing process, e.g. Invoice for February 2018 (manually created).

The Details block below shows the friendly ID of the invoice, invoice state, dates when the invoice was finalized and issued, and when it is due and paid on. If the PDF has already been generated, the link to download the PDF will be also shown.

The Issued by and Issued to blocks shows the name and the address of the API provider and the developer account accordingly.

Below a block with line items will be shown, including calculations of the VAT/Sales Tax, total cost, and if the text in "Text to show if VAT/Sales Tax is 0%" was configured, it will also be shown here.

In the Transactions block of the invoice you can see the list of all credit card transactions attempts, including the status of the transaction, its timestamp, reference number, message provided by the payment gateway and the amount. You can find the transactions in your payment gateway administrator console using the reference number.

14.2.2. Editing invoices

If the invoice is in Open or Finalized state, you can edit some details of the invoice.

By clicking on the Edit link at the top right corner of the invoice view, you can change the friendly ID and the billing period.

You can also add and delete invoice line items (except calculated costs – total, VAT/sales tax, total with VAT/sales tax). To add a new line item, click on Add, and fill in Name, Quantity (does not affect the cost), Description and Cost.

The links at the bottom of the invoice view can trigger actions on the invoice – different actions are available depending on the current state of the invoice, e.g. Generate PDF, Issue invoice Cancel invoice, Regenerate PDF, Charge, Mark as paid etc. These actions (except PDF-related) will change the state of the invoice.

14.3. Invoice states

The invoice can be in one of the following states:

the invoice is created, but the automated calculations has not yet been finalized.
the invoice has all the current billing period charges added to it.
the invoice has been issued to the developers and is awaiting payment.
the invoice has been charged unsuccessfully, but pending automatic retry.
the invoice has been charged successfully.
the invoice has been charged unsuccessfully, and automatic retry will not be attempted anymore.
has been cancelled by an admin.

14.4. Automated billing process

In 3scale, the billing process runs daily. It generates invoices, changing their states according to the billing flow, and performs charges using the configured payment gateway.

The billing flow is a bit different for Prepaid and Postpaid mode, and as billing in 3scale is based on calendar month, there are special events that happen on the first day of the month.

14.4.1. On the first day of each month


  • Bill variable cost for the previous month: The cost is included as a line item to the open invoice.
  • Finalize open invoices for the previous month
  • Bill fixed cost for the current month: Create a new invoice for the current month in Open state.


  • Bill fixed cost (current month)
  • Bill variable cost (previous month)

Notifications are sent to the API admins about the invoices finalized in the beginning of the month, so they can review the invoices and make necessary adjustments.

All actions that are performed every day also happen on the first day of the month in addition to the ones described above.

14.4.2. Every day

  • Bill expired trials and new contracts that have not yet been billed: Invoices in Open state for the current month are created.
  • Prepaid only: Finalize all open invoices: Status changes to Finalized.
  • Issue invoices: Status changes to Pending.

    • The invoices are generally issued 2-3 days after they were finalized. The "Issued On" date of the invoice is set to current date, and the "Due On" date (when the invoice will be charged) is set to the Issued On + 2 days.
    • When the invoice is issued to the developers, they receive an email notification, and can see the issued invoice in the Developer Portal.
  • Charge invoices

    • The invoices in Unpaid and Pending states are charged, if the Due On date is today or earlier.
    • If the payment failed, the invoice state is changed to Unpaid. Charging will be retried again in 3 days. After 3 unsuccessful retries, the invoice state is changed to Failed, and charging is not retried anymore.
  • Notify about expired credit cards

    • The developer accounts whose credit cards are going to expire soon are sent email notifications.

14.4.3. Automatic and manual invoices

The invoices that are generated by the automated billing process have an (automatically created) label in the invoice header. For example: Invoice for January 2019 (automatically created).

The invoices that are generated manually are marked with (manually created) on the invoice details page.

The automated billing process may use existing invoices in open state for the current month to create additional line items, but only for automatically created invoices. The invoices created manually will not be updated by the automated billing process.

14.4.4. Mid-month upgrades

If an application (or account/service subscription) is upgraded in the middle of the month, the monthly cost is prorated according to the number of days left in the month. The limits configured on the application plan are not prorated.

If the application is upgraded from a free to a paid plan, the next time billing runs a new invoice will be generated including the prorated monthly cost.

When the application is upgraded from a paid plan to a more expensive paid plan, the behavior depends on several factors:

  • The mode of Billing: Prepaid or Postpaid
  • When the plan change is made Prepaid billing

  1. If the application plan is changed on the same billing day (a billing day starts at 8am UTC) as is it was created, and so it has never been invoiced before, the fixed costs for the old plan are included to the invoice, and are discounted with a 'Refund' line item. The fixed costs for the old plan are also added to the invoice.

    Example: A customer signed up for the Plan A (200$) on the first day of the month, and upgraded to the Plan B (300$) on the same day. One invoice will be generated in this case, and it will contain the following line items:


    Fixed fee ('Plan A')


    Refund ('Plan A')


    Application upgrade ('Plan A' to 'Plan B')




    Note that if the customer signed up on another day of the month, the cost of and refund of 200 would be prorated.

  2. If the application plan is changed after the invoice was already issued for this application:

    • In case of an upgrade, the developer will be issued two invoices: one for the initial charge, and another one for the upgrade.

      Example: A customer signed up for the Plan A (200$) on the first day of the month, and then upgraded to the Plan B (300$) in the middle of the month. The following invoices will be generated:


      Fixed fee ('Plan A')





      Refund ('Plan A')


      Application upgrade ('Plan A' to 'Plan B')




      In the second invoice, the refunded cost (100$) and the new cost (150$) are prorated, as the upgrade is made in the middle of the billing period.

    • Refunding on application downgrade (change to a plan with a lower cost) is not supported at the moment. Postpaid billing

In Postpaid billing mode a single invoice will be issued, and it will include the Refund and Application upgrade line items.

IMPORTANT: This behavior was introduced on April 20th, 2018 with the following changes:

  • A bug was fixed where the initial charge (for the initial application plan) was not included in the invoice when the application was upgraded on the same day as created.
  • Previously only one line item was added on application upgrade, including the difference between the cost of the new and the old plan. For example, in the scenario 2 described in Prepaid billing section above (application upgrades from Plan A – 200$, to Plan B – 300$), the second generated invoice would be:

Application upgrade ('Plan A' to 'Plan B')




where 50$ is the difference between the prorated costs of the new and old plan for the rest of the month (150$ - 100$).

After April 20th, 2018, the calculations are reflected more clearly in the invoice (including refund and charge separately), while the total cost remains the same as before.

14.5. Enable/disable billing/charging per account

Automated billing process generates invoices for all developer accounts subscribed to paid services.

Charging can be enabled or disabled globally (see Billing and Charging settings ), however it is also possible to enable or disable both billing and charging per developer account. To do that, navigate to the account page and click the corresponding button (Enable / Disable) against:

  • Monthly billing is enabled/disabled
  • Monthly charging is enabled/disabled

If charging is disabled, and billing is enabled, the developer will be issued invoices, but will not be charged. This is useful in case you handle charging separately (e.g. with wire transfer).

If both are disabled, the developer will not be issued or charged.

If billing is disabled, and charging is enabled, the developer will not be issued any new invoices, but all the outstanding ones (Pending and Failed) will still be charged.

Here in the Billing Status block you can also see whether the credit card details are configured on the account. In case credit card details are configured, the month and the year of card expiration is shown. The presence of the credit card details may affect the Developer Portal flow on sign up and plan change (see more in Section 14.9, “Credit card flow”).

14.6. Plans with a trial period

A trial period (in days) can be set for paid plans to delay the charging for the specified amount of days.

You can see the trial period status for the application in the application listing ([Your_product_name] > Applications > Listing) in the State column as "live – trial expires in N days", and in the application details page in the Trial days left field.

During the trial period the application can use all the features and usage limits defined by the plan without restrictions.

Once the trial period is set, it is not possible to cancel or extend it. Upgrading to another plan will not reset the trial days counter.

10 days before the trial period expires, an email notification is sent to the developer account notifying about the upcoming trial expiration. The template of this email can be configured in Audience > Messages > Email Templates: "Application trial period expired for buyer" for the application plans, and "Service trial period expired for buyer" for service plans with trial period. The developer should either remain on the current plan, or switch to another plan, or contact the API provider if they decide to cancel the subscription.

Once the trial period is over, the next time automated billing runs (see Section 14.4, “Automated billing process”) the developer will be charged according to the costs set for the plan that the application or service are currently on. Note that the application will not be blocked or suspended after the trial period expires, and will continue to work.

While a trial period technically can be set for free plans, it is not recommended as the feature loses its usefulness.

14.7. VAT rate/Sales Tax

Value-Added Tax (VAT) is a tax that is applied on goods and services sold within European Union. In other countries there is a similar tax, for example, Sales tax. API providers who charge their customers for using their API service often need to charge the tax as well and reflect it in the invoices to comply with the existing regulations.

3scale billing can automatically include VAT in the invoices, when configured.

14.7.1. Configure VAT rate field

VAT rate is the number (in percentage) that will be applied to the total cost in the invoice. To configure VAT rate, follow these steps in the Admin Portal, from the Dashboard:

  1. Go to Audience > Accounts > Fields Definitions.
  2. Click Create in the Account section.
  3. Select vat_rate in the [new field] drop-down list.
  4. Set a value for Label.
  5. Configure the checkboxes to indicate whether the field should be Required, Read only or Hidden for the developers.

    NOTE: the "Choices" field only accepts strings, so this field cannot be used.

  6. Click Create.

14.7.2. Configure VAT code field

VAT code is the VAT identification number. To configure the VAT code follow these steps in the Admin Portal, from the Dashboard:

  1. Go to Audience > Accounts > Fields Definitions.
  2. Click Create in the Account section.
  3. Select vat_code in the [new field] drop-down list.
  4. Set a value for Label.
  5. Configure the checkboxes to indicate whether the field should be Required, Read only or Hidden for the developers.
  6. Click Create.

14.7.3. Set VAT values for an account

Once VAT code and VAT rate fields are added, you can set the corresponding values under the developer account Edit form. Depending on the selected checkboxes in the fields definitions the fields can also be visible and/or editable by the developers in the Developer Portal.

VAT code can be any string.

VAT rate must be a number. Either integer or decimal numbers are accepted (e.g.: 21, 23.5 etc.) and they represent the percentage of the cost that will be included as VAT.

14.7.4. Invoices with VAT

When an invoice is generated for a developer account that has a non-zero VAT rate configured, the invoices will include the following line items:

_Total cost (without <VAT rate>)_ +
_<VAT rate> Amount_ +
_Total cost (<VAT rate> <VAT rate value>% included)_

<VAT rate> will be replaced with the Label set for the VAT rate field, and <VAT rate value> is the value configured for the account the invoice is issued for.

The VAT code will be included in the PDF version of the invoice with the label, specified in as the Label in the VAT code field definition. The value will correspond to the value set in the developer account details.

The fields vat_rate and vat_code can also be read and written by the 3scale Account Management API.

14.8. Developer Portal view

The developers can manage their Credit Card information and see their invoices in the Developer Portal.

The Finance switch in Audience > Developer Portal > Feature Visibility has to be in Visible state for the developers to see the billing-related elements in the Developer Portal.

A logged-in user can update the credit card details at Settings > Credit Card Details. Depending on the payment gateway configured the form may be different, and the user may need to enter the billing address first.


Credit card details are not stored in the 3scale database. These details are managed by the payment gateway. Only the last 4 digits of the credit card number, the expiration date and the reference provided by the payment gateway are stored in the 3scale database.

A developer can only have one credit card card on the Developer Portal.

Credit card details cannot be deleted from the Developer Portal. The user of the developer account who wants to delete his credit card details would need to request the API provider to delete the credit card details from the system.

To see the invoices, the user can go to Settings > Invoices, and from there they can either show the details for each invoice, or download the invoice PDF.

14.9. Credit card flow

14.9.1. Sign up for a paid plan

When a developer signs up for a paid plan, they are requested to enter the credit card details before they are allowed to see the application credentials. Once the developer logs in to the Developer Portal for the first time, they will be redirected to the Credit Card Details page. Trying to access any other developer account page will result in a redirection to the Credit Card Details page again.

If the 3scale account was created before July 5th, 2016, you must manually enable this behavior by setting the switch Credit Card on Signup in Audience > Developer Portal > Feature Visibility. Otherwise, the application credentials will be visible even when the credit card details are not set.

You can use Liquid tags to hide all of the menu items, except the Credit Card Details tab, by customizing the corresponding Developer Portal templates.

The current_account Liquid drop exposes the method requires_credit_card_now? which returns true if the credit card details are missing, but are required (only if Billing is configured in the Admin Portal), and false otherwise.

You can hide any menu items and other user interface elements in the submenu and users_menu partials by wrapping them with the following condition:

{% unless current_account.requires_credit_card_now? %}
{%  endunless %}

14.9.2. Upgrade from a free to a paid plan

For plan changes of the existing applications there are multiple options that can be configured, including changing the plan directly by the developer or requesting a plan change. In case the application is upgraded from a free to a paid plan, it is important to ensure that the developer enters the credit card details before being able to upgrade. This can be configured in [Your_product_name] > Integration > Settings, Application Plan Changing section by the following setting:

Change plan directly if developer has credit card, otherwise:
- Only request a plan change
- Request Credit Card entry for paid plans

Select the first option if you want to only allow the developer to request the change, and perform the upgrade manually after the credit card details are entered.

Select the second option if you want the developer to be notified that credit card details need to be entered before upgrading to a paid plan. In the plan selector widget the developer will see a message "You cannot change plan until you enter your Credit Card details" pointing to the credit card details form.

14.10. "Billing address" field

When the developer enters the billing address on the Credit Card Details in the Developer Portal, this address is stored separately from the "legal" account address.

By default the legal address appears in the Invoices in the Issued to field. However, in case the developer does not have the legal address configured, but only the billing address, the latter will be used on the invoices. The organization name is considered part of the address in this case.

By default the billing address is not visible in the Admin Portal or through the product API; however you can add it as follows:

  1. Go to Audience > Accounts > Fields Definitions.
  2. Under the Account block click Create.
  3. Select 'billing_address' from the drop-down list, add the label, check the Read only checkbox and click Create.

Now the <billing_address> field appears in the XML model for Accounts in the Account Management API and Webhooks. The corresponding billing address will be visible as read-only in the Account and the Account edit pages of the Admin Portal.

Billing address can be changed by the developer in the Developer Portal, in the Credit Card Details section. The admin cannot change the billing address in the Admin Portal, but it is possible to do so with the Account Edit endpoint of the Account Management API using the following fields (as "additional fields"):


Chapter 15. Email Notifications

Different events related to billing trigger email notifications for API providers and developers.

15.1. Provider notifications

The users of the 3scale account (admins and members with Billing permission) can subscribe to or unsubscribe from the notifications related to billing at Account Settings (gear icon on the top-right) > Personal > Notification Preferences, under Billing section:

Action required: review invoices
Sent a few days before end of billing cycle so you can review invoices before they are being sent to customers.
Customer downgraded
Sent when a customer changes to a plan with a lower monthly fixed price.
Expiring credit card
Sent when a customer’s credit card is about to expire.
Payment error (retry)
Sent when payment fails, resulting in an unpaid invoice and a retry.
Payment error (final)
Sent when the final retry of a payment fails, resulting in a failed invoice.

Note: All admin users of the 3scale account will receive notifications regarding billing, if they are subscribed to them.

15.2. Developer emails

The email notifications sent to the developer accounts can be configured at Audience > Messages > Email Templates. The following emails are available:

Credit card expired notification for buyer
Sent when the credit card is due to expire soon.
Invoice charged successfully for buyer
Sent when the invoice has been successfully charged.
Invoice charge failure for buyer with retry
Sent when the invoice charge has failed, and the invoice is in Failed state, which means that the charging will be retried again.
Invoice charge failure for buyer without retry
Invoice charge has failed for the 3rd time, the invoice has passed to Unpaid state and will not be retried again.
Upcoming invoice charge for buyer
Sent when the invoice is issued for the developer.

All admin users of the developer account will receive the above notifications.

15.2.1. Billing email address

You can configure an email address that your customers can contact for resolving any issues with billing (e.g., in Audience > Messages > Support Emails in the Finance support email field.

The email templates reference the email address with the Liquid drop {{ provider.finance_support_email }}.

Chapter 16. Billing API

The Billing API provides a way to automate common billing processes.

All the endpoints of the Billing API can be found in the Admin Portal under Documentation (?) > 3scale API Docs > Billing API.

The Billing API requires a valid access token which meets the following requirements:

  • it should belong to either an admin user of the provider account, or a member user with "Billing" permissions
  • it should include "Billing API" scope

Note that when an invoice ID is required as a parameter, it refers to the invoice ID, and not the Friendly invoice ID.

The XML response of the API endpoints is mostly self-explanatory, and the fields of the Invoice represent the same information as in the web and PDF representation.

Some notable fields of the response:

  • creation_type: can have the following values: 'manual' for invoices created manually or 'background' for invoices created by the 3scale automated billing process
  • provider: the details of the API provider (the admin account), corresponds to the Issued by section of the invoice.
  • buyer: the details of the developer account, corresponds to the Issued to section of the invoice.

The XML representation of the invoice also includes the list of Line Items under the line-items field.

For some line items (typically the ones created automatically) apart from the expected name, description, quantity and cost (price), you can see the following:

  • type: the type of the line item, can have the following values:

    • LineItem::PlanCost – for line items for fixed plan costs
    • LineItem::VariableCost – for line items for variable costs
  • metric_id: for variable costs line items – the ID of the metric that the cost is associated with
  • contract_id: the ID of the service or application that the cost is associated with

Part IV. Managing developer accounts

Chapter 17. Adding developers

These are the steps to add a new developer account for access to your API.

If you have configured the workflow to invite developers manually, this covers how to add new developers.

17.1. Create a new developer account

  1. Follow Accounts link from the Audience section on the Admin Portal.
  2. Click Create.

As an admin, you can skip even some of the required fields. If you want to invite users to the account securely, you can also skip the password fields. However the email on this main admin account must be unique among all users.

Create new developer account

17.2. Set up applications

If you want to pre-configure app keys for the account, you can also add an application on behalf of the developer. Otherwise, leave this as one of the initial steps for the developer to take.

Add applications to new account

17.3. Notify the developer

You can either send an email invitation to the developer manually or follow the steps to use the invite developer feature.

Chapter 18. Approving developers

This section shows how to make approvals for any step in the signup workflow.

Once you’ve implemented the signup workflow with manual approval steps, you have a few options. The approval process is slightly different depending on the trigger and what is being approved. If you receive an email notification, follow the instructions in the following section. Otherwise, it depends on whether you want to approve an account, a service, or an application.

18.1. Approve from email notification

If you (as admin) receive an email notification that one of your developers has an item pending approval, you can copy/paste the URL for the item into your browser, and it will take you directly to the page to make the approval.

18.2. Account approval

To search for specific accounts or filter all accounts that are in a “pending” (for approval) state, navigate to Audience > Accounts > Listing. To show only the pending accounts, select "Pending" in the dropdown list State and click Search.

You can make individual approvals directly on each row, or select several rows at a time and perform a bulk approval.

Developer approval account signup

18.3. Service approval

To search for specific subscriptions to a service or filter all subscriptions that are in a “pending” (for approval) state, navigate to Audience > Accounts > Subscriptions.

To view Subscriptions, enable Service Plans in Audience > Accounts > Usage Rules.

You can select one subscription or several at a time and perform a bulk approval.

Developer approval service subscription

18.4. Application approval

To search for applications or filter all applications that are in a “pending” (for approval) state:

  1. Navigate to Audience > Applications > Listing.
  2. Select "pending" in the dropdown list State and click Search.

You can select one application or several at a time and perform a bulk approval.

Developer bulk approvals apps

You can also start from the details page for a developer account, select which application you wish to approve from there, and make the approval on the application details page.

Developer individual app approval 1
Developer individual app approval 2

Chapter 19. Changing plans for an app

After this section you will be able to change plans for accounts, services or applications.

As admin you may change plans for a developer at any time, or in response to a plan change request that the developer initiates.


The change plans step is slightly different depending on what type of plans are being changed.

19.1. Change account plans

To search or filter specific accounts, navigate to Audience > Accounts > Listing.

You can select one or more rows at a time, and change the plans.

developer change account plans

19.2. Change service plans

To search or filter specific subscriptions to a service, navigate to Audience > Accounts > Subscriptions.

You can only view subscriptions if you have enabled Service Plans in the Settings page.

You can select one or several subscriptions at a time, and change the plans.

Change service plan

19.3. Change application plans

To search or filter specific applications, navigate to Audience > Applications > Listing.

You can select one or several applications at a time, and change plans.

Change plans for multiple applications

Another scenario is to start from the details page for a developer Account. From there you select the application for which you wish to change plan. On the application details page, you can change the plan.

Change application plan

19.3.1. More information

If rather than change to another standard plan, you only want to make a change for one specific app, you can use the customize plans feature.

Chapter 20. Contacting developers

This guide explains how to find out which developer account manages a particular application and then communicate with them – both through 3scale and externally.

During API operations, you may urgently need to contact developers who are using your API.

20.1. Locate the relevant application and account in the system

If you already know the account and developer who manages the application in question, navigate to their account from the Accounts page in Audience > Accounts > Listing, as shown below.

Accounts View

If you only have the application ID or API key, you can use the search box on the Accounts page in Audience > Accounts > Listing to find the relevant account. More information on locating applications is available here.

20.2. Send internal messages to developers

Once you are in the account profile page as shown below, click the message icon.

Send message

The message created here will be sent both to the account system dashboard, where all developers on the account will see it, and by email to the people on the developer account who have admin status within the account.

20.3. Contact by other means

If it’s an emergency and email is unlikely to be fast enough for your purposes, you can also use the contact information submitted by the developer at time of signup, which is available:

  • On the company account page (general contact information but may include a phone number)
  • Developer/user specific information on the users’ own file

Note that you can make contact phone numbers a required field upon signup.

Chapter 21. Customize plans

When you have completed this section you will have customized an application plan for a specific developer.

Application plans are a good way to apply standard policies for different segments of your developer community. However, you always have the flexibility to customize the standard plans for any individual developer with unique requirements.

Once a plan is customized, you lose the link to the original plan. If you make changes to the original plan, the custom plan does not inherit any of those changes. So you should use this customization feature sparingly, before you become overwhelmed with too many custom plans which you cannot manage effectively.

A developer wants to increase their current limits without upgrading to the next pricing tier as the current billing period is already under way. A customization could be a good way to handle this situation by enabling the increase in limits and charging only the variable costs incurred. This would also help encourage an upgrade for the following billing month.

21.1. Choose the account

To view the details page for the developer Account you are interested in:

  1. Navigate to Audience > Accounts > Listing
  2. Choose the Developer account
Select Account

21.2. Select the application

Select the application whose plan you wish to customize.

Select App

21.3. Customize the application plan

Select the option to “customize”. This provides the page where all the plan elements can be customized for the application owned by this account.

Customize Plans

21.3.1. More information

Before you take the step to customize plans, always consider first if you are not better off with a new standard plan (which can be hidden from display in the Developer Portal). Then you would just change to the standard plan and so gain the benefit of reuse if this applies to more than one of your developer partners.

Chapter 22. Enable signup

Configure developer signup by implementing self-service or manual mode.

You can configure the workflow for developers to be self-service or by manual invite only. Self-service signups are done by developers through the Developer Portal, while manual invites are handled by your admins through the Admin Portal.

By default, developers are enabled to sign up by themselves. If you enable developer self-service, you can require admin approval before the developer account can be activated.

To do so, navigate to Audience > Accounts > Settings > Usage Rules.

Enable self-service developer signup

Chapter 23. Finding applications

By the end of this guide, you’ll be able to quickly locate an application in the Admin Portal based on either its name, an API key, or an application identifier.

During API operations, you may need to be able to find information on an application that is accessing your API quickly – either for support purposes, to change configuration, or potentially because the application is misbehaving and needs to be disabled.

23.1. Get the information you need

To find an application, you need the name of the account it belongs to or the application’s name. If you do not have this information, you can verify the access logs. To perform the search, navigate to Applications (Audience > Applications > Listing).

If you search by identifier for an authentication type, you need the following information:

  • For API key-only authentication patterns: the API key
  • For app ID and app key authentication patterns: the app identifier (search by app key is not supported)
  • For OpenID Connect authentication patterns: the client_id (search on the secret is not supported)

23.2. Search for the application

To search a given application, navigate to Applications page (Audience > Applications > Listing), and use the search box as shown in the image below.

Finding an application part 1

23.3. Access application information

Once the results are returned, click on the application you’d like to access and you’ll be taken to that application’s homepage, which includes information such as that shown in the image below.

Finding an application part 2

Chapter 24. Inviting developers

After completing these steps, you will have added a new developer user to a developer account.

When you create a developer account manually, you can invite developer users to that account through the Admin Portal:

  1. Navigate to Audience > Accounts > Listing.
  2. Choose the account in question.
  3. Select "Invitations" and then click Invite user.
Developer invite user

Chapter 25. Unsubscribing developers from a service

As an admin, you can unsubscribe developers from a service. You may need to do this for one specific developer, or for multiple developers, in the event of a service deprecation.

25.1. Unsubscribing a single developer from services

Unsubscribe a single developer from a service they are subscribed to through the Admin Portal:

  1. In the Admin Portal’s Dashboard, navigate to Audience > Accounts > Listing > [select an account] > Service Subscriptions.
  2. Select Unsubscribe for the service that you want to remove the developer from.

25.2. Unsubscribing multiple developers from services

Perform a bulk action to unsubscribe multiple developers from a deprecated or deleted service:


This method only applies to services that have been deleted or suspended. You cannot perform a bulk unsubscription action on active services.

  1. In the Dashboard, navigate to: Audience > Accounts > Subscriptions.
  2. Do bulk state change.
  3. Using the service dropdown menu, identify the service from which you want to unsubscribe developers.
  4. Using the checkboxes on the left, select the developers you want to unsubscribe.
  5. Select Change State > Suspend to suspend the selected developer subscriptions.

Remember that service plans need to be enabled.

Chapter 26. Suspending applications

This guide explains how to disable all keys and access tokens for an application.

If an application is misusing your API and affecting other traffic, you may need to quickly suspend its operations before contacting the developer involved to ask them to amend their code or configuration.

26.1. Find the application

You can find the application from the Accounts or Applications tabs or by searching as described here.

26.2. Disable the application

Once you have located the application and see the application summary page, click on the suspend icon next to the ‘State’ value. This action will immediately disable the application from the API and suspend all keys from working. Calls with these application keys will be rejected by the control system.

The application can be unsuspended using the same button once the problematic behavior has been rectified.

Suspend an Application

If you use caching in your agents, suspension may not be immediate but require a short timeout.

26.3. Contact the developer

How you contact the developer of the application will depend on your workflow and policy. On the same page, you can click on the account name, which will take you to the account view where you can identify the key administrator of the account that owns the application. You can contact them either by email or by clicking on the send message button as shown, which will generate a dashboard message for the user.

Contact Developer

Chapter 27. Deleting applications

To delete an application via the Admin Portal, you need to follow these steps:

Option 1: Delete an application from the list of all applications for [Your_API_name].

  1. In the Dashboard, click [Your_API_name].
  2. Click the Overview tab.
  3. From the left panel on the Overview page, click Applications.
  4. Choose Listing.
  5. Click on an application.
  6. You will see a page containing details of the application. Click Edit.
  7. To delete the application, click Delete.
  8. You will see a confirmation message. Click Ok to confirm the deletion.

Option 2: Delete an application based on a specific application plan.

  1. In the Admin Portal, click Dashboard.
  2. Choose API.
  3. Under Published Application Plans, choose an application.
  4. Click on an application.
  5. You will see a page containing details of the application. Click Edit.
  6. To delete the application, click Delete.
  7. You will see a confirmation message. Click Ok to confirm the deletion.

Alternatively, you can also delete an application via 3scale API Docs, with the operation called Application Delete.

Chapter 28. Deleting an API

You can delete an API by deleting its service. Deleting a service removes the API’s applications, application plans, metrics, pricing rules, features, service plans, and subscriptions.

To delete an API:

  1. Navigate to [Your_product_name] > Overview > Edit.
  2. In the Service deletion section, click the link to delete the service.

Part V. Analytics

Chapter 29. API analytics

This guide is designed to help you tune the API analytics to track the items you need to know about, such as checking the most used applications and trends over time. Knowing how your API is used is a crucial step for managing traffic, provisioning for peaks, and identifying users who mostly send requests to the API.

3scale tracks API analytics via methods and metrics that you can define in these levels:

  • Product: Hits metric counts hits mapped to Hits itself and to its corresponding methods, in addition to all the hits mapped to the backend-level Hits metrics and their methods.
  • Backend: 3scale registers methods and metrics in the backend as if they belong to each product using the API backend. You can set limits and pricing rules for the backend-level metrics in the Application Plans defined at the Product level.
  • Application: You can obtain analytics reports for each application created in 3scale.

29.1. Prerequisites

Complete the instructions of the Getting Started section before using this guide.

The guide assumes that you are using one of the existing 3scale code plugins to perform an integration. You can follow a similar flow with other integration methods. Check the Operating APIcast chapter of the documentation to learn more about the available integration options.

29.2. Determining the metrics and methods to track

3scale acts as an infinitely scalable data repository for your API product statistics, and you can track almost any metric for your API product. For example:

  • Hits/transactions: calls to the API product. Hits are included by default as metrics on all APIs. Hits can be overall calls to the API product or broken out into individual methods on the API product.
  • Data transfer: quantity of MB/GB of data uploaded and downloaded via the API product
  • CPU hours: compute time (or some other internal resource) associated with calls to the API product
  • Results returned: count of the number of records or data objects being returned
  • Disk storage: total disk storage in use by an account

You can track more metrics that are relevant to your API product. 3scale can track an arbitrary number of metrics and methods, as long as it is a countable quantity that can be incremented over time.

29.3. Creating your metrics and methods

After you choose your metrics, register them in the Admin Portal:

  • To add methods and metrics to your product, navigate to [Your_product_name] > Integration > Methods & Metrics.
  • To add methods and metrics to your backend, navigate to [Your_backend_name] > Methods & Metrics.

You can add metrics and methods to the product or backend you have selected. Provide them with a friendly name and a system name, which 3scale use in the plugin configuration. For more details about creating methods and metrics, see defining your API on 3scale.

29.4. Setting up reports

Once you have configured the 3scale system with the names of the metrics to track, it is time to tweak your plugin setup to report the right metrics. The precise manner of doing this depends on the plugin or integration method in use. By default, the plugins report the Hits (API transactions) metric only.

To set up reports, consider the following:

  • The application should pass the appropriate metric/method names to the plugin as determined by the incoming API call. The metric/method value and the increment required is an argument of authorize and/or report methods the plugin exposes.
  • When you report traffic for a specific API method, use the system name method in the metric argument. This automatically increments the counter both for the method reported and the hits metric.
  • You can also report the traffic using the 3scale Service Management API. For additional information about different endpoints, refer to 3scale APIs ActiveDocs, available in your Admin Portal under the Documentation → 3scale API Docs section.

29.5. Checking analytics for backends

You can view the traffic data for a given API configured as a backend. The Traffic page shows the hits to the endpoint.


  • Create an API backend.
  • Add the backend to an API product.


  1. Navigate to [Your_backend_name] > Analytics.
  2. Choose the time frame for the report. You can choose to show the last 24 hours, 7 days, 30 days, 12 months; or indicate a period of time.
  3. Optional: You can also select a different metric other than Hits; either a method metric or another top level metric.

    • You will see the results in the chart. If there is no traffic to report, you will see the following message: There is no data available for the selected period

You can also download the data in a CSV file. To do so, click the Download CSV link.

29.6. Checking analytics for applications

Once the API and 3scale establish a connection, you can send traffic to the API product and watch it register on the API Analytics dashboard. You need an existing developer account and an application with API credentials to be able to perform the steps in this section. Follow these steps to create a developer account and get an application with API credentials:

  1. To see the list of existing applications, navigate to Audience > Applications > Listing.
  2. Select an application by clicking on its name.
  3. Find the API credentials for the selected application. The credentials depend on the selected authentication type and can be a user key (API key), an application ID and application keys, or a client ID and client secret. For more information about the available authentication modes, see the authentication patterns article.

    Figure 29.1. API credentials

    API credentials
  4. Use these keys to make calls to your API in the usual way. For example, from the command line using cURL or from the browser for API endpoints using the GET method. The precise calls to make depend on the structure of the methods on your API product. Traffic from these calls appear in the Analytics section for your API product.

29.7. Controlling who sees the analytics

By default, the usage statistics are visible to the API provider through the Admin Portal and to the developers who created applications through the Developer Portal. Each developer can see only the usage statistics for their own applications. You can hide the analytics views from the Developer Portal. See the Creating the Developer Portal section to learn more about customizing the Developer Portal.

29.8. Accessing analytics data by API and email reports

Besides the usage graphs in the Analytics section, you can access analytics data with:

  • Analytics API

    3scale Analytics API is a flexible way to extract all the analytics data for your API product in either XML or JSON format.

  • Daily and weekly traffic reports These reports provide the aggregated data about your traffic, including information about new subscribers to your API product and top applications. To enable these reports in the Account Settings (gear icon) > Personal > Notification Preferences of your Admin Portal, find the Daily report and Weekly report check boxes. If enabled, the admin user of your 3scale account will receive these reports via email.
  • CSV export There is a download CSV button link on each analytics view page, and you can download the usage statistics in .CSV format.

29.9. Troubleshooting

If traffic does not display on the usage charts in the Analytics section, perform the following checks.

  • Are authorize/report calls responding correctly?

    All plugins call the 3scale Service Management API, which has predetermined response codes. Authorize calls for valid keys should return responses with HTTP code 200. Report calls should respond with code 202.

  • Are there errors in the integration error console?

    The log of integration errors detected by 3scale can be found in [your_product_name] > Analytics > Integration Errors.

  • Are the correct metric and method names being used?

    The most common reason for failure is that the method and metric names passed in report calls do not correspond to those created in the API settings of your Admin Portal. Check that you are using the correct system names for each metric/method.

  • Are mapping rules properly mapped to the metrics?

    If mapping rules are not properly mapped to the metrics, you may not see data in the Analytics. Check that the mapping rules are correctly mapped to the metrics, both for API products and API backends:

    • Products: Navigate to [Your_product_name] > Integration > Methods & Metrics.
    • Backends: Navigate to [Your_backend_name] > Methods & Metrics.

Chapter 30. Exporting analytics

This chapter describes how to create scripts that extend the current capabilities of the built-in 3scale analytics.

By using Account Management and Analytics API (Enterprise only), you can create scripts to retrieve information that you need in your preferred format. This chapter describes a particular use case, but the same approach can be used to get the data you need out of 3scale.

30.1. Reasons for customized scripts

3scale continuously improves the features available on your API Dashboard. However, you may be ahead of our development plans and have a very specific need not yet supported.

To satisfy the needs for API management, 3scale always gives you the tools to access all your data. However, customized scripts have some costs – it takes some resources to write the scripts. More importantly, customized scripts gives you total flexibility and control to implement use cases.

30.2. A real-world example

A customer was in the process of onboarding thousands of new developers per week. This customer could tackle some aspects of the onboarding because 3scale provides automates necessities such as key provisioning, sign-up workflows, and email communication. There was, however, something that was not possible to do with 3scale, which was quite important for them.

Since the customer was onboarding many people, the company needed a straight-forward way to classify the new developers based on their engagement with APIs so that their operations and marketing teams could interact with the new developers more effectively. At least at the required level of detail, such a feature was not yet available in the built-in analytics tools provided by 3scale. However, it was possible to extract data using 3scale Account and Analytics API because all the data was available in the system.

30.3. Example: Customer requirements

They would like to know how many new developers have signed up for the free evaluation plan in the last 10 days, split up different ways.

First, they wanted to know how many developers signed up but never used their API.

Second, they wanted to split the developers that had used their API into two groups:

  • Developers that used it for a period of time – say the first half of the 10 days – and then stopped using the API. These developers tried it out, but became inactive.
  • Developers that have been using the API consistently. For those, they would like to know the percent growth (or decline).

This information is available on 3scale’s built-in analytics. The problem is that there is no view to show it aggregated, which makes the whole experience quite cumbersome.

A typical answer to this problem would be this classification will be part of the upcoming analytics revamp. (Funny thing is that’s actually the case.) But that does not solve the problem if you need it now. We at 3scale want to give you the tools to do everything you need to do without depending on our release schedule.

30.4. Hands-on implementation

30.4.1. Winning recipe

This recipe usually gives better results in achieving custom work.

  • Tinker a bit with ActiveDocs. 3scale ActiveDocs, available in your Admin Portal, under the Account Settings (Gear icon in the top right corner) > Integrate > 3scale API Docs. 3scale has all of its APIs available as ActiveDocs so that you can try them out from your browser. This allows you to find the request that best serves your needs, get the request (curl-like) and get a grasp of the response. See an example…​

    DIY Analytics

This is the ActiveDocs for the API request to fetch all applications that will be used on the script to extend the analytics.

  • Once you have done the research with the ActiveDocs, put down the request on your scripting language of choice (ours is pedestrian Ruby).
  • Repeat until you have a script that does exactly what you need. For the example of the extended analytics, the script is available as a gist. You can try it out in your account.

ActiveDocs lets you quickly get a grasp of what the API is able to do. Then, it is a matter of finding which 3 or 4 requests are needed for the task you want to do and putting a script together.

30.4.2. Step-by-step guide

These were the steps taken to achieve the custom analytics that this customer wanted:

  1. Retrieve the full list of applications. This operation requires pagination.

    def api_call_applications_list(domain, provider_key)
      done = false
      res =
      page = 1
          while !done
        url = "https://#{domain}/admin/api/applications.xml?provider_key=#{provider_key}&page=#{page}&per_page=100"
        page += 1
        response = RestClient.get url
        raise"Wrong response code (#{response.code}) in request #{url}") if response.code!=200
        document = Nokogiri::XML(response.to_str)    done = document.xpath("applications/@current_page").text == document.xpath("applications/@total_pages").text
        document.xpath("//application").each do |item|
          app =
          app["created_at"] = DateTime.parse(item.xpath("created_at").text)
          app["plan_name"] = item.xpath("plan/name").text
          app["service_id"] = item.xpath("plan/service_id").text
          app["account_id"] = item.xpath("user_account_id").text
          app["id"] = item.xpath("id").text
          res << app
      return res
  2. Filter the applications that do not meet the criteria, i.e. the plan must be "evaluation" and they have to be newer than 10 days.

    def filter_applications(domain, provider_key, plan_name, num_of_days)
      res = api_call_applications_list(domain, provider_key)
      res.each do |item|
        res.delete(item) if item["plan_name"] != plan_name
        res.delete(item) if item["created_at"] > ( - num_of_days)
      return res
  3. Then for each application that meets the criteria, get its usage, meaning how many hits the application has had in the last 10 days.

    def api_call_application_usage(domain, provider_key, application_id, metric, from, to, granularity)
      url = "https://#{domain}/stats/applications/#{application_id}/usage.xml?provider_key=#{provider_key}&metric_name=#{metric}&since=#{from}&until=#{to}&granularity=#{granularity}"
      response = RestClient.get url
      raise"Wrong response code (#{response.code}) in request #{url}") if response.code!=200
      document = Nokogiri::XML(response.to_str)
      return document.xpath("//usage/data/values").text.split(",")
  4. Cross-reference the applications to the accounts, because the information of the developers is stored in the account object.

    def api_call_account_read(domain, provider_key, account_id)
      url = "https://#{domain}/admin/api/accounts/#{account_id}.xml?provider_key=#{provider_key}"
      response = RestClient.get url
      raise"Wrong response code (#{response.code}) in request #{url}") if response.code!=200
      document = Nokogiri::XML(response.to_str)
      account =
      account["email"] = document.xpath("//users/user/email").text
      account["name"] = document.xpath("//users/user/first_name").text + " " + document.xpath("//users/user/last_name").text
      return account

    Now you only need to put everything together, and the script is done. You have a script that gets the information that was not yet available on 3scale’s built-in analytics. You can also get the full script as a gist.

30.5. Conclusions

3scale is very DIY-friendly. We believe that anyone should be able to extend the current capabilities of any service that they’ve contracted. As much as we would like to think that we can cover all the bases, we will always be a bit behind in certain aspects, whether because it’s a super special need or simply because we are busy building other features. Whatever the case, we want to avoid blocking you when something is not possible right away. We give you full access to your data and a complete API toolset to work with it.

If you have scripts that you want to share with us and the rest of 3scale’s users, please send them to us. We would be happy to collect them and publish them.

Chapter 31. Out-of-the-box analytics

This tutorial explains how to find visual information on the traffic of an application.

Each application using an API has a traffic trace in the 3scale system, which can be viewed from the Admin Portal as well as recovered by an API.

To view traffic analytics for an application:

  1. Navigate to the application for which you want to view analytics.

    You can find the application from Audience > Accounts > Listing or Audience > Applications > Listing under the Applications tab. Alternatively, you can search an application following the steps described in the finding applications tutorial.

  2. After you have located the application, you will see an overview page with information about the application as shown in the following image:

    Application display

    The items labeled in the image correspond to the following information:

    1. The name of the application given by the developer.
    2. Meta data captured for the application (learn how to set which data to capture in the advanced section).
    3. The status of the application – is it live or suspended?
    4. The current API identifiers, keys, and certificates that the application has. The view varies depending on what authentication method you are using to integrate the API into 3scale.
    5. A summary of traffic statistics for the application.
    6. Information on which application plan the application is on and which rate limits apply.
  3. Click the Analytics link above the application name. The usage charts are displayed for the application. Controlling the metrics, methods, and time range allows you to check different types of data about the application.

Chapter 32. Response code tracking

This tutorial shows how to set up and use the response codes log in the 3scale system.

Tracking response codes from your API product is a way to see how your clients are using the API, and to see in real time whether everything is fine with your servers.

To enable response code tracking feature, set the APICAST_RESPONSE_CODES environment variable to 1 or true when starting APIcast gateway using Docker or OpenShift deployment.

When enabled, APIcast gateway captures the HTTP status code of API responses returned by the upstream service for authorized calls, and sends them to the Service Management API (in authrep call). Example:{SERVICE_TOKEN}&service_id={SERVICE_ID}&user_key={USER_KEY}&usage%5Bhits%5D=1&log%5Bcode%5D=200"

In this example,log[code]=200 is sent, which means that the API responded with a 200 status code.

To verify the integration, perform a call to your API product with valid 3scale credentials, and then verify that the call was correctly reported on the Analytics > Usage page.

Usage screen

If everything is going well so far, go to the Analytics >Response codes page. You should be able to see a graph with your latest traffic divided by colors, depending if the response was 2xx, 4xx, or 5xx.

response codes screen

The graph tool gives you the ability to view the history of response codes. You can also check the response code statistics for different periods of time and different levels of granularity. Simply click on the time selection bar and define the time period and granularity that will fit your needs.

Legal Notice

Copyright © 2021 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.