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

# Create Service Spec

> Create a service spec defining how an app should run inside a workspace.

Service specs are templates for app configuration - port mappings, health checks, environment variables, and startup commands.


## OpenAPI

````yaml POST /api/v1/service-specs
openapi: 3.1.0
info:
  title: Rigbox Public API
  description: >-
    Gateway-owned public API for Rigbox. The gateway composes its local
    lifecycle API with service-owned exported specs.
  contact:
    name: Rigbox
    url: https://rigbox.dev
  license:
    name: ''
  version: 1.0.0
servers:
  - url: https://api.rigbox.dev
    description: Production gateway
security: []
tags:
  - name: Workspaces
  - name: CLI
  - name: Observability
  - name: Auth
  - name: API Keys
  - name: Access Control
  - name: Apps
  - name: App Catalog
  - name: Logs
  - name: AI
  - name: Tools
  - name: Snapshots
  - name: SSH Keys
  - name: Templates
  - name: Setup Scripts
  - name: Service Specs
  - name: Deploy
  - name: Community
  - name: User Settings
  - name: Roadmap
  - name: System
paths:
  /api/v1/service-specs:
    post:
      tags:
        - Service Specs
      summary: Create a new service spec.
      description: Create a new reusable service spec on the user's account.
      operationId: create_service_spec
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateServiceSpecRequest'
        required: true
      responses:
        '201':
          description: Service spec created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceSpecResponse'
      security:
        - bearer: []
components:
  schemas:
    CreateServiceSpecRequest:
      type: object
      required:
        - name
        - exec_start
      properties:
        auto_enable:
          type: boolean
        env_vars:
          type:
            - object
            - 'null'
          additionalProperties:
            type: string
          propertyNames:
            type: string
        environment_file:
          type:
            - string
            - 'null'
        exec_start:
          type: string
        name:
          type: string
        restart_policy:
          type: string
        setup_script:
          type:
            - string
            - 'null'
    ServiceSpecResponse:
      type: object
      required:
        - id
        - user_id
        - name
        - exec_start
        - env_vars
        - restart_policy
        - auto_enable
        - systemd_unit_preview
        - source
        - created_at
        - updated_at
      properties:
        auto_enable:
          type: boolean
        created_at:
          type: string
        env_vars:
          type: object
          additionalProperties:
            type: string
          propertyNames:
            type: string
        exec_start:
          type: string
        id:
          type: string
        name:
          type: string
        restart_policy:
          type: string
        source:
          type: string
        systemd_unit_preview:
          type: string
          description: Preview of the systemd unit that would be generated
        updated_at:
          type: string
        user_id:
          type: string
  securitySchemes:
    bearer:
      type: http
      scheme: bearer

````