> ## 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.

# Create an app

> Creates an app in one of your networks. New apps get a few default environment variables for their platform. The app's name is also its default subdomain (`<name>.liara.run`) and must be unique across Liara.

Your balance must be high enough to cover your services, including the new app. Your account must be verified. With `teamID`, your role needs the `project.create` permission.



## OpenAPI

````yaml /spec/paas.yaml post /v1/projects
openapi: 3.0.1
info:
  title: Apps & Deployments
  version: 1.0.0
  description: >
    Create apps, deploy them, change their plans and settings, and read

    their logs, metrics and events.


    ## Identifying an app


    Most endpoints identify an app by its **name** (`project_id`, for

    example `my-app`). Some use its **ID** instead (`projectID`, the
    24-character

    `_id` returned when you create or list apps). Each endpoint says which one

    it expects.


    ## Deploying


    1. Upload your source code as a `.tar.gz` or `.zip` archive with
       `POST /v2/projects/{project_id}/sources`. You get a `sourceID`.
    2. Create a release with `POST /v2/projects/{project_id}/releases`, passing
       the `sourceID`. For `docker` apps you can pass a ready-made `image`
       instead.
    3. Follow the build with `GET /v2/releases/{releaseID}/build-logs` and
       check the release `state` with `GET /v1/releases/{releaseID}` until it's
       `READY` (or `FAILED`, `CANCELED`, `TIMEDOUT` or `UNHEALTHY`).

    ## Interactive shell (WebSocket)


    Open a shell in a running app over WebSocket:


    ```text

    wss://api.liara.ir/v1/exec?token=<api-token>&project_id=<app-name>&cmd=<command>

    ```


    - `token`: your API token.

    - `project_id`: the app's name.

    - `cmd`: the command to run, for example `/bin/bash`. URL-encode it.

    - `teamID` (optional): the team that owns the app. You need the `operate`
      or `manage` permission on the app.

    Everything you send is passed to the command's input, and its output is

    sent back to you. If the app has never been deployed successfully, you get

    the message `Service does not exist yet. You should have at least one

    successful release.` and the connection closes. The handshake fails with

    `401` for a missing or invalid token, `400` if `project_id` or `cmd` is

    missing or `teamID` is invalid, `403` without access to the team or app,

    and `404` if the app doesn't exist.


    ## Team permissions


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

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

    a resource permission on that app both count.
servers:
  - url: https://api.liara.ir
security:
  - bearerAuth: []
tags:
  - name: Apps
    description: Create, list, inspect and delete apps.
  - name: Configuration
    description: Environment variables, port, DNS servers, plans and scaling.
  - name: Settings
    description: >-
      Read-only filesystem, default subdomain, zero-downtime deployment and
      fixed outbound IP.
  - name: Deployments
    description: Upload source code, create releases, follow builds and roll back.
  - name: Logs, Metrics & Events
    description: Runtime logs, resource usage and lifecycle events.
  - name: Networks
    description: Private networks that apps and databases are created in.
paths:
  /v1/projects:
    post:
      tags:
        - Apps
      summary: Create an app
      description: >-
        Creates an app in one of your networks. New apps get a few default
        environment variables for their platform. The app's name is also its
        default subdomain (`<name>.liara.run`) and must be unique across Liara.


        Your balance must be high enough to cover your services, including the
        new app. Your account must be verified. With `teamID`, your role needs
        the `project.create` permission.
      operationId: createApp
      parameters:
        - $ref: '#/components/parameters/TeamID'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - planID
                - platform
                - network
                - bundlePlanID
              properties:
                name:
                  type: string
                  minLength: 3
                  maxLength: 50
                  pattern: ^[a-z0-9][a-z0-9\-]+[a-z0-9]$
                  description: >-
                    Lowercase letters, digits and hyphens; can't start or end
                    with a hyphen.
                planID:
                  $ref: '#/components/schemas/AppPlanID'
                bundlePlanID:
                  $ref: '#/components/schemas/BundlePlanID'
                platform:
                  $ref: '#/components/schemas/Platform'
                network:
                  type: string
                  pattern: ^[0-9a-fA-F]{24}$
                  description: ID of one of your networks (see `GET /v1/networks`).
                readOnlyRootFilesystem:
                  type: boolean
                  description: >-
                    Make the app's filesystem read-only, except for its disks.
                    Defaults to `false` for `docker` and `next` apps and `true`
                    for the others.
                isOneClickApp:
                  type: boolean
                  default: false
                  description: >-
                    Create the app for a one-click app. Its platform is set to
                    `docker`.
            example:
              name: my-app
              planID: small-g2
              bundlePlanID: standard
              platform: node
              network: '000000000000000000000160'
      responses:
        '200':
          description: The app was created.
          content:
            application/json:
              schema:
                type: object
                properties:
                  projectID:
                    type: string
                    description: The new app's ID.
              example:
                projectID: '000000000000000000000050'
        '400':
          description: >-
            The body or `teamID` is invalid; `network` is missing
            (`network_is_required`); `planID` isn't one of the plans listed here
            (`g1_plan_unavailable`); or the bundle plan isn't available for this
            plan.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                statusCode: 400
                error: Bad Request
                message: network_is_required
                data: null
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/NotEnoughBalance'
        '403':
          description: >-
            Your account isn't verified (`account_verification_required`), or,
            with `teamID`, you aren't a member (`team_not_found`) or your role
            lacks `project.create` (`no_permission`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: The network doesn't exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                statusCode: 404
                error: Not Found
                message: Network not found
                data: null
        '409':
          description: The name is taken or reserved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                statusCode: 409
                error: Conflict
                message: Project exists.
                data: null
        '429':
          description: Your balance is too low to cover your services with the new app.
          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'
  schemas:
    AppPlanID:
      type: string
      description: >-
        The app's resource plan. See Liara's pricing page for what each plan
        includes.
      enum:
        - small-g2
        - medium-g2
        - standard-base-g2
        - standard-plus-g2
        - pro-g2
        - pro-plus-g2
        - pro-max-g2
    BundlePlanID:
      type: string
      description: >-
        The app's bundle plan, which sets limits and features such as backups,
        log retention, deployments per day, domains, disks, zero-downtime
        deployment and rollback.
      enum:
        - basic
        - standard
        - pro
    Platform:
      type: string
      description: The app's platform.
      enum:
        - node
        - next
        - react
        - vue
        - angular
        - static
        - laravel
        - php
        - django
        - flask
        - python
        - netcore
        - dotnet
        - go
        - docker
    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
  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.