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

# Create background process

> Create a new background process for an instance.



## OpenAPI

````yaml https://cloud.laravel.com/api-docs/api.json post /instances/{instance}/background-processes
openapi: 3.1.0
info:
  title: Laravel Cloud
  version: 0.0.1
servers:
  - url: https://cloud.laravel.com/api
security:
  - http: []
tags:
  - name: Applications
  - name: Environments
  - name: Domains
  - name: Commands
  - name: Deployments
  - name: Instances
  - name: Background Processes
  - name: Database Clusters
  - name: Databases
  - name: Database Snapshots
  - name: Database Restores
  - name: Object Storage Buckets
  - name: Bucket Keys
  - name: Caches
  - name: WebSocket Clusters
  - name: WebSocket Applications
  - name: Dedicated Clusters
  - name: Usage
  - name: Meta
  - name: Databases (Legacy)
paths:
  /instances/{instance}/background-processes:
    post:
      tags:
        - Background Processes
      summary: Create background process
      description: Create a new background process for an instance.
      operationId: public.instances.background-processes.store
      parameters:
        - name: instance
          in: path
          required: true
          description: The instance identifier
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateBackgroundProcessRequest'
      responses:
        '201':
          description: '`BackgroundProcessResource`'
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/BackgroundProcessResource'
                  included:
                    type: array
                    items:
                      $ref: '#/components/schemas/InstanceResource'
                required:
                  - data
        '404':
          $ref: '#/components/responses/ModelNotFoundException'
        '422':
          $ref: '#/components/responses/ValidationException'
components:
  schemas:
    CreateBackgroundProcessRequest:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/DaemonType'
        processes:
          type: integer
          minimum: 1
          maximum: 10
        command:
          type: string
          description: >-
            Custom command to run. Required when type is 'custom'. Not
            applicable for 'worker' type.
          example: php artisan my:command
        config:
          type: object
          properties:
            connection:
              type: string
              description: >-
                The queue connection name. Only applicable for 'worker' type
                background processes.
              example: redis
            queue:
              type: string
              description: >-
                The queue name(s) to process. Can be comma-separated for
                multiple queues. Only applicable for 'worker' type background
                processes.
              example: default,emails
            tries:
              type: integer
              description: >-
                Number of times a job should be attempted. Only applicable for
                'worker' type background processes.
              example: 3
            backoff:
              type: integer
              description: >-
                Number of seconds to wait before retrying a failed job. Only
                applicable for 'worker' type background processes.
              example: 30
            sleep:
              type: integer
              description: >-
                Number of seconds to sleep when no jobs are available. Only
                applicable for 'worker' type background processes.
              example: 3
            rest:
              type: integer
              description: >-
                Number of seconds to rest between jobs. Only applicable for
                'worker' type background processes.
              example: 0
            timeout:
              type: integer
              description: >-
                Number of seconds a job can run before timing out. Only
                applicable for 'worker' type background processes.
              example: 60
            force:
              type: boolean
              description: >-
                Force the worker to run even in maintenance mode. Only
                applicable for 'worker' type background processes.
              example: false
      required:
        - type
        - processes
      title: CreateBackgroundProcessRequest
    BackgroundProcessResource:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - background_processes
        attributes:
          type: object
          properties:
            type:
              $ref: '#/components/schemas/DaemonType'
            processes:
              type: integer
            command:
              type: string
            config:
              type: array
              items: {}
            strategy_type:
              $ref: '#/components/schemas/DaemonStrategyType'
            strategy_threshold:
              type:
                - integer
                - 'null'
            created_at:
              type:
                - string
                - 'null'
              format: date-time
          required:
            - type
            - processes
            - command
            - config
            - strategy_type
            - strategy_threshold
            - created_at
        relationships:
          type: object
          properties:
            instance:
              type: object
              properties:
                data:
                  anyOf:
                    - $ref: '#/components/schemas/InstanceResourceIdentifier'
                    - type: 'null'
              required:
                - data
      required:
        - id
        - type
      title: BackgroundProcessResource
    InstanceResource:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - instances
        attributes:
          type: object
          properties:
            name:
              type: string
            type:
              $ref: '#/components/schemas/InstanceType'
            size:
              $ref: '#/components/schemas/InstanceSize'
            scaling_type:
              $ref: '#/components/schemas/InstanceScalingType'
            min_replicas:
              type: integer
            max_replicas:
              type: integer
            queue_status:
              anyOf:
                - $ref: '#/components/schemas/SqsQueueStatus'
                  description: >-
                    Current lifecycle status of the managed queue. Null for
                    non-queue instances.
                - type: 'null'
            paused:
              type:
                - boolean
                - 'null'
              description: >-
                Whether the managed queue is currently paused. Null for
                non-queue instances.
            is_default:
              type:
                - boolean
                - 'null'
              description: >-
                Whether this is the environment's default managed queue. Null
                for non-queue instances.
            visibility_timeout:
              type:
                - integer
                - 'null'
              description: >-
                How long, in seconds (0–43200), a received job stays hidden from
                other workers before it becomes available again. Null for
                non-queue instances.
            polling_interval:
              type:
                - integer
                - 'null'
              description: >-
                How often, in seconds (1–60), the queue is polled for new jobs.
                Null for non-queue instances.
            shutdown_timeout:
              type:
                - integer
                - 'null'
            uses_scheduler:
              type: boolean
            sleep_with_app:
              type:
                - boolean
                - 'null'
            scaling_cpu_threshold_percentage:
              type:
                - integer
                - 'null'
            scaling_memory_threshold_percentage:
              type:
                - integer
                - 'null'
            created_at:
              type:
                - string
                - 'null'
              format: date-time
          required:
            - name
            - type
            - size
            - scaling_type
            - min_replicas
            - max_replicas
            - queue_status
            - paused
            - is_default
            - visibility_timeout
            - polling_interval
            - shutdown_timeout
            - uses_scheduler
            - sleep_with_app
            - scaling_cpu_threshold_percentage
            - scaling_memory_threshold_percentage
            - created_at
        relationships:
          type: object
          properties:
            environment:
              type: object
              properties:
                data:
                  anyOf:
                    - $ref: '#/components/schemas/EnvironmentResourceIdentifier'
                    - type: 'null'
              required:
                - data
            backgroundProcesses:
              type: object
              properties:
                data:
                  type: array
                  items:
                    $ref: '#/components/schemas/BackgroundProcessResourceIdentifier'
              required:
                - data
      required:
        - id
        - type
      title: InstanceResource
    DaemonType:
      type: string
      enum:
        - worker
        - custom
      title: DaemonType
    DaemonStrategyType:
      type: string
      enum:
        - none
        - growth_rate
        - queue_size
      title: DaemonStrategyType
    InstanceResourceIdentifier:
      type: object
      properties:
        type:
          type: string
          enum:
            - instances
        id:
          type: string
      required:
        - type
        - id
      title: InstanceResourceIdentifier
    InstanceType:
      type: string
      enum:
        - app
        - service
        - queue
        - managed_queue
      title: InstanceType
    InstanceSize:
      type: string
      enum:
        - flex-512mb
        - flex-1gb
        - flex-2gb
        - flex.c-1vcpu-256mb
        - flex.g-1vcpu-512mb
        - flex.m-1vcpu-1gb
        - flex.c-2vcpu-512mb
        - flex.g-2vcpu-1gb
        - flex.m-2vcpu-2gb
        - flex.c-4vcpu-1gb
        - flex.g-4vcpu-2gb
        - flex.m-4vcpu-4gb
        - flex.c-8vcpu-2gb
        - flex.g-8vcpu-4gb
        - flex.m-8vcpu-8gb
        - pro.c-1vcpu-1gb
        - pro.g-1vcpu-2gb
        - pro.m-1vcpu-4gb
        - pro.c-2vcpu-2gb
        - pro.g-2vcpu-4gb
        - pro.m-2vcpu-8gb
        - pro.c-4vcpu-4gb
        - pro.g-4vcpu-8gb
        - pro.m-4vcpu-16gb
        - pro.c-8vcpu-8gb
        - pro.g-8vcpu-16gb
        - pro.m-8vcpu-32gb
        - dedicated.c-1vcpu-2gb
        - dedicated.g-1vcpu-4gb
        - dedicated.m-1vcpu-8gb
        - dedicated.c-2vcpu-4gb
        - dedicated.g-2vcpu-8gb
        - dedicated.m-2vcpu-16gb
        - dedicated.c-4vcpu-8gb
        - dedicated.g-4vcpu-16gb
        - dedicated.m-4vcpu-32gb
        - dedicated.c-8vcpu-16gb
        - dedicated.g-8vcpu-32gb
        - dedicated.m-8vcpu-64gb
        - mq-pro-256mb
        - mq-pro-512mb
        - mq-pro-1gb
        - mq-pro-2gb
        - mq-pro-4gb
        - mq-pro-8gb
        - mq-dedicated-256mb
        - mq-dedicated-512mb
        - mq-dedicated-1gb
        - mq-dedicated-2gb
        - mq-dedicated-4gb
        - mq-dedicated-8gb
      title: InstanceSize
    InstanceScalingType:
      type: string
      enum:
        - none
        - custom
        - auto
      title: InstanceScalingType
    SqsQueueStatus:
      type: string
      enum:
        - creating
        - updating
        - available
        - deleting
        - deleted
        - unknown
      title: SqsQueueStatus
    EnvironmentResourceIdentifier:
      type: object
      properties:
        type:
          type: string
          enum:
            - environments
        id:
          type: string
      required:
        - type
        - id
      title: EnvironmentResourceIdentifier
    BackgroundProcessResourceIdentifier:
      type: object
      properties:
        type:
          type: string
          enum:
            - background_processes
        id:
          type: string
      required:
        - type
        - id
      title: BackgroundProcessResourceIdentifier
  responses:
    ModelNotFoundException:
      description: Not found
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Errors overview.
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
  securitySchemes:
    http:
      type: http
      description: The Bearer Token generated on the Cloud UI.
      scheme: bearer
      bearerFormat: bearer

````