Tanzu Platform for Cloud Foundry 10.0

Using the App Autoscaler API for your Tanzu Platform for Cloud Foundry deployment

Last Updated March 13, 2025

You can the App Autoscaler API as an interface to App Autoscaler to configure and control scaling apps in your Tanzu Platform for Cloud Foundry deployment.

You can use the App Autoscaler Cloud Foundry command-line interface (cf CLI) plug-in, which offers the same features as the App Autoscaler API. See Using the App Autoscaler CLI.

API endpoints

The API is exposed by the autoscale-api app that runs next to the autoscale app in the autoscaling space of the system org. This is the base URL of all the requests covered in the following sections.

If your system domain is system-domain.com, in most cases you can reach the autoscale app at autoscale.sys.system-domain.com and the API at autoscale.sys.system-domain.com/api/v2. Confirm that you can reach both the app and the API before you proceed.

Authentication

You must pass an access token to each API endpoint. The access token is expected as-is on the Authorization header of each request.

When you are logged in to your foundation with the cf CLI, get an access token by running cf oauth-token.

Note The App Autoscaler API often returns a 404 error when a token is incorrect. If you are receiving a lot of 404 errors, verify your access token.

Content type header

To make any PUT or POST requests, you must set the Content-Type header to application/json. If you do not set this, you might see the following error:

"Your token is invalid or the autoscaled application does not exist"

This error can appear regardless of the token you use.

Pagination

Most list calls use pagination. The App Autoscaler API uses a standard form of pagination that is very similar to how the Cloud Foundry API (CAPI) uses pagination.

The following example shows a paginated response from the App Autoscaler API:

 {
  "pagination": {
    "total_results": 1,
    "total_pages": 1,
      "last": {
        "href": "https://autoscale.sys.example.com/api/v2/apps?space_guid=676e592a-a4e8-43d9-8128-f583c0b45db8&page=1"
      },
      "next": null,
      "first": {
        "href": "https://autoscale.sys.example.com/api/v2/apps?space_guid=676e592a-a4e8-43d9-8128-f583c0b45db8&page=1"
      },
      "previous": null
    },
    "resources": [
      ...list of objects...
    ]
}

Information

GET /api/v2/info

Parameters

None

Returns

A string denoting the App Autoscaler API version.

App bindings

This section lists operations for app bindings.

Apps that are bound to App Autoscaler are represented by the App Autoscaler API as apps.

App binding object

NameTypeDescription
created_atstringThe timestamp for when this object was created
cooldown_period_in_secondsintThe amount of seconds to wait after scaling before considering for subsequent scaling
enabledBooleanActivates or deactivates scaling by App Autoscaler for this app
guidstringThe app GUID from CAPI
instance_limits.maxintegerThe maximum instance count that this app is approved
instance_limits.minintegerThe minimum instance count that this app is approved
scaling_factors.upintegerThe number of instances to increment by when scaling up
scaling_factors.downintegerThe number of instances to decrement by when scaling down
updated_atstringThe timestamp for when this object was last updated

Get all app bindings in a space

GET /api/v2/apps

Parameters

ParameterInTypeRequiredDescription
space_guidquerystringtrueThe GUID of the space from which you want to get all app bindings
pagequeryintegerfalseThe page of events to get

Returns

A paginated list of app bindings.

Get an app binding

GET /api/v2/apps/:app_guid

Parameters

ParameterInTypeRequiredDescription
app_guidpathstringtrueThe GUID of the app to get the binding for

Returns

An app binding.

Update an app binding

PUT /api/v2/apps/:app_guid

Parameters

ParameterInTypeRequiredDescription
app_guidpathstringtrueThe GUID of the app to update the binding for
cooldown_period_in_secondsbodyintfalseThe amount of seconds to wait after scaling before considering for subsequent scaling
enabledbodyBooleanfalseActivates or deactivates scaling by App Autoscaler for this app
instance_limits.maxbodyintegerfalseThe maximum instance count that this app is approved
instance_limits.minbodyintegerfalseThe minimum instance count that this app is approved
scaling_factors.up integer The number of instances to increment by when scaling up
scaling_factors.down integer The number of instances to decrement by when scaling down

Returns

An app binding.

Events

This section lists operations to retrieve events.

Scaling events include all scaling decisions made by App Autoscaler and other relevant changes. For example, an app is activated or deactivated.

Event object

NameTypeDescription
created_atstringThe timestamp for when this object was created
descriptionstringA description of the event
scaling_factorintegerThe change in number of instances
updated_atstringThe timestamp for when this object was last updated

Get all events for an app

GET /api/v2/apps/:app_guid/events

Parameters

ParameterInTypeRequiredDescription
app_guidpathstringtrueThe GUID of the app to retrieve events for
pagequeryintegerfalseThe page of events to get

Returns

A paginated list of events.

Rules

This section lists operations for rules.

Rules are tied to individual apps, and no one app can have multiple rules of the same category.

Rule object

NameTypeDescription
created_atstringThe timestamp for when this object was created
comparison_metricstringThe divisor to compare metrics against
guidstringThe GUID for this particular object
metricstringThe metric on which scaling decisions are made
queue_namestringThe name of the queue to monitor for RabbitMQ rules
rabbitmq_service_instance_guidstringThe GUID of the RabbitMQ service instance
rule_typestringThe type of rule
rule_sub_typestringThe subtype of rule
threshold.maxfloatThe threshold beyond which the app is scaled up
threshold.minfloatThe threshold below which the app is scaled down
updated_atstringThe timestamp for when this object was last updated

Get all rules for an app

GET /api/v2/apps/:app_guid/rules

Parameters

ParameterInTypeRequiredDescription
app_guidpathstringtrueThe GUID of the app to retrieve rules for
pagequeryintegerfalseThe page of events to get

Returns

A paginated list of rules.

Create a rule

POST /api/v2/apps/:app_guid/rules

Parameters

ParameterInTypeRequiredDescription
app_guidpathstringtrueThe GUID of the app to create a rule for
comparison_metricbodystringfalseThe divisor to compare metrics against
metricbodystringfalseThe metric on which scaling decisions are made
queue_namebodystringfalseThe name of the queue to monitor for RabbitMQ rules
rabbitmq_service_instance_guidstringThe GUID of the RabbitMQ service instance
rule_typebodystringtrueThe type of rule
rule_sub_typebodystringfalseThe subtype of rule
threshold.maxbodyfloattrueThe threshold beyond which the app is scaled up
threshold.minbodyfloattrueThe threshold below which the app is scaled down

Returns

A rule.

Replace all rules

PUT /api/v2/apps/:app_guid/rules

Parameters

ParameterInTypeRequiredDescription
app_guidpathstringtrueThe GUID of the app to set rules for
array of rulesbodyarraytrueAn array of rule objects. See Create a rule.

Returns

A paginated list of rules.

Delete all rules

DELETE /api/v2/apps/:app_guid/rules

Parameters

ParameterInTypeRequiredDescription
app_guidpathstringtrueThe GUID of the app to delete rules for

Returns

A 204 status code and empty body indicating that all rules were deleted.

Get a rule

GET /api/v2/apps/:app_guid/rules/:guid

Parameters

ParameterInTypeRequiredDescription
app_guidpathstringtrueThe GUID of the app to get a rule for
guidpathstringtrueThe GUID of the rule to get

Returns

A rule.

Delete a rule

DELETE /api/v2/apps/:app_guid/rules/:rule_guid

Parameters

ParameterInTypeRequiredDescription
app_guidpathstringtrueThe GUID of the app to delete a rule for
rule_guidpathstringtrueThe GUID of the rule to delete

Returns

A 204 status code and empty body indicating that the rule was deleted.

Scheduled limit changes

This section lists operations for scheduled limit changes (SLCs).

SLCs are jobs scheduled for the future that alter app status, such as enabling, disabling, or instance limits.

Scheduled limit change object

NameTypeDescription
created_atstringThe timestamp for when this object was created
enabledBooleanWhether or not the app is activated or deactivated
executes_atstringThe UTC timestamp indicating when this SLC is first executed
guidstringThe GUID of this object
instance_limits.maxintegerThe maximum instance count that is set on the app
instance_limits.minintegerThe minimum instance count that is set on the app
recurrenceintegerA number that represents the days of the week that the change executes. Each bit in the number represents a day in the following order: sun, mon, tue, wed, thur, fri, sat. For example, repeat mon, wed, fri = 0101010 = 42.
updated_atstringThe timestamp for when this object was last updated

Get All scheduled limit changes for an app

GET /api/v2/apps/:app_guid/scheduled_limit_changes

Parameters

ParameterInTypeRequiredDescription
app_guidpathstringtrueThe GUID of the app to retrieve SLCs for
pagequeryintegerfalseThe page of SLCs to get

Returns

A paginated list of SLCs.

Create a scheduled limit change

POST /api/v2/apps/:app_guid/scheduled_limit_changes

Parameters

ParameterInTypeRequiredDescription
app_guidpathstringtrueThe GUID of the app to create an SLC for
enabledbodyBooleantrueWhether or not the app is activated or deactivated
executes_atbodystringtrueThe UTC timestamp indicating when this SLC is first executed
instance_limits.maxbodyintegertrueThe maximum instance count that is set on the app
instance_limits.minbodyintegertrueThe minimum instance count that is set on the app
recurrencebodystringtrueA number that represents the days of the week that the change executes. Each bit in the number represents a day in the following order: sun, mon, tue, wed, thur, fri, sat. For example, repeat mon, wed, fri = 0101010 = 42.

Returns

An SLC.

Replace all scheduled limit changes for an app

PUT /api/v2/apps/:app_guid/scheduled_limit_changes

Parameters

ParameterInTypeRequiredDescription
app_guidpathstringtrueThe GUID of the app to replace SLCs for
array of SLCsbodyarraytrueAn array of SLC objects. See Create a scheduled limit change.

Returns

A paginated list of SLCs.

Delete all scheduled limit changes for an app

DELETE /api/v2/apps/:app_guid/scheduled_limit_changes

Parameters

ParameterInTypeRequiredDescription
app_guidpathstringtrueThe GUID of the app to replace SLCs for

Returns

A 204 status code and empty body indicating that the SLCs were deleted.

Get a scheduled limit change

GET /api/v2/apps/:app_guid/scheduled_limit_changes/:guid

Parameters

ParameterInTypeRequiredDescription
app_guidpathstringtrueThe GUID of the app to get SLCs for
guidpathstringtrueThe GUID of the SLC to retrieve

Returns

An SLC object.

Delete a scheduled limit change

DELETE /api/v2/apps/:app_guid/scheduled_limit_changes/:guid

Parameters

ParameterInTypeRequiredDescription
app_guidpathstringtrueThe GUID of the app to delete SLCs for
GUIDpathstringtrueThe GUID of the SLC to delete

Returns

A 204 status code and empty body indicating that the SLC was deleted.