> ## Documentation Index
> Fetch the complete documentation index at: https://developers.liara.ir/llms.txt
> Use this file to discover all available pages before exploring further.

# Change the database's plan

> Moves a running database to another plan that supports its type and has at least as much storage. With `disk: true`, the disk also grows to the new plan's size; except for `mongodb`, turn the database off first (see `POST /v1/databases/{databaseID}/actions/scale`). Your balance must be high enough for the new plan. Team permission: `manage`.



## OpenAPI

````yaml /spec/dbaas.yaml post /v1/databases/{databaseID}/resize
openapi: 3.0.1
info:
  title: Databases
  version: 1.0.0
  description: >
    Create managed databases, connect to them, change their plans and

    settings, back them up and restore them, and read their metrics and

    events.


    Supported types: `mysql`, `mariadb`, `postgres`, `mongodb`, `redis`,

    `mssql`, `elasticsearch`, `rabbitmq` and `clickhouse`. Databases are

    created in one of your private networks (see Networks in Apps &

    Deployments).


    ## Connecting


    `GET /v1/databases/{databaseID}` returns the connection details:


    - **From apps in the same network:** `hostname` and `internalPort`.

    - **Over the public network** (if `publicNetwork` is on):
    `network.node.host`
      and `port`.
    - **Credentials:** `username` and `root_password`.


    ## Team permissions


    With `teamID`, each endpoint needs one of the database permissions it

    lists (`view`, `operate` or `manage`). A permission from your role or a

    resource permission on that database both count.
servers:
  - url: https://api.liara.ir
security:
  - bearerAuth: []
tags:
  - name: Databases
    description: Create, list, inspect and delete databases.
  - name: Configuration
    description: Plans, scaling, settings, public network, password and control panel.
  - name: Backups
    description: Back up databases, download backups and import backup files.
  - name: Metrics & Events
    description: >-
      Resource usage, lifecycle events and the progress of background
      operations.
paths:
  /v1/databases/{databaseID}/resize:
    post:
      tags:
        - Configuration
      summary: Change the database's plan
      description: >-
        Moves a running database to another plan that supports its type and has
        at least as much storage. With `disk: true`, the disk also grows to the
        new plan's size; except for `mongodb`, turn the database off first (see
        `POST /v1/databases/{databaseID}/actions/scale`). Your balance must be
        high enough for the new plan. Team permission: `manage`.
      operationId: changeDatabasePlan
      parameters:
        - $ref: '#/components/parameters/TeamID'
        - $ref: '#/components/parameters/DatabaseID'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - planID
                - disk
              properties:
                planID:
                  $ref: '#/components/schemas/DatabasePlanID'
                disk:
                  type: boolean
                  default: false
                  description: Also grow the disk to the new plan's size.
            example:
              planID: medium-g2
              disk: true
      responses:
        '200':
          description: The resize started. The response body is empty.
        '400':
          description: >-
            The body or `teamID` is invalid, or: the plan doesn't support this
            type, has less storage, or can't be used for this database
            (`g2_plan_unavailable`); the disk is in use (`disk_is_busy`); or a
            resize is already running.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                statusCode: 400
                error: Bad Request
                message: disk_is_busy
                data: null
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/NotEnoughBalance'
        '403':
          $ref: '#/components/responses/TeamForbidden'
        '404':
          description: No running database with this ID.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  parameters:
    TeamID:
      name: teamID
      in: query
      required: false
      description: >-
        Run the request in the context of a team you belong to, instead of your
        personal account.
      schema:
        $ref: '#/components/schemas/ObjectID'
      example: '000000000000000000000002'
    DatabaseID:
      name: databaseID
      in: path
      required: true
      description: The database's `_id`.
      schema:
        $ref: '#/components/schemas/ObjectID'
      example: '000000000000000000000300'
  schemas:
    DatabasePlanID:
      type: string
      description: >-
        The database's resource plan. `small-g2` and `medium-g2` don't support
        `mssql` or `clickhouse`, and `small-g2` doesn't support `elasticsearch`.
        See Liara's pricing page for what each plan includes.
      enum:
        - small-g2
        - medium-g2
        - standard-base-g2
        - standard-pro-g2
        - pro-g2
        - pro-plus-g2
        - pro-max-g2
    Error:
      type: object
      description: Standard error body.
      properties:
        statusCode:
          type: integer
        error:
          type: string
          description: HTTP status text.
        message:
          type: string
          description: What went wrong.
        data:
          type: object
          nullable: true
          description: >-
            Extra details. When present, `code` is a stable, machine-readable
            error code.
          properties:
            code:
              type: string
    ObjectID:
      type: string
      pattern: ^[0-9a-fA-F]{24}$
      description: 24-character hexadecimal ID.
    AuthError:
      type: object
      description: Error body returned when the API token is rejected.
      properties:
        error:
          type: string
  responses:
    Unauthorized:
      description: The API token is missing, invalid or expired.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AuthError'
          example:
            error: Unauthorized.
    NotEnoughBalance:
      description: Your balance is too low.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 402
            error: Payment Required
            message: Not enough balance.
            data: null
    TeamForbidden:
      description: >-
        With `teamID`: you aren't a member of the team (`team_not_found`), or
        you don't have the required permission on this database
        (`no_permission`).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            teamNotFound:
              summary: Not a team member
              value:
                statusCode: 403
                error: Forbidden
                message: Team not found
                data:
                  code: team_not_found
            noPermission:
              summary: Missing permission
              value:
                statusCode: 403
                error: Forbidden
                message: You do not have permission to access this resource.
                data:
                  code: no_permission
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Send your API token as `Authorization: Bearer <api-token>`.'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.