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

# Run a command in a process

> Run a single command inside a running application process (container) and return its output. This is a non-interactive alternative to the WebSocket terminal: one command runs, and its stdout, stderr, and exit code are returned. The command runs directly without a shell, so pipes, redirects, and command chaining do not apply.

This endpoint requires at least read access to the application. A key with only read access can run read-only commands (such as `ls`, `cat`, `env`, `ps`, `grep`); a request to run any other command is rejected with a 403. A key with write access to the application can run any command. Note that the read-only restriction is a convenience to prevent accidental changes, not a security sandbox: read-only commands can still read environment variables and files inside the container.



## OpenAPI

````yaml https://api.sevalla.com/v3/openapi.json post /applications/{id}/processes/{process_id}/exec
openapi: 3.1.0
info:
  title: Sevalla API docs
  version: 1.0.0
servers:
  - url: https://api.sevalla.com/v3
security:
  - bearerAuth: []
paths:
  /applications/{id}/processes/{process_id}/exec:
    post:
      tags:
        - Applications
      summary: Run a command in a process
      description: >-
        Run a single command inside a running application process (container)
        and return its output. This is a non-interactive alternative to the
        WebSocket terminal: one command runs, and its stdout, stderr, and exit
        code are returned. The command runs directly without a shell, so pipes,
        redirects, and command chaining do not apply.


        This endpoint requires at least read access to the application. A key
        with only read access can run read-only commands (such as `ls`, `cat`,
        `env`, `ps`, `grep`); a request to run any other command is rejected
        with a 403. A key with write access to the application can run any
        command. Note that the read-only restriction is a convenience to prevent
        accidental changes, not a security sandbox: read-only commands can still
        read environment variables and files inside the container.
      operationId: execProcessCommandV3
      parameters:
        - schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            example: fb5e5168-4281-4bec-94c5-0d1584e9e657
          in: path
          name: id
          required: true
          description: Application identifier
        - schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            example: fb5e5168-4281-4bec-94c5-0d1584e9e657
          in: path
          name: process_id
          required: true
          description: Process identifier
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                command:
                  minItems: 1
                  maxItems: 100
                  type: array
                  items:
                    type: string
                  description: >-
                    Command to run, given as an argument vector where the first
                    element is the binary and the rest are its arguments (for
                    example `["ls", "-la", "/app"]`). The command is run
                    directly, not through a shell, so shell features like pipes,
                    redirects, globbing, and chaining with `;` or `&&` are not
                    available. Run those as separate calls instead. API keys
                    with only read access to the application can run read-only
                    commands (such as `ls`, `cat`, `env`, `ps`, `grep`); keys
                    with write access can run any command.
                  example:
                    - ls
                    - '-la'
                    - /app
                timeout:
                  default: 15
                  description: >-
                    Maximum time in seconds to wait for the command to finish
                    before it is aborted. Defaults to 15 seconds.
                  example: 15
                  type: integer
                  minimum: 1
                  maximum: 60
              required:
                - command
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  stdout:
                    type: string
                    description: Standard output produced by the command.
                    example: |
                      total 8
                      drwxr-xr-x 2 app app 4096 Jan 1 00:00 .
                  stderr:
                    type: string
                    description: Standard error produced by the command.
                    example: ''
                  exit_code:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: >-
                      Exit code returned by the command. `0` means success; any
                      other value means the command failed.
                    example: 0
                required:
                  - stdout
                  - stderr
                  - exit_code
                additionalProperties: false
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                    example: Bad request
                  status:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: HTTP status code
                    example: 400
                  data:
                    type: object
                    properties:
                      code:
                        description: Error tracking code for support reference
                        example: err-abc-123
                        type: string
                      message:
                        description: Additional error details or instructions
                        example: >-
                          If you need assistance, please contact support and
                          provide this error code.
                        type: string
                    additionalProperties: false
                required:
                  - message
                  - status
                additionalProperties: false
        '401':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                    example: Unauthorized
                  status:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: HTTP status code
                    example: 401
                  data:
                    type: object
                    properties:
                      code:
                        description: Error tracking code for support reference
                        example: err-abc-123
                        type: string
                      message:
                        description: Additional error details or instructions
                        example: >-
                          If you need assistance, please contact support and
                          provide this error code.
                        type: string
                    additionalProperties: false
                required:
                  - message
                  - status
                additionalProperties: false
        '403':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                    example: Forbidden
                  status:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: HTTP status code
                    example: 403
                  data:
                    type: object
                    properties:
                      code:
                        description: Error tracking code for support reference
                        example: err-abc-123
                        type: string
                      message:
                        description: Additional error details or instructions
                        example: >-
                          If you need assistance, please contact support and
                          provide this error code.
                        type: string
                    additionalProperties: false
                required:
                  - message
                  - status
                additionalProperties: false
        '404':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                    example: Not found
                  status:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: HTTP status code
                    example: 404
                  data:
                    type: object
                    properties:
                      code:
                        description: Error tracking code for support reference
                        example: err-abc-123
                        type: string
                      message:
                        description: Additional error details or instructions
                        example: >-
                          If you need assistance, please contact support and
                          provide this error code.
                        type: string
                    additionalProperties: false
                required:
                  - message
                  - status
                additionalProperties: false
        '429':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                    example: Too many requests
                  status:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: HTTP status code
                    example: 429
                  data:
                    type: object
                    properties:
                      code:
                        description: Error tracking code for support reference
                        example: err-abc-123
                        type: string
                      message:
                        description: Additional error details or instructions
                        example: >-
                          If you need assistance, please contact support and
                          provide this error code.
                        type: string
                    additionalProperties: false
                required:
                  - message
                  - status
                additionalProperties: false
        '500':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                    example: Internal Server Error
                  status:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                    description: HTTP status code
                    example: 500
                  data:
                    type: object
                    properties:
                      code:
                        description: Error tracking code for support reference
                        example: err-abc-123
                        type: string
                      message:
                        description: Additional error details or instructions
                        example: >-
                          If you need assistance, please contact support and
                          provide this error code.
                        type: string
                    additionalProperties: false
                required:
                  - message
                  - status
                additionalProperties: false
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key authentication. Pass your API key as a Bearer token in the
        Authorization header.

````