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

# Create operations

> Create one or more operations based on the scope and objectives provided.

Currently available operation types: `execute_microservice`, `delete_workspaces`, `shutdown_workspaces`, and `restart_workspaces`.

Returns the created operation resources with the same canonical query contract by id.

**Parameter compatibility for `execute_microservice`**

`payload.parameters` only applies to PowerShell microservices executions in Windows and is only supported on devices with the new agent installed.

The values sent in `payload.parameters` are transmitted as text (`string`). The interpretation of types depends on the parameter definition and the parsing implemented in the microservice script.

For that context, recommended data types for parameters:

- `string`, `integer`, `double`, `decimal`, and `datetime`.
- For `double` and `decimal`, use decimal point notation (`.`).
- For `datetime`, use ISO 8601 format (e.g., `2026-07-09T10:30:00Z`).
- When executed at the destination, `datetime` values may be represented in local time.
- Correct execution also depends on the quality and validations of the script.



## OpenAPI

````yaml /en/api-reference/openapi.en-v2.json post /v2/organizations/{organization_id}/operations
openapi: 3.0.3
info:
  title: API Publica Portal
  version: 2.0.0
  description: Public REST API for portal
servers:
  - url: https://api.flexxible.net
    description: Portal API (production)
security:
  - bearerAuth: []
tags:
  - name: Digital activity
    description: Creation of core process groups by organization
  - name: Roles
    description: Endpoint de creacion de roles de organizacion
  - name: Usuarios
    description: Endpoint de creacion de usuarios de organizacion
  - name: Grupos de workspaces
    description: Endpoints de gestión de grupos de workspaces
  - name: Workspaces
    description: Endpoint de eliminacion de workspaces de la organizacion
  - name: Aplicaciones instaladas
    description: Endpoint de detalle de aplicación instalada de la organización
  - name: Autenticación
    description: Endpoints de autenticación y contexto de sesión
  - name: Microservicios
    description: Detalle de microservicios por organizacion
  - name: Operaciones
    description: Consulta de detalle de operaciones por organización
  - name: Organización
    description: Operaciones de organización
  - name: Objetivos de política de parches
    description: Endpoints de gestión de objetivos de política de parches
  - name: Configuraciones de producto
    description: Endpoints de gestión de configuraciones de producto
  - name: Grupos de reporte
    description: Operaciones sobre grupos de reporte
  - name: Sesiones
    description: Endpoint de detalle de sesion de la organizacion
  - name: Tenants
    description: Endpoints de gestión de tenants
paths:
  /v2/organizations/{organization_id}/operations:
    post:
      tags:
        - Operations
      summary: Create operations
      description: >-
        Create one or more operations based on the scope and objectives
        provided.


        Currently available operation types: `execute_microservice`,
        `delete_workspaces`, `shutdown_workspaces`, and `restart_workspaces`.


        Returns the created operation resources with the same canonical query
        contract by id.


        **Parameter compatibility for `execute_microservice`**


        `payload.parameters` only applies to PowerShell microservices executions
        in Windows and is only supported on devices with the new agent
        installed.


        The values sent in `payload.parameters` are transmitted as text
        (`string`). The interpretation of types depends on the parameter
        definition and the parsing implemented in the microservice script.


        For that context, recommended data types for parameters:


        - `string`, `integer`, `double`, `decimal`, and `datetime`.

        - For `double` and `decimal`, use decimal point notation (`.`).

        - For `datetime`, use ISO 8601 format (e.g., `2026-07-09T10:30:00Z`).

        - When executed at the destination, `datetime` values may be represented
        in local time.

        - Correct execution also depends on the quality and validations of the
        script.
      operationId: createOperations
      parameters:
        - name: organization_id
          in: path
          required: true
          schema:
            type: string
            maxLength: 24
            pattern: ^[0-9a-f]{24}$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOperationV2Request'
      responses:
        '201':
          description: Operations created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateOperationV2Response'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    CreateOperationV2Request:
      type: object
      required:
        - type
        - target
      properties:
        type:
          type: string
          enum:
            - execute_microservice
            - delete_workspaces
            - shutdown_workspaces
            - restart_workspaces
            - suspend_workspaces
        target:
          type: object
          required:
            - type
            - ids
          properties:
            type:
              type: string
              enum:
                - workspaces
                - sessions
            ids:
              type: array
              minItems: 1
              maxItems: 20000
              items:
                type: string
                minLength: 1
                maxLength: 64
          additionalProperties: false
        expiration_in_seconds:
          type: integer
          maximum: 84600
          minimum: 600
        payload:
          type: object
          additionalProperties: true
      additionalProperties: false
    CreateOperationV2Response:
      type: object
      required:
        - data
      properties:
        data:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/GetOperationByIdResponseV1'
    GetOperationByIdResponseV1:
      type: object
      properties:
        id:
          type: string
          pattern: ^[0-9a-f]{24}$
          minLength: 24
          maxLength: 24
          description: Operation execution identifier.
        name:
          type: string
          description: Operation name.
        organization_id:
          type: string
          pattern: ^[0-9a-f]{24}$
          minLength: 24
          maxLength: 24
          description: Identifier of the organization owning the operation.
        description:
          type: string
          description: >-
            Operation description. An empty string is returned when it doesn't
            exist at source.
        status:
          type: string
          enum:
            - finished
            - unknown
            - error
            - pending
            - in-progress
            - timeout
            - cancelled
            - scheduled
          description: Current operation status.
        created_at:
          type: string
          format: date-time
          description: Creation timestamp.
        started_at:
          type: string
          format: date-time
          nullable: true
          description: Start timestamp.
        ended_at:
          type: string
          format: date-time
          nullable: true
          description: Completion timestamp.
        microservice_id:
          type: string
          nullable: true
          pattern: ^[0-9a-f]{24}$
          minLength: 24
          maxLength: 24
          description: Related microservice identifier, when it exists.
        flow_id:
          type: string
          nullable: true
          pattern: ^[0-9a-f]{24}$
          minLength: 24
          maxLength: 24
          description: Related flow identifier, when it exists.
        remote_support:
          $ref: '#/components/schemas/GetOperationByIdRemoteSupportV1'
      required:
        - id
        - organization_id
        - name
        - description
        - status
        - created_at
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            code:
              type: string
            details:
              type: string
          required:
            - message
            - code
      required:
        - error
    GetOperationByIdRemoteSupportV1:
      type: object
      nullable: true
      properties:
        start_date:
          type: string
          format: date-time
          nullable: true
          description: Remote support start date.
        end_date:
          type: string
          format: date-time
          nullable: true
          description: Remote support end date.
        type:
          type: string
          nullable: true
          description: Type of remote support session.
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    UnprocessableEntity:
      description: Unprocessable Entity
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    TooManyRequests:
      description: Too Many Requests
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````