openapi: 3.1.0
info:
  title: Log API
  version: 5.0.0
security:
  - SessionAuth: []
components:
  securitySchemes:
    SessionAuth:
      type: apiKey
      in: cookie
      name: lightmill-session-id
    BasicAuth:
      type: http
      scheme: Basic
  schemas:
    ServerErrorResponse:
      anyOf:
        - $ref: '#/components/schemas/NotFoundErrorResponse'
        - $ref: '#/components/schemas/ValidationErrorResponse'
        - $ref: '#/components/schemas/InternalServerErrorResponse'
        - $ref: '#/components/schemas/ServiceUnavailableErrorResponse'
        - $ref: '#/components/schemas/MethodNotAllowedErrorResponse'
        - $ref: '#/components/schemas/UnsupportedMediaTypeErrorResponse'
        - $ref: '#/components/schemas/RequestBodyTooLargeErrorResponse'
        - $ref: '#/components/schemas/SessionRequiredErrorResponse'
    NotFoundErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                enum:
                  - NOT_FOUND
                description: Error code
              status:
                type: string
                enum:
                  - Not Found
                description: HTTP status text
              detail:
                type: string
                description: Detailed description of the error
            required:
              - code
              - status
            additionalProperties: false
          minItems: 1
      required:
        - errors
      additionalProperties: false
    ValidationErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            anyOf:
              - $ref: '#/components/schemas/InvalidRequestBodyError'
              - $ref: '#/components/schemas/MalformedRequestBodyError'
              - $ref: '#/components/schemas/InvalidRequestQueryError'
              - $ref: '#/components/schemas/InvalidRequestHeadersError'
          minItems: 1
      required:
        - errors
      additionalProperties: false
    InvalidRequestBodyError:
      type: object
      properties:
        code:
          type: string
          enum:
            - INVALID_REQUEST_BODY
          description: Error code
        status:
          type: string
          enum:
            - Bad Request
          description: HTTP status text
        detail:
          type: string
          description: Detailed description of the error
        source:
          type: object
          properties:
            pointer:
              type: string
              description: Pointer to the invalid part of the request body
          required:
            - pointer
          additionalProperties: false
      required:
        - code
        - status
        - source
      additionalProperties: false
    MalformedRequestBodyError:
      type: object
      properties:
        code:
          type: string
          enum:
            - INVALID_REQUEST_BODY
          description: Error code
        status:
          type: string
          enum:
            - Bad Request
          description: HTTP status text
        detail:
          type: string
          description: Detailed description of the error
      required:
        - code
        - status
      additionalProperties: false
      description: The request body is not valid JSON
    InvalidRequestQueryError:
      type: object
      properties:
        code:
          type: string
          enum:
            - INVALID_REQUEST_QUERY
          description: Error code
        status:
          type: string
          enum:
            - Bad Request
          description: HTTP status text
        detail:
          type: string
          description: Detailed description of the error
        source:
          type: object
          properties:
            parameter:
              type: string
              description: Parameter in the request query that is invalid
          required:
            - parameter
          additionalProperties: false
      required:
        - code
        - status
        - source
      additionalProperties: false
    InvalidRequestHeadersError:
      type: object
      properties:
        code:
          type: string
          enum:
            - INVALID_REQUEST_HEADERS
          description: Error code
        status:
          type: string
          enum:
            - Bad Request
          description: HTTP status text
        detail:
          type: string
          description: Detailed description of the error
        source:
          type: object
          properties:
            header:
              type: string
              description: Header in the request that is invalid
          required:
            - header
          additionalProperties: false
      required:
        - code
        - status
        - source
      additionalProperties: false
    InternalServerErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                enum:
                  - INTERNAL_SERVER_ERROR
                description: Error code
              status:
                type: string
                enum:
                  - Internal Server Error
                description: HTTP status text
              detail:
                type: string
                description: Detailed description of the error
            required:
              - code
              - status
            additionalProperties: false
          minItems: 1
      required:
        - errors
      additionalProperties: false
    ServiceUnavailableErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                enum:
                  - SERVICE_UNAVAILABLE
                description: Error code
              status:
                type: string
                enum:
                  - Service Unavailable
                description: HTTP status text
              detail:
                type: string
                description: Detailed description of the error
            required:
              - code
              - status
            additionalProperties: false
          minItems: 1
      required:
        - errors
      additionalProperties: false
      description: >-
        The server could not process the request right now, and nothing was
        saved. Try again: the Retry-After header says in how many seconds.
    MethodNotAllowedErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                enum:
                  - METHOD_NOT_ALLOWED
                description: Error code
              status:
                type: string
                enum:
                  - Method Not Allowed
                description: HTTP status text
              detail:
                type: string
                description: Detailed description of the error
            required:
              - code
              - status
            additionalProperties: false
          minItems: 1
      required:
        - errors
      additionalProperties: false
    UnsupportedMediaTypeErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                enum:
                  - UNSUPPORTED_MEDIA_TYPE
                description: Error code
              status:
                type: string
                enum:
                  - Unsupported Media Type
                description: HTTP status text
              detail:
                type: string
                description: Detailed description of the error
            required:
              - code
              - status
            additionalProperties: false
          minItems: 1
      required:
        - errors
      additionalProperties: false
    RequestBodyTooLargeErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                enum:
                  - REQUEST_BODY_TOO_LARGE
                description: Error code
              status:
                type: string
                enum:
                  - Payload Too Large
                description: HTTP status text
              detail:
                type: string
                description: Detailed description of the error
            required:
              - code
              - status
            additionalProperties: false
          minItems: 1
      required:
        - errors
      additionalProperties: false
    SessionRequiredErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                enum:
                  - SESSION_REQUIRED
                description: Error code
              status:
                type: string
                enum:
                  - Forbidden
                description: HTTP status text
              detail:
                type: string
                description: Detailed description of the error
            required:
              - code
              - status
            additionalProperties: false
          minItems: 1
      required:
        - errors
      additionalProperties: false
    SessionPostResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/SessionResource'
      required:
        - data
      additionalProperties: false
    SessionResource:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - sessions
        attributes:
          type: object
          properties:
            role:
              type: string
              enum:
                - host
                - participant
          additionalProperties: false
        relationships:
          type: object
          properties:
            runs:
              type: object
              properties:
                data:
                  type: array
                  items:
                    $ref: '#/components/schemas/RunResourceIdentifier'
              required:
                - data
              additionalProperties: false
          required:
            - runs
          additionalProperties: false
      required:
        - id
        - type
        - attributes
        - relationships
      additionalProperties: false
    RunResourceIdentifier:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - runs
      required:
        - id
        - type
      additionalProperties: false
    InvalidCredentialErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                enum:
                  - INVALID_CREDENTIALS
                  - MISSING_CREDENTIALS
                description: Error code
              status:
                type: string
                enum:
                  - Forbidden
                description: HTTP status text
              detail:
                type: string
                description: Detailed description of the error
            required:
              - code
              - status
            additionalProperties: false
          minItems: 1
      required:
        - errors
      additionalProperties: false
    SessionExistsErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                enum:
                  - SESSION_EXISTS
                description: Error code
              status:
                type: string
                enum:
                  - Conflict
                description: HTTP status text
              detail:
                type: string
                description: Detailed description of the error
            required:
              - code
              - status
            additionalProperties: false
          minItems: 1
      required:
        - errors
      additionalProperties: false
    SessionPostRequest:
      type: object
      properties:
        data:
          type: object
          properties:
            type:
              type: string
              enum:
                - sessions
            attributes:
              type: object
              properties:
                role:
                  type: string
                  enum:
                    - host
                    - participant
              additionalProperties: false
          required:
            - type
            - attributes
          additionalProperties: false
      required:
        - data
      additionalProperties: false
    SessionGetResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/SessionResource'
        included:
          type: array
          items:
            anyOf:
              - $ref: '#/components/schemas/RunResource'
              - $ref: '#/components/schemas/LogResource'
              - $ref: '#/components/schemas/ExperimentResource'
      required:
        - data
      additionalProperties: false
    RunResource:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - runs
        attributes:
          $ref: '#/components/schemas/RunAttributes'
        relationships:
          type: object
          properties:
            experiment:
              type: object
              properties:
                data:
                  $ref: '#/components/schemas/ExperimentResourceIdentifier'
              required:
                - data
              additionalProperties: false
            lastLogs:
              type: object
              properties:
                data:
                  type: array
                  items:
                    type: object
                    allOf:
                      - $ref: '#/components/schemas/LogResourceIdentifier'
              required:
                - data
              additionalProperties: false
          required:
            - experiment
            - lastLogs
          additionalProperties: false
      required:
        - id
        - type
        - attributes
        - relationships
      additionalProperties: false
    RunAttributes:
      type: object
      properties:
        status:
          $ref: '#/components/schemas/RunStatus'
        name:
          anyOf:
            - type: string
              minLength: 1
            - type: 'null'
          description: Name of the run
        lastLogNumber:
          type: integer
          minimum: 0
        firstMissingLogNumber:
          anyOf:
            - type: integer
              exclusiveMinimum: 0
            - type: 'null'
      required:
        - status
        - name
        - lastLogNumber
        - firstMissingLogNumber
      additionalProperties: false
    RunStatus:
      type: string
      enum:
        - idle
        - running
        - completed
        - interrupted
        - canceled
      description: Status of the run
    ExperimentResourceIdentifier:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - experiments
      required:
        - id
        - type
      additionalProperties: false
    LogResource:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - logs
        attributes:
          type: object
          properties:
            number:
              type: integer
              minimum: 1
              description: >-
                The number of the log. This is a number that is unique for the
                run the log belongs to. Log numbers must be sequential and start
                at 1. Logs must not necessarily be created in order, but any
                missing log must be created before the run is completed, and any
                log following a missing log is considered pending.
            logType:
              type: string
              description: >-
                The type of the log. This is not the same as the resource type
                (which is always "logs" for  logs). This is a type that
                describes the kind of log. For example, it could be "trial",
                "event", etc.
            values:
              type: object
              additionalProperties: {}
              description: >-
                The values of the log. They may be any JSON object. However, it
                is recommended to use flat objects as nested objects are
                difficult to serialize to CSV. It is also recommended to use a
                consistent schema for all logs of the same type.
          required:
            - number
            - logType
            - values
          additionalProperties: false
        relationships:
          $ref: '#/components/schemas/LogRelationships'
      required:
        - id
        - type
        - attributes
        - relationships
      additionalProperties: false
    LogRelationships:
      type: object
      properties:
        run:
          type: object
          properties:
            data:
              type: object
              allOf:
                - $ref: '#/components/schemas/RunResourceIdentifier'
          required:
            - data
          additionalProperties: false
      required:
        - run
      additionalProperties: false
    ExperimentResource:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - experiments
        attributes:
          $ref: '#/components/schemas/ExperimentAttributes'
      required:
        - id
        - type
        - attributes
      additionalProperties: false
    ExperimentAttributes:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          description: Name of the experiment
      required:
        - name
      additionalProperties: false
    SessionNotFoundErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                enum:
                  - SESSION_NOT_FOUND
                description: Error code
              status:
                type: string
                enum:
                  - Not Found
                description: HTTP status text
              detail:
                type: string
                description: Detailed description of the error
            required:
              - code
              - status
            additionalProperties: false
          minItems: 1
      required:
        - errors
      additionalProperties: false
    EmptyDataDocument:
      type: object
      properties:
        data:
          type: 'null'
      required:
        - data
      additionalProperties: false
    ExperimentGetCollectionResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/ExperimentResource'
      required:
        - data
      additionalProperties: false
    StringOrArrayOfStrings:
      anyOf:
        - type: string
        - type: array
          items:
            type: string
    ExperimentPostResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/ExperimentResourceIdentifier'
      required:
        - data
      additionalProperties: false
    ForbiddenErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                enum:
                  - FORBIDDEN
                description: Error code
              status:
                type: string
                enum:
                  - Forbidden
                description: HTTP status text
              detail:
                type: string
                description: Detailed description of the error
            required:
              - code
              - status
            additionalProperties: false
          minItems: 1
      required:
        - errors
      additionalProperties: false
    ExperimentExistsErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                enum:
                  - EXPERIMENT_EXISTS
                description: Error code
              status:
                type: string
                enum:
                  - Conflict
                description: HTTP status text
              detail:
                type: string
                description: Detailed description of the error
            required:
              - code
              - status
            additionalProperties: false
          minItems: 1
      required:
        - errors
      additionalProperties: false
    ExperimentResourceCreate:
      type: object
      properties:
        type:
          type: string
          enum:
            - experiments
        attributes:
          $ref: '#/components/schemas/ExperimentAttributes'
      required:
        - type
        - attributes
      additionalProperties: false
    ExperimentGetResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/ExperimentResource'
      required:
        - data
      additionalProperties: false
    ExperimentNotFoundErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                enum:
                  - EXPERIMENT_NOT_FOUND
                description: Error code
              status:
                type: string
                enum:
                  - Not Found
                description: HTTP status text
              detail:
                type: string
                description: Detailed description of the error
            required:
              - code
              - status
            additionalProperties: false
          minItems: 1
      required:
        - errors
      additionalProperties: false
    RunPostResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/RunResourceIdentifier'
      required:
        - data
      additionalProperties: false
    CannotCreateRunErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                enum:
                  - ONGOING_RUNS
                  - EXPERIMENT_NOT_FOUND
                  - INVALID_RUN_STATUS
                description: Error code
              status:
                type: string
                enum:
                  - Forbidden
                description: HTTP status text
              detail:
                type: string
                description: Detailed description of the error
            required:
              - code
              - status
            additionalProperties: false
          minItems: 1
      required:
        - errors
      additionalProperties: false
    RunExistsErrorReponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                enum:
                  - RUN_EXISTS
                description: Error code
              status:
                type: string
                enum:
                  - Conflict
                description: HTTP status text
              detail:
                type: string
                description: Detailed description of the error
            required:
              - code
              - status
            additionalProperties: false
          minItems: 1
      required:
        - errors
      additionalProperties: false
    RunPostRequest:
      type: object
      properties:
        data:
          type: object
          properties:
            type:
              type: string
              enum:
                - runs
            attributes:
              type: object
              properties:
                status:
                  $ref: '#/components/schemas/RunStatus'
                name:
                  anyOf:
                    - type: string
                      minLength: 1
                    - type: 'null'
                  description: Name of the run
              required:
                - status
                - name
              additionalProperties: false
            relationships:
              type: object
              properties:
                experiment:
                  type: object
                  properties:
                    data:
                      $ref: '#/components/schemas/ExperimentResourceIdentifier'
                  required:
                    - data
                  additionalProperties: false
              required:
                - experiment
              additionalProperties: false
          required:
            - type
            - attributes
            - relationships
          additionalProperties: false
      required:
        - data
      additionalProperties: false
    RunGetCollectionResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/RunResource'
        included:
          type: array
          items:
            $ref: '#/components/schemas/RunInclude'
      required:
        - data
      additionalProperties: false
    RunInclude:
      anyOf:
        - $ref: '#/components/schemas/ExperimentResource'
        - type: object
          allOf:
            - $ref: '#/components/schemas/LogResource'
    RunGetResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/RunResource'
        included:
          type: array
          items:
            $ref: '#/components/schemas/RunInclude'
      required:
        - data
      additionalProperties: false
    RunNotFoundErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                enum:
                  - RUN_NOT_FOUND
                description: Error code
              status:
                type: string
                enum:
                  - Not Found
                description: HTTP status text
              detail:
                type: string
                description: Detailed description of the error
            required:
              - code
              - status
            additionalProperties: false
          minItems: 1
      required:
        - errors
      additionalProperties: false
    RunInvalidUpdateErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                enum:
                  - INVALID_STATUS_TRANSITION
                  - INVALID_LAST_LOG_NUMBER
                  - MISSING_LOGS
                  - INVALID_RUN_ID
                  - RUN_NOT_OWNED
                description: Error code
              status:
                type: string
                enum:
                  - Forbidden
                description: HTTP status text
              detail:
                type: string
                description: Detailed description of the error
            required:
              - code
              - status
            additionalProperties: false
          minItems: 1
      required:
        - errors
      additionalProperties: false
    RunImmutableAttributeErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                enum:
                  - IMMUTABLE_RUN_ATTRIBUTE
                description: Error code
              status:
                type: string
                enum:
                  - Forbidden
                description: HTTP status text
              detail:
                type: string
                description: Detailed description of the error
              source:
                type: object
                properties:
                  pointer:
                    type: string
                    description: Pointer to the attribute of the request body that differs
                required:
                  - pointer
                additionalProperties: false
            required:
              - code
              - status
              - source
            additionalProperties: false
          minItems: 1
      required:
        - errors
      additionalProperties: false
    RunPatchRequest:
      type: object
      properties:
        data:
          type: object
          properties:
            id:
              type: string
            type:
              type: string
              enum:
                - runs
            attributes:
              type: object
              properties:
                status:
                  $ref: '#/components/schemas/RunStatus'
                name:
                  anyOf:
                    - type: string
                      minLength: 1
                    - type: 'null'
                  description: Name of the run
                lastLogNumber:
                  type: integer
                  minimum: 0
                  description: >-
                    Resumes the run after this log number, and cancels the logs
                    after it. Requires the status 'running', or no status on a
                    running run.
              additionalProperties: false
            relationships:
              type: object
              properties:
                experiment:
                  type: object
                  properties:
                    data:
                      $ref: '#/components/schemas/ExperimentResourceIdentifier'
                  required:
                    - data
                  additionalProperties: false
              additionalProperties: false
          required:
            - id
            - type
          additionalProperties: false
      required:
        - data
      additionalProperties: false
    LogGetCollectionResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/LogResource'
        included:
          type: array
          items:
            $ref: '#/components/schemas/LogInclude'
      required:
        - data
      additionalProperties: false
    LogInclude:
      anyOf:
        - type: object
          allOf:
            - $ref: '#/components/schemas/RunResource'
        - $ref: '#/components/schemas/ExperimentResource'
        - $ref: '#/components/schemas/LogResource'
    LogPostResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/LogResourceIdentifier'
      required:
        - data
      additionalProperties: false
    LogResourceIdentifier:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - logs
      required:
        - id
        - type
      additionalProperties: false
    LogPostRequest:
      type: object
      properties:
        data:
          type: object
          properties:
            type:
              type: string
              enum:
                - logs
            attributes:
              type: object
              properties:
                number:
                  type: integer
                  minimum: 1
                  description: >-
                    The number of the log. This is a number that is unique for
                    the run the log belongs to. Log numbers must be sequential
                    and start at 1. Logs must not necessarily be created in
                    order, but any missing log must be created before the run is
                    completed, and any log following a missing log is considered
                    pending.
                logType:
                  type: string
                  description: >-
                    The type of the log. This is not the same as the resource
                    type (which is always "logs" for  logs). This is a type that
                    describes the kind of log. For example, it could be "trial",
                    "event", etc.
                values:
                  type: object
                  additionalProperties: {}
                  description: >-
                    The values of the log. They may be any JSON object. However,
                    it is recommended to use flat objects as nested objects are
                    difficult to serialize to CSV. It is also recommended to use
                    a consistent schema for all logs of the same type.
              required:
                - number
                - logType
                - values
              additionalProperties: false
            relationships:
              $ref: '#/components/schemas/LogRelationships'
          required:
            - type
            - attributes
            - relationships
          additionalProperties: false
      required:
        - data
      additionalProperties: false
    LogGetResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/LogResource'
        included:
          type: array
          items:
            $ref: '#/components/schemas/LogInclude'
      required:
        - data
      additionalProperties: false
    LogNotFoundErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                enum:
                  - LOG_NOT_FOUND
                description: Error code
              status:
                type: string
                enum:
                  - Not Found
                description: HTTP status text
              detail:
                type: string
                description: Detailed description of the error
            required:
              - code
              - status
            additionalProperties: false
          minItems: 1
      required:
        - errors
      additionalProperties: false
    OperationsPostResponse:
      type: object
      properties:
        'atomic:results':
          type: array
          items:
            type: object
            properties:
              data:
                $ref: '#/components/schemas/LogResourceIdentifier'
            required:
              - data
            additionalProperties: false
      required:
        - 'atomic:results'
      additionalProperties: false
    OperationsPostRequest:
      type: object
      properties:
        'atomic:operations':
          type: array
          items:
            $ref: '#/components/schemas/AddLogOperation'
          minItems: 1
      required:
        - 'atomic:operations'
      additionalProperties: false
    AddLogOperation:
      type: object
      properties:
        op:
          type: string
          enum:
            - add
        data:
          type: object
          properties:
            type:
              type: string
              enum:
                - logs
            attributes:
              type: object
              properties:
                number:
                  type: integer
                  minimum: 1
                  description: >-
                    The number of the log. This is a number that is unique for
                    the run the log belongs to. Log numbers must be sequential
                    and start at 1. Logs must not necessarily be created in
                    order, but any missing log must be created before the run is
                    completed, and any log following a missing log is considered
                    pending.
                logType:
                  type: string
                  description: >-
                    The type of the log. This is not the same as the resource
                    type (which is always "logs" for  logs). This is a type that
                    describes the kind of log. For example, it could be "trial",
                    "event", etc.
                values:
                  type: object
                  additionalProperties: {}
                  description: >-
                    The values of the log. They may be any JSON object. However,
                    it is recommended to use flat objects as nested objects are
                    difficult to serialize to CSV. It is also recommended to use
                    a consistent schema for all logs of the same type.
              required:
                - number
                - logType
                - values
              additionalProperties: false
            relationships:
              $ref: '#/components/schemas/LogRelationships'
          required:
            - type
            - attributes
            - relationships
          additionalProperties: false
      required:
        - op
        - data
      additionalProperties: false
  parameters: {}
paths:
  /sessions:
    post:
      description: Create a new session
      security:
        - {}
        - BasicAuth: []
      parameters:
        - schema:
            type: string
            description: >-
              Basic authentication header for host role. Format: "Basic
              base64(username:password)"
          required: false
          description: >-
            Basic authentication header for host role. Format: "Basic
            base64(username:password)"
          name: authorization
          in: header
      requestBody:
        required: true
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/SessionPostRequest'
      responses:
        '201':
          description: >-
            Session created successfully.  If necessary, login and password are
            provided using the basic authentication scheme. The session ID is
            returned in a cookie to be used with cookie authentication.
          headers:
            location:
              schema:
                type: string
                description: The URL of the created session resource
              required: true
              description: The URL of the created session resource
            set-cookie:
              schema:
                type: string
                description: Session cookie for the created session
              required: true
              description: Session cookie for the created session
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/SessionPostResponse'
        '403':
          description: Invalid credentials provided
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/InvalidCredentialErrorResponse'
        '409':
          description: Client already has an active session
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/SessionExistsErrorResponse'
  '/sessions/{id}':
    get:
      security:
        - {}
        - SessionAuth: []
      description: Get a session by ID
      parameters:
        - schema:
            type: string
            description: ID of the session to retrieve
          required: true
          description: ID of the session to retrieve
          name: id
          in: path
        - schema:
            anyOf:
              - type: string
                enum:
                  - runs
                  - runs.experiment
                  - runs.lastLogs
              - type: array
                items:
                  type: string
                  enum:
                    - runs
                    - runs.experiment
                    - runs.lastLogs
            description: Related resources to include in the response
          required: false
          description: Related resources to include in the response
          name: include
          in: query
      responses:
        '200':
          description: Session retrieved successfully
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/SessionGetResponse'
        '404':
          description: Session not found or missing credentials
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/SessionNotFoundErrorResponse'
    delete:
      security:
        - {}
        - BasicAuth: []
      description: Delete a session by ID
      parameters:
        - schema:
            type: string
            description: ID of the session to remove
          required: true
          description: ID of the session to remove
          name: id
          in: path
      responses:
        '200':
          description: Session deleted successfully
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/EmptyDataDocument'
        '404':
          description: Session not found or missing credentials
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/SessionNotFoundErrorResponse'
  /experiments:
    get:
      description: List all experiments
      parameters:
        - schema:
            $ref: '#/components/schemas/StringOrArrayOfStrings'
          required: false
          name: 'filter[name]'
          in: query
      responses:
        '200':
          description: List of experiments
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/ExperimentGetCollectionResponse'
    post:
      description: Create a new experiment.
      requestBody:
        required: true
        content:
          application/vnd.api+json:
            schema:
              type: object
              properties:
                data:
                  $ref: '#/components/schemas/ExperimentResourceCreate'
              required:
                - data
              additionalProperties: false
      responses:
        '201':
          description: Experiment created successfully
          headers:
            location:
              schema:
                type: string
              required: true
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/ExperimentPostResponse'
        '403':
          description: Forbidden
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/ForbiddenErrorResponse'
        '409':
          description: Experiment already exists
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/ExperimentExistsErrorResponse'
  '/experiments/{id}':
    get:
      description: Get a specific experiment by ID
      parameters:
        - schema:
            type: string
            description: ID of the experiment
          required: true
          description: ID of the experiment
          name: id
          in: path
      responses:
        '200':
          description: Experiment retrieved successfully
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/ExperimentGetResponse'
        '404':
          description: Experiment not found
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/ExperimentNotFoundErrorResponse'
  /runs:
    post:
      description: Create a new run
      requestBody:
        required: true
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/RunPostRequest'
      responses:
        '201':
          description: Run created successfully
          headers:
            location:
              schema:
                type: string
              required: true
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/RunPostResponse'
        '403':
          description: 'Forbidden: run creation is invalid or user is not logged in'
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/CannotCreateRunErrorResponse'
        '409':
          description: Run already exists
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/RunExistsErrorReponse'
    get:
      description: List all runs
      parameters:
        - schema:
            $ref: '#/components/schemas/StringOrArrayOfStrings'
          required: false
          name: 'filter[experiment.id]'
          in: query
        - schema:
            $ref: '#/components/schemas/StringOrArrayOfStrings'
          required: false
          name: 'filter[experiment.name]'
          in: query
        - schema:
            $ref: '#/components/schemas/StringOrArrayOfStrings'
          required: false
          name: 'filter[id]'
          in: query
        - schema:
            $ref: '#/components/schemas/StringOrArrayOfStrings'
          required: false
          name: 'filter[name]'
          in: query
        - schema:
            anyOf:
              - $ref: '#/components/schemas/RunStatus'
              - type: array
                items:
                  $ref: '#/components/schemas/RunStatus'
          required: false
          name: 'filter[status]'
          in: query
        - schema:
            anyOf:
              - type: string
                enum:
                  - experiment
                  - lastLogs
              - type: array
                items:
                  type: string
                  enum:
                    - experiment
                    - lastLogs
          required: false
          name: include
          in: query
      responses:
        '200':
          description: List of runs
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/RunGetCollectionResponse'
  '/runs/{id}':
    get:
      description: Get a run by its ID
      parameters:
        - schema:
            type: string
            description: ID of the run
          required: true
          description: ID of the run
          name: id
          in: path
        - schema:
            anyOf:
              - type: string
                enum:
                  - experiment
                  - lastLogs
              - type: array
                items:
                  type: string
                  enum:
                    - experiment
                    - lastLogs
          required: false
          name: include
          in: query
      responses:
        '200':
          description: Run retrieved successfully
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/RunGetResponse'
        '404':
          description: Run not found
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/RunNotFoundErrorResponse'
    patch:
      description: Update a run by its ID
      parameters:
        - schema:
            type: string
            description: ID of the run
          required: true
          description: ID of the run
          name: id
          in: path
      requestBody:
        required: true
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/RunPatchRequest'
      responses:
        '200':
          description: Run updated successfully
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/RunGetResponse'
        '403':
          description: Run update is invalid or user is not logged in
          content:
            application/vnd.api+json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/RunInvalidUpdateErrorResponse'
                  - $ref: '#/components/schemas/RunImmutableAttributeErrorResponse'
        '404':
          description: Run not found
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/RunNotFoundErrorResponse'
  /logs:
    get:
      parameters:
        - schema:
            $ref: '#/components/schemas/StringOrArrayOfStrings'
          required: false
          name: 'filter[logType]'
          in: query
        - schema:
            $ref: '#/components/schemas/StringOrArrayOfStrings'
          required: false
          name: 'filter[experiment.id]'
          in: query
        - schema:
            $ref: '#/components/schemas/StringOrArrayOfStrings'
          required: false
          name: 'filter[experiment.name]'
          in: query
        - schema:
            $ref: '#/components/schemas/StringOrArrayOfStrings'
          required: false
          name: 'filter[run.name]'
          in: query
        - schema:
            $ref: '#/components/schemas/StringOrArrayOfStrings'
          required: false
          name: 'filter[run.id]'
          in: query
        - schema:
            anyOf:
              - type: string
                enum:
                  - run
                  - run.experiment
                  - run.lastLogs
              - type: array
                items:
                  type: string
                  enum:
                    - run
                    - run.experiment
                    - run.lastLogs
          required: false
          name: include
          in: query
        - schema:
            type: string
          required: false
          name: accept
          in: header
      responses:
        '200':
          description: >-
            List of logs. Format is CSV by default, or JSON if the Accept header
            is set to application/vnd.api+json.
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/LogGetCollectionResponse'
            text/csv:
              schema:
                type: string
        '400':
          description: Not supported query parameters
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        code:
                          type: string
                          enum:
                            - NOT_SUPPORTED_QUERY_PARAMETER
                          description: Error code
                        status:
                          type: string
                          enum:
                            - Bad Request
                          description: HTTP status text
                        detail:
                          type: string
                          description: Detailed description of the error
                        source:
                          type: object
                          properties:
                            parameter:
                              type: string
                              description: Parameter in the request query that is invalid
                          required:
                            - parameter
                          additionalProperties: false
                      required:
                        - code
                        - status
                        - source
                      additionalProperties: false
                    minItems: 1
                required:
                  - errors
                additionalProperties: false
    post:
      description: Create a new log
      requestBody:
        required: true
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/LogPostRequest'
      responses:
        '200':
          description: >-
            Log already stored: the run holds a log with the same number, type,
            and values
          headers:
            location:
              schema:
                type: string
              required: true
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/LogPostResponse'
        '201':
          description: Log created successfully
          headers:
            location:
              schema:
                type: string
              required: true
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/LogPostResponse'
        '403':
          description: Forbidden
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        code:
                          type: string
                          enum:
                            - RUN_NOT_FOUND
                            - RUN_NOT_OWNED
                            - INVALID_RUN_STATUS
                          description: Error code
                        status:
                          type: string
                          enum:
                            - Forbidden
                          description: HTTP status text
                        detail:
                          type: string
                          description: Detailed description of the error
                      required:
                        - code
                        - status
                      additionalProperties: false
                    minItems: 1
                required:
                  - errors
                additionalProperties: false
        '409':
          description: Log number already exists
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        code:
                          type: string
                          enum:
                            - LOG_NUMBER_EXISTS
                          description: Error code
                        status:
                          type: string
                          enum:
                            - Conflict
                          description: HTTP status text
                        detail:
                          type: string
                          description: Detailed description of the error
                      required:
                        - code
                        - status
                      additionalProperties: false
                    minItems: 1
                required:
                  - errors
                additionalProperties: false
        '413':
          description: The request body is over the size limit (1 MB)
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/RequestBodyTooLargeErrorResponse'
  '/logs/{id}':
    get:
      description: Get a specific log by ID
      parameters:
        - schema:
            type: string
            description: ID of the log
          required: true
          description: ID of the log
          name: id
          in: path
        - schema:
            anyOf:
              - type: string
                enum:
                  - run
                  - run.experiment
                  - run.lastLogs
              - type: array
                items:
                  type: string
                  enum:
                    - run
                    - run.experiment
                    - run.lastLogs
          required: false
          name: include
          in: query
      responses:
        '200':
          description: Log retrieved successfully
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/LogGetResponse'
        '404':
          description: Log not found
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/LogNotFoundErrorResponse'
  /operations:
    post:
      description: >-
        Create many logs of one run at once. All or nothing: if any operation
        fails, no log is created. A log the run already holds with the same
        number, type, and values succeeds like a new one and returns the stored
        id.
      requestBody:
        required: true
        content:
          'application/vnd.api+json;ext="https://jsonapi.org/ext/atomic"':
            schema:
              $ref: '#/components/schemas/OperationsPostRequest'
      responses:
        '200':
          description: 'Logs stored, one result per operation and in the same order'
          content:
            'application/vnd.api+json;ext="https://jsonapi.org/ext/atomic"':
              schema:
                $ref: '#/components/schemas/OperationsPostResponse'
        '400':
          description: >-
            Invalid request: an operation that does not add a log, logs of
            several runs, the same log number twice, or an unsupported query
            parameter
          content:
            'application/vnd.api+json;ext="https://jsonapi.org/ext/atomic"':
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
        '403':
          description: Forbidden
          content:
            'application/vnd.api+json;ext="https://jsonapi.org/ext/atomic"':
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        code:
                          type: string
                          enum:
                            - RUN_NOT_FOUND
                            - RUN_NOT_OWNED
                            - INVALID_RUN_STATUS
                          description: Error code
                        status:
                          type: string
                          enum:
                            - Forbidden
                          description: HTTP status text
                        detail:
                          type: string
                          description: Detailed description of the error
                      required:
                        - code
                        - status
                      additionalProperties: false
                    minItems: 1
                required:
                  - errors
                additionalProperties: false
        '409':
          description: A log number exists in the run with different type or values
          content:
            'application/vnd.api+json;ext="https://jsonapi.org/ext/atomic"':
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        code:
                          type: string
                          enum:
                            - LOG_NUMBER_EXISTS
                          description: Error code
                        status:
                          type: string
                          enum:
                            - Conflict
                          description: HTTP status text
                        detail:
                          type: string
                          description: Detailed description of the error
                        source:
                          type: object
                          properties:
                            pointer:
                              type: string
                              description: >-
                                Pointer to the offending operation in the
                                request body
                          required:
                            - pointer
                          additionalProperties: false
                          description: Location of the error in the request body
                      required:
                        - code
                        - status
                        - source
                      additionalProperties: false
                    minItems: 1
                required:
                  - errors
                additionalProperties: false
        '413':
          description: The request body is over the size limit (1 MB)
          content:
            'application/vnd.api+json;ext="https://jsonapi.org/ext/atomic"':
              schema:
                $ref: '#/components/schemas/RequestBodyTooLargeErrorResponse'
webhooks: {}

