## Resize a Service

**post** `/projects/{project_id}/services/{service_id}/resize`

Changes the CPU and memory allocation for a specific service within a project. This is an asynchronous operation.

### Path Parameters

- `project_id: string`

- `service_id: string`

### Body Parameters

- `cpu_millis: string`

  The new CPU allocation in milli-cores.

- `memory_gbs: string`

  The new memory allocation in gigabytes.

### Returns

- `Service = object { connection_pooler, created, endpoint, 14 more }`

  - `connection_pooler: optional ConnectionPooler`

    - `endpoint: optional Endpoint`

      - `host: optional string`

      - `port: optional number`

  - `created: optional string`

    Creation timestamp

  - `endpoint: optional Endpoint`

  - `forked_from: optional object { is_standby, project_id, service_id }`

    - `is_standby: optional boolean`

    - `project_id: optional string`

    - `service_id: optional string`

  - `ha_replicas: optional object { replica_count, sync_replica_count }`

    - `replica_count: optional number`

      Number of high-availability replicas (all replicas are asynchronous by default).

    - `sync_replica_count: optional number`

      Number of synchronous high-availability replicas.

  - `initial_password: optional string`

    The initial password for the service.

  - `metadata: optional object { environment }`

    Additional metadata for the service

    - `environment: optional string`

      Environment tag for the service

  - `metrics: optional object { memory_mb, milli_cpu, storage_mb }`

    Resource usage metrics for the service

    - `memory_mb: optional number`

      Memory usage in megabytes

    - `milli_cpu: optional number`

      CPU usage in millicores

    - `storage_mb: optional number`

      Storage usage in megabytes

  - `name: optional string`

    The name of the service.

  - `project_id: optional string`

    The project this service belongs to.

  - `read_replica_sets: optional array of ReadReplicaSet`

    - `id: optional string`

    - `connection_pooler: optional ConnectionPooler`

    - `cpu_millis: optional number`

      CPU allocation in milli-cores.

    - `endpoint: optional Endpoint`

    - `memory_gbs: optional number`

      Memory allocation in gigabytes.

    - `metadata: optional object { environment }`

      Additional metadata for the read replica set

      - `environment: optional string`

        Environment tag for the read replica set

    - `name: optional string`

    - `nodes: optional number`

      Number of nodes in the replica set.

    - `status: optional "creating" or "active" or "resizing" or 2 more`

      - `"creating"`

      - `"active"`

      - `"resizing"`

      - `"deleting"`

      - `"error"`

  - `region_code: optional string`

    The cloud region where the service is hosted.

  - `resources: optional array of object { id, spec }`

    List of resources allocated to the service

    - `id: optional string`

      Resource identifier

    - `spec: optional object { cpu_millis, memory_gbs, volume_type }`

      Resource specification

      - `cpu_millis: optional number`

        CPU allocation in millicores

      - `memory_gbs: optional number`

        Memory allocation in gigabytes

      - `volume_type: optional string`

        Type of storage volume

  - `service_id: optional string`

    The unique identifier for the service.

  - `service_type: optional "TIMESCALEDB" or "POSTGRES" or "VECTOR"`

    The type of the service.

    - `"TIMESCALEDB"`

    - `"POSTGRES"`

    - `"VECTOR"`

  - `status: optional "QUEUED" or "DELETING" or "CONFIGURING" or 8 more`

    Current status of the service

    - `"QUEUED"`

    - `"DELETING"`

    - `"CONFIGURING"`

    - `"READY"`

    - `"DELETED"`

    - `"UNSTABLE"`

    - `"PAUSING"`

    - `"PAUSED"`

    - `"RESUMING"`

    - `"UPGRADING"`

    - `"OPTIMIZING"`

  - `vpcEndpoint: optional unknown`

    VPC endpoint configuration if available

### Example

```http
curl http://localhost:8080/projects/$PROJECT_ID/services/$SERVICE_ID/resize \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $TIGER_CLOUD_API_KEY" \
    -d '{
          "cpu_millis": "1000",
          "memory_gbs": "4"
        }'
```

#### Response

```json
{
  "connection_pooler": {
    "endpoint": {
      "host": "my-service.com",
      "port": 8080
    }
  },
  "created": "2019-12-27T18:11:19.117Z",
  "endpoint": {
    "host": "my-service.com",
    "port": 8080
  },
  "forked_from": {
    "is_standby": false,
    "project_id": "asda1b2c3",
    "service_id": "bbss422fg"
  },
  "ha_replicas": {
    "replica_count": 1,
    "sync_replica_count": 1
  },
  "initial_password": "a-very-secure-initial-password",
  "metadata": {
    "environment": "environment"
  },
  "metrics": {
    "memory_mb": 512,
    "milli_cpu": 250,
    "storage_mb": 1024
  },
  "name": "name",
  "project_id": "project_id",
  "read_replica_sets": [
    {
      "id": "alb8jicdpr",
      "connection_pooler": {
        "endpoint": {
          "host": "my-service.com",
          "port": 8080
        }
      },
      "cpu_millis": 250,
      "endpoint": {
        "host": "my-service.com",
        "port": 8080
      },
      "memory_gbs": 1,
      "metadata": {
        "environment": "environment"
      },
      "name": "reporting-replica-1",
      "nodes": 2,
      "status": "active"
    }
  ],
  "region_code": "us-east-1",
  "resources": [
    {
      "id": "id",
      "spec": {
        "cpu_millis": 0,
        "memory_gbs": 0,
        "volume_type": "volume_type"
      }
    }
  ],
  "service_id": "service_id",
  "service_type": "TIMESCALEDB",
  "status": "QUEUED",
  "vpcEndpoint": {}
}
```
