# Changing Partition Quantity

#### Function

This API is used to change the number of partitions in a specific stream.

#### URI

PUT /v2/{project_id}/streams/{stream_name}

Table 1 Path parameters
Parameter | Mandatory | Type | Description
--- | --- | --- | ---
project_id | Yes | String | Project ID.
stream_name | Yes | String | Name of the stream whose partition quantity needs to be changed. Maximum: 64

#### Request Parameters

Table 2 Request header parameters
Parameter | Mandatory | Type | Description
--- | --- | --- | ---
X-Auth-Token | Yes | String | User token. The token can be obtained by calling the IAM API (value of X-Subject-Token in the response header).

Table 3 Request body parameters
Parameter | Mandatory | Type | Description
--- | --- | --- | ---
stream_name | Yes | String | Name of the stream whose partition quantity needs to be changed. Maximum: 64

target_partition_count

Yes

Integer

Number of the target partitions.

The value is an integer greater than 0.

If the value is greater than the number of current partitions, scaling-up is required. If the value is less than the number of current partitions, scale-down is required.

Note: A maximum of five scale-up/down operations can be performed for each stream within one hour. If a scale-up/down operation is successfully performed, you cannot perform one more scale-up/down operation within the next one hour.

Minimum: 0

#### Response Parameters

None

#### Example Requests

Changing Partition Quantity

    PUT https://{Endpoint}/v2/{project_id}/streams/{stream_name}

    {
      "stream_name" : "newstream",
      "target_partition_count" : 5
    }

#### Example Responses

None

#### Status Codes

Status Code | Description
--- | ---
200 | Normal response.

#### Error Codes

See Error Codes.

Parent topic: Stream Management