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

# Detener un Run

> Solicita detener un Run sin terminar. Que se pueda detener depende de si el dispatch ya comenzó.

* **Antes del dispatch:** el Run se detiene sin cargo. Un plazo de sincronización vencido produce `FAILED` con `TIMED_OUT`.
* **Después del dispatch:** el Run continúa; su Price determina el cargo final.
* **Ya terminado:** la solicitud devuelve `409`.


## OpenAPI

````yaml /openapi.es.json post /v1/runs/{runId}/stop
openapi: 3.1.0
info:
  title: Glasser
  version: 0.0.1
  description: >-
    Una API Key, sin contrato, con pago por llamada, para APIs de pago
    adquiridas al por mayor. Cada respuesta incluye x-request-id; cada cuerpo de
    error incluye el mismo sobre.
servers:
  - url: https://api.glasser.ai
security: []
tags:
  - name: Solutions
  - name: Endpoints
  - name: Runs
  - name: Balance
paths:
  /v1/runs/{runId}/stop:
    post:
      tags:
        - Runs
      summary: Stop a Run
      description: >-
        Solicita la detención y comprueba el estado devuelto. Aceptar la
        solicitud no garantiza que la ejecución se haya detenido.


        - **Antes del dispatch:** el Run pasa a STOPPED sin cargo. Una fecha
        límite de sincronización vencida tiene prioridad y produce FAILED con
        TIMED_OUT.

        - **Después del dispatch:** el Run continúa; stop_requested_at registra
        tu solicitud. Su Price determina el cargo final.

        - **Si ya ha terminado:** devuelve 409.
      operationId: runs-stop
      parameters:
        - name: runId
          in: path
          schema:
            type: string
            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|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$
            format: uuid
          required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  run_url:
                    type: string
                    description: >-
                      Abre este Run en la consola. Requiere pertenecer al
                      Workspace.
                  provider:
                    type: string
                    pattern: ^[a-z0-9][a-z0-9-]*$
                  endpoint:
                    type: string
                    pattern: ^\/.+$
                  endpoint_version:
                    type: integer
                    exclusiveMinimum: 0
                  status:
                    type: string
                    enum:
                      - QUEUED
                      - RUNNING
                      - COMPLETED
                      - FAILED
                      - STOPPED
                    description: >-
                      QUEUED o RUNNING: aún está en curso. COMPLETED: hay una
                      respuesta del proveedor de datos disponible, incluidas las
                      respuestas que no sean 2xx. FAILED: consulta `failure`.
                      STOPPED: detenido antes del dispatch. Consulta charge_usd
                      por separado del estado.
                  failure:
                    anyOf:
                      - type: object
                        properties:
                          kind:
                            type: string
                            enum:
                              - TIMED_OUT
                              - INTERNAL
                          message:
                            type: string
                        required:
                          - kind
                          - message
                        additionalProperties: false
                      - type: 'null'
                    description: >-
                      Motivo por el que falló el Run. Solo es distinto de null
                      cuando el estado es FAILED.
                  input:
                    type: object
                  output: {}
                  provider_response:
                    anyOf:
                      - type: object
                        properties:
                          http_status:
                            type: integer
                            minimum: 100
                            maximum: 599
                            description: >-
                              Estado HTTP devuelto por el proveedor de datos.
                              Compruébalo incluso cuando el Run esté COMPLETED.
                          error:
                            anyOf:
                              - {}
                              - type: 'null'
                        required:
                          - http_status
                        additionalProperties: false
                      - type: 'null'
                    description: >-
                      Solo es distinto de null cuando el estado es COMPLETED.


                      - Para respuestas 2xx, output contiene JSON nativo del
                      proveedor de datos (de cualquier estructura) o null si el
                      cuerpo está vacío.

                      - Para respuestas que no sean 2xx, error contiene el
                      cuerpo de error del proveedor de datos y output es null.


                      Los campos sensibles se eliminan de ambos cuerpos.
                  charge_usd:
                    anyOf:
                      - type: string
                        pattern: ^(0|[1-9]\d*)\.(\d{2}|\d{2}\d{0,3}[1-9])$
                        description: >-
                          Cadena decimal exacta en USD (mínimo 2 y máximo 6
                          decimales, con una única representación canónica).
                          Suma mediante aritmética decimal o escala por 10^6;
                          nunca uses números de punto flotante.
                      - type: 'null'
                    description: >-
                      Cargo final como cadena decimal exacta en USD. Es null
                      mientras esté QUEUED o RUNNING. Un Run FAILED puede tener
                      un cargo distinto de cero según el Price del endpoint.
                  charge_basis:
                    anyOf:
                      - type: object
                        properties:
                          clause:
                            type: string
                            enum:
                              - rule
                              - NO_RESULT
                              - PROVIDER_ERROR
                              - TIMED_OUT
                              - INTERNAL
                          quantity:
                            anyOf:
                              - type: integer
                                minimum: 0
                              - type: 'null'
                        required:
                          - clause
                          - quantity
                        additionalProperties: false
                      - type: 'null'
                    description: >-
                      Cláusula de Price utilizada para calcular el cargo. Es
                      null antes de la liquidación o cuando no se intentó
                      contactar con ningún proveedor de datos.
                  stoppable:
                    type: boolean
                    description: >-
                      Indica si actualmente se puede aceptar una solicitud de
                      detención. Esto no garantiza que el Run pueda detenerse
                      antes del dispatch.
                  stop_requested_at:
                    anyOf:
                      - type: string
                        description: Marca de tiempo UTC ISO-8601
                        format: date-time
                      - type: 'null'
                    description: >-
                      Momento en que se solicitó la detención. El Run puede
                      continuar si el dispatch ya había comenzado.
                  created_at:
                    type: string
                    description: Marca de tiempo UTC ISO-8601
                    format: date-time
                  started_at:
                    anyOf:
                      - type: string
                        description: Marca de tiempo UTC ISO-8601
                        format: date-time
                      - type: 'null'
                  completed_at:
                    anyOf:
                      - type: string
                        description: Marca de tiempo UTC ISO-8601
                        format: date-time
                      - type: 'null'
                  task_id:
                    anyOf:
                      - type: string
                      - type: 'null'
                  metadata:
                    type: object
                    additionalProperties:
                      type: string
                      minLength: 1
                      maxLength: 500
                    maxProperties: 20
                    propertyNames:
                      type: string
                      pattern: ^[a-z][a-z0-9_]{0,39}$
                    description: >-
                      Tus campos de seguimiento almacenados. Úsalos para filtrar
                      Runs. Nunca se envían al proveedor de datos ni afectan al
                      enrutamiento, al Price o a la idempotencia.


                      - Hasta 20 claves: letras minúsculas, dígitos y guiones
                      bajos; deben comenzar por una letra y tener como máximo 40
                      caracteres.

                      - Valores: cadenas de 1–500 caracteres.

                      - user_id: el ID opaco de tu usuario final, nunca su
                      dirección de correo electrónico ni su nombre.
                required:
                  - id
                  - run_url
                  - provider
                  - endpoint
                  - endpoint_version
                  - status
                  - failure
                  - input
                  - output
                  - provider_response
                  - charge_usd
                  - charge_basis
                  - stoppable
                  - stop_requested_at
                  - created_at
                  - started_at
                  - completed_at
                  - task_id
                  - metadata
                additionalProperties: false
        '400':
          description: ValidationFailed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationFailedEncoded'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedEncoded'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenEncoded'
        '404':
          description: NotFound
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundEncoded'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConflictEncoded'
        '429':
          description: RateLimited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitedEncoded'
      security:
        - bearer: []
components:
  schemas:
    ValidationFailedEncoded:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - validation_failed
            message:
              type: string
            reason:
              anyOf:
                - type: string
                - type: 'null'
            control:
              anyOf:
                - type: string
                - type: 'null'
            retry_after_ms:
              anyOf:
                - anyOf:
                    - type: integer
                    - type: 'null'
                - type: 'null'
            details:
              anyOf:
                - type: object
                - type: 'null'
          required:
            - code
            - message
          additionalProperties: false
        request_id:
          type: string
      required:
        - error
        - request_id
      additionalProperties: false
    UnauthorizedEncoded:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - unauthorized
            message:
              type: string
            reason:
              anyOf:
                - type: string
                - type: 'null'
            control:
              anyOf:
                - type: string
                - type: 'null'
            retry_after_ms:
              anyOf:
                - anyOf:
                    - type: integer
                    - type: 'null'
                - type: 'null'
            details:
              anyOf:
                - type: object
                - type: 'null'
          required:
            - code
            - message
          additionalProperties: false
        request_id:
          type: string
      required:
        - error
        - request_id
      additionalProperties: false
    ForbiddenEncoded:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - forbidden
            message:
              type: string
            reason:
              anyOf:
                - type: string
                - type: 'null'
            control:
              anyOf:
                - type: string
                - type: 'null'
            retry_after_ms:
              anyOf:
                - anyOf:
                    - type: integer
                    - type: 'null'
                - type: 'null'
            details:
              anyOf:
                - type: object
                - type: 'null'
          required:
            - code
            - message
          additionalProperties: false
        request_id:
          type: string
      required:
        - error
        - request_id
      additionalProperties: false
    NotFoundEncoded:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - not_found
            message:
              type: string
            reason:
              anyOf:
                - type: string
                - type: 'null'
            control:
              anyOf:
                - type: string
                - type: 'null'
            retry_after_ms:
              anyOf:
                - anyOf:
                    - type: integer
                    - type: 'null'
                - type: 'null'
            details:
              anyOf:
                - type: object
                - type: 'null'
          required:
            - code
            - message
          additionalProperties: false
        request_id:
          type: string
      required:
        - error
        - request_id
      additionalProperties: false
    ConflictEncoded:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - conflict
            message:
              type: string
            reason:
              anyOf:
                - type: string
                - type: 'null'
            control:
              anyOf:
                - type: string
                - type: 'null'
            retry_after_ms:
              anyOf:
                - anyOf:
                    - type: integer
                    - type: 'null'
                - type: 'null'
            details:
              anyOf:
                - type: object
                - type: 'null'
          required:
            - code
            - message
          additionalProperties: false
        request_id:
          type: string
      required:
        - error
        - request_id
      additionalProperties: false
    RateLimitedEncoded:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - rate_limited
            message:
              type: string
            reason:
              anyOf:
                - type: string
                - type: 'null'
            control:
              anyOf:
                - type: string
                - type: 'null'
            retry_after_ms:
              anyOf:
                - anyOf:
                    - type: integer
                    - type: 'null'
                - type: 'null'
            details:
              anyOf:
                - type: object
                - type: 'null'
          required:
            - code
            - message
          additionalProperties: false
        request_id:
          type: string
      required:
        - error
        - request_id
      additionalProperties: false
  securitySchemes:
    bearer:
      type: http
      scheme: Bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.