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

# Create app service

> Create an app service. Provisioning is asynchronous — the service is
created in status `pending` and moves through `building` and
`deploying` to `live`; poll `GET /api/v1/apps/services/{service_id}`
for progress.

Choose a `service_type`: `web` (public HTTPS URL), `private`
(in-cluster only), `worker` (long-running, no URL), `cron`
(scheduled), or `job` (one-off). Pick a `source_type`: `git` (a
connected GitHub repo), `image` (a prebuilt image), `template` (a
starter), or `compose`. Deploy code afterwards with a source upload
and a deployment, or set `deploy_now` for image sources.




## OpenAPI

````yaml POST /api/v1/apps/services
openapi: 3.0.3
info:
  title: Raff API
  description: >
    REST API for managing cloud infrastructure on Raff.


    ## Authentication

    Most endpoints require authentication via API key. Catalog endpoints under
    `/api/v1/public/` are open and require no authentication.


    ### API Key Authentication

    Include your API key in the `X-API-Key` header:
      ```
      curl -H "X-API-Key: YOUR_API_KEY" https://api.rafftechnologies.com/api/v1/vms
      ```

    ## Catalog

    Use the public catalog endpoints to discover available regions, OS
    templates, and pricing plans before creating resources:

    - `GET /api/v1/public/regions` — list available regions

    - `GET /api/v1/public/templates` — list OS templates (use the `id` as
    `template_id` when creating a VM)

    - `GET /api/v1/public/pricing/vm` — list VM pricing plans (use the `id` as
    `pricing_id` when creating a VM)

    - `GET /api/v1/public/pricing/volume` — volume storage pricing

    - `GET /api/v1/public/pricing/snapshot` — snapshot storage pricing

    - `GET /api/v1/public/pricing/backup` — backup storage pricing

    - `GET /api/v1/public/pricing/ip` — IP address pricing

    - `GET /api/v1/public/pricing/database` — managed database pricing (plans,
    high availability, read replicas, extra storage)

    - `GET /api/v1/public/pricing/kubernetes` — managed Kubernetes pricing
    (worker node plans, HA control plane, storage nodes)
  version: 1.0.0
  contact:
    name: Raff Technologies
    url: https://rafftechnologies.com
servers:
  - url: https://api.rafftechnologies.com
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Catalog
    description: >-
      Discover available regions, OS templates, and pricing plans. No
      authentication required.
  - name: Health
    description: Health check endpoints
  - name: Projects
    description: Organize resources into projects for billing and access control
  - name: Virtual Machines
  - name: Kubernetes
    description: >-
      Managed Kubernetes clusters — HA control planes, autoscaling node pools,
      kubeconfig access
  - name: Functions
    description: Deploy and manage serverless functions
  - name: Raff Apps
    description: >-
      Push-to-deploy web services, private services, workers, cron jobs, and
      one-off jobs on the Raff PaaS — with custom domains, environment
      variables, autoscaling, and per-second billing with spend caps
  - name: Managed Databases
    description: >-
      Fully managed PostgreSQL and Valkey databases with private VPC networking,
      automatic backups, and metrics
  - name: Networking
    description: >-
      Attach and detach VPCs, floating IPs, and security groups to VM network
      interfaces
  - name: Snapshots
    description: Point-in-time copies of VMs and volumes for quick rollback or cloning
  - name: Backups
    description: Scheduled and on-demand VM backups with restore capability
  - name: Backup Schedules
    description: Recurring daily or weekly backup schedules attached to a VM
  - name: SSH Keys
    description: Manage account-level SSH keys for VM provisioning
  - name: Members
    description: Account-level members — invite, list, update role, remove
  - name: Project Members
    description: Members of a specific project — same model as Members but project-scoped
  - name: Roles
    description: Custom roles bundling account or project permissions
  - name: Permissions
    description: List the catalog of permission strings used by roles
  - name: API Keys
    description: Create and manage API keys for programmatic access
  - name: Invitations
    description: Create and cancel email-based invitations to join the account or a project
paths:
  /api/v1/apps/services:
    post:
      tags:
        - Raff Apps
      summary: Create app service
      description: |
        Create an app service. Provisioning is asynchronous — the service is
        created in status `pending` and moves through `building` and
        `deploying` to `live`; poll `GET /api/v1/apps/services/{service_id}`
        for progress.

        Choose a `service_type`: `web` (public HTTPS URL), `private`
        (in-cluster only), `worker` (long-running, no URL), `cron`
        (scheduled), or `job` (one-off). Pick a `source_type`: `git` (a
        connected GitHub repo), `image` (a prebuilt image), `template` (a
        starter), or `compose`. Deploy code afterwards with a source upload
        and a deployment, or set `deploy_now` for image sources.
      operationId: createAppService
      parameters:
        - $ref: '#/components/parameters/ProjectIDHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAppServiceRequest'
      responses:
        '201':
          description: App service created (status `pending` while provisioning)
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  service:
                    $ref: '#/components/schemas/AppService'
                  deployment_id:
                    type: string
                    format: uuid
                    description: Set when a deployment was queued at create time
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/InsufficientBalance'
        '403':
          $ref: '#/components/responses/BillingValidationFailed'
        '409':
          description: A service with this name already exists in the project
components:
  parameters:
    ProjectIDHeader:
      name: X-Project-ID
      in: header
      required: true
      description: >-
        Project ID. Required for all mutating operations (create, delete, power
        actions, resize).
      schema:
        type: string
        format: uuid
  schemas:
    CreateAppServiceRequest:
      type: object
      required:
        - name
        - service_type
      properties:
        name:
          type: string
        description:
          type: string
        service_type:
          type: string
          enum:
            - web
            - private
            - worker
            - cron
            - job
        source_type:
          type: string
          enum:
            - git
            - image
            - template
            - compose
        builder:
          type: string
          enum:
            - buildpacks
            - dockerfile
            - image
        image_ref:
          type: string
          description: Prebuilt image reference (for source_type `image`)
        repo_full_name:
          type: string
          description: GitHub repo (owner/name) for source_type `git`
        repo_branch:
          type: string
        repo_root_dir:
          type: string
        dockerfile_path:
          type: string
        start_command:
          type: string
        tier_id:
          type: integer
        replicas:
          type: integer
        autoscaling_enabled:
          type: boolean
        min_replicas:
          type: integer
        max_replicas:
          type: integer
        scale_to_zero:
          type: boolean
        http_port:
          type: integer
        health_check_path:
          type: string
        cron_schedule:
          type: string
        cron_timezone:
          type: string
        region:
          type: string
        deploy_now:
          type: boolean
          description: Queue a deployment immediately (prebuilt-image services)
    AppService:
      type: object
      description: >-
        An app service on the Raff PaaS — a web service, private service,
        worker, cron job, or one-off job.
      properties:
        id:
          type: string
          format: uuid
        service_id:
          type: string
          description: Short reference id used in URLs
        project_id:
          type: string
          format: uuid
        name:
          type: string
          description: Display name, unique within the project
        slug:
          type: string
          description: URL label — the name plus a short random suffix
        description:
          type: string
        service_type:
          type: string
          enum:
            - web
            - private
            - worker
            - cron
            - job
        source_type:
          type: string
          enum:
            - git
            - image
            - template
            - compose
        builder:
          type: string
          enum:
            - buildpacks
            - dockerfile
            - image
        repo_full_name:
          type: string
          description: GitHub source only (owner/name)
        repo_branch:
          type: string
        repo_root_dir:
          type: string
        dockerfile_path:
          type: string
        image_ref:
          type: string
          description: Prebuilt image source only
        start_command:
          type: string
        tier_id:
          type: integer
          description: Pricing tier ID (see `GET /api/v1/apps/tiers`)
        tier_name:
          type: string
        replicas:
          type: integer
        autoscaling_enabled:
          type: boolean
        min_replicas:
          type: integer
        max_replicas:
          type: integer
        autoscaling_metric:
          type: string
        autoscaling_target:
          type: integer
        scale_to_zero:
          type: boolean
        http_port:
          type: integer
        health_check_path:
          type: string
        cron_schedule:
          type: string
          description: Cron services only
        cron_timezone:
          type: string
        region:
          type: string
        url:
          type: string
          description: Public HTTPS endpoint (web services; automatic TLS)
        internal_host:
          type: string
          description: In-cluster hostname (private services)
        status:
          type: string
          enum:
            - pending
            - building
            - deploying
            - live
            - paused
            - suspended
            - error
            - deleting
            - deleted
        status_message:
          type: string
        paused_by_cap:
          type: boolean
          description: True when a spend cap paused the service
        billing_type:
          type: string
          enum:
            - payg
            - subscription
        current_deployment_id:
          type: string
          format: uuid
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
    BillingError:
      type: object
      description: >-
        Billing validation error response. Returned when the account is not in
        good standing for paid operations.
      required:
        - error
        - reason
      properties:
        error:
          type: string
          example: Billing validation failed
        message:
          type: string
          example: Payment failed. Please update your payment method.
        reason:
          type: string
          description: >
            Machine-readable reason code:

            - `banned` — account has been suspended

            - `failed` — last payment failed; balance top-up needed

            - `no_billing_customer` — billing has not been set up for this
            account
          enum:
            - banned
            - failed
            - no_billing_customer
  responses:
    BadRequest:
      description: Invalid request parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Authentication required
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InsufficientBalance:
      description: >
        Account balance is insufficient for this operation. Top up the balance
        and retry.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Payment Required
            message: Insufficient balance for subscription
    BillingValidationFailed:
      description: |
        Billing validation failed. The account is not in good standing.
        Check the `reason` field:
        - `banned` — account suspended
        - `failed` — last payment failed; top up the account balance
        - `no_billing_customer` — billing not set up
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/BillingError'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key for authentication. Each key is bound to a specific account.

````