openapi: 3.0.0
info:
  title: ScriptRunner Connect API
  version: '1.0'
tags:
  - name: Users
  - name: Logs
paths:
  /v1/team/{teamId}/auditLogs:
    get:
      operationId: Logs_getAuditLogs
      description: Get audit logs.
      parameters:
        - name: teamId
          in: path
          required: true
          description: Team ID
          schema:
            type: string
        - name: pageSize
          in: query
          required: false
          schema:
            type: integer
            format: int32
            minimum: 1
            maximum: 200
          explode: false
        - name: cursor
          in: query
          required: false
          schema:
            type: string
          explode: false
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Logs.GetAuditLogsRes'
        '400':
          description: Bad request, usually related to invalid input.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Common.BadRequestError'
        '401':
          description: Invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Common.UnauthorizedError'
        '403':
          description: Invalid permissions.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Common.ForbiddenError'
        '404':
          description: Requested resource(s) not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Common.NotFoundError'
        '429':
          description: Too many requests (rate limiting), please try again later.
        '500':
          description: Something went wrong.
      tags:
        - Logs
  /v1/team/{teamId}/invocationLogs:
    get:
      operationId: Logs_getInvocationLogs
      description: |-
        Get invocation logs. **PS! Sometimes the returned result size is smaller than the requested by `pageSize`**.
        **DO NOT use result size to determine if there are more results**, but instead check if `nextToken` is present in the response. If it is, then there are more results to be returned.
      parameters:
        - name: teamId
          in: path
          required: true
          description: Team ID
          schema:
            type: string
        - name: pageSize
          in: query
          required: false
          description: How many results to return on a single page. Defaults to 200.
          schema:
            type: integer
            format: int32
            minimum: 20
            maximum: 200
          explode: false
        - name: nextToken
          in: query
          required: false
          description: Token from the previous result to continoue iterating paginated result.
          schema:
            type: string
          explode: false
        - name: orderBy
          in: query
          required: false
          description: Field to order by the results.
          schema:
            type: string
            enum:
              - workspace
              - environment
              - duration
              - consoleLogs
              - httpLogs
              - startTime
          explode: false
        - name: orderByDirection
          in: query
          required: false
          description: How to order results, ascending or descending, defaults to `asc`.
          schema:
            type: string
            enum:
              - asc
              - desc
          explode: false
        - name: from
          in: query
          required: false
          description: From when to include invocation logs. Must be ISO time.
          schema:
            type: string
          explode: false
        - name: to
          in: query
          required: false
          description: To when to include invocation logs. Must be ISO time.
          schema:
            type: string
          explode: false
        - name: workspaces
          in: query
          required: false
          description: Workspace IDs to filter out invocations by.
          schema:
            type: array
            items:
              type: string
          explode: false
        - name: executionStatuses
          in: query
          required: false
          description: Execution statuses to filter out invocations by.
          schema:
            type: array
            items:
              type: string
              enum:
                - RUNNING
                - FINISHED
                - ABORTED
                - TIMED_OUT
                - FUNCTION_ERROR
                - RUNTIME_ERROR
                - DENIED
                - MALFORMED_PAYLOAD_ERROR
          explode: false
        - name: triggerTypes
          in: query
          required: false
          description: Trigger types to filter out invocations by.
          schema:
            type: array
            items:
              type: string
              enum:
                - EXTERNAL
                - MANUAL
                - SCHEDULED
                - MANUAL_EVENT_LISTENER
                - CHAINED
          explode: false
        - name: invocationId
          in: query
          required: false
          description: Invocations ID to filter out invocations by.
          schema:
            type: string
          explode: false
        - name: invocationIdComparator
          in: query
          required: false
          description: How to compare invocation ID, defaults to `equals`.
          schema:
            type: string
            enum:
              - equals
              - contains
          explode: false
        - name: environmentName
          in: query
          required: false
          description: Environment name to filter out invocations by.
          schema:
            type: string
          explode: false
        - name: environmentNameComparator
          in: query
          required: false
          description: How to compare environment name, defaults to `equals`.
          schema:
            type: string
            enum:
              - equals
              - contains
          explode: false
        - name: scriptName
          in: query
          required: false
          description: Script name to filter out invocations by.
          schema:
            type: string
          explode: false
        - name: scriptNameComparator
          in: query
          required: false
          description: How to compare script name, defaults to `equals`.
          schema:
            type: string
            enum:
              - equals
              - contains
          explode: false
        - name: duration
          in: query
          required: false
          description: Script exeuction duration to filter out invocations by.
          schema:
            type: integer
            format: int32
          explode: false
        - name: durationComparator
          in: query
          required: false
          description: How to apply duration filter, defaults to `gt`.
          schema:
            type: string
            enum:
              - gt
              - lt
          explode: false
        - name: consoleLogsCount
          in: query
          required: false
          description: Console logs count to filter out invocations by.
          schema:
            type: integer
            format: int32
          explode: false
        - name: consoleLogsComparator
          in: query
          required: false
          description: How to apply console logs count filter, defaults to `gt`.
          schema:
            type: string
            enum:
              - gt
              - lt
          explode: false
        - name: httpLogsCount
          in: query
          required: false
          description: HTTP logs count to filter out invovations by.
          schema:
            type: integer
            format: int32
          explode: false
        - name: httpLogsComparator
          in: query
          required: false
          description: How to apply http logs count filter, dedaults to `gt`.
          schema:
            type: string
            enum:
              - gt
              - lt
          explode: false
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Logs.getInvocationLogsRes'
        '400':
          description: Bad request, usually related to invalid input.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Common.BadRequestError'
        '401':
          description: Invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Common.UnauthorizedError'
        '403':
          description: Invalid permissions.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Common.ForbiddenError'
        '404':
          description: Requested resource(s) not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Common.NotFoundError'
        '429':
          description: Too many requests (rate limiting), please try again later.
        '500':
          description: Something went wrong.
      tags:
        - Logs
  /v1/team/{teamId}/invocationPayload/{invocationId}:
    get:
      operationId: Logs_getInvocationPayload
      description: Get URL for downloading invocation payload (incoming event in most cases). **PS! Download URL will expire in 1 minute**.
      parameters:
        - name: teamId
          in: path
          required: true
          description: Team ID
          schema:
            type: string
        - name: invocationId
          in: path
          required: true
          description: Invocation ID
          schema:
            type: string
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Logs.UrlDownloadableResource'
        '400':
          description: Bad request, usually related to invalid input.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Common.BadRequestError'
        '401':
          description: Invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Common.UnauthorizedError'
        '403':
          description: Invalid permissions.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Common.ForbiddenError'
        '404':
          description: Requested resource(s) not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Common.NotFoundError'
        '429':
          description: Too many requests (rate limiting), please try again later.
        '500':
          description: Something went wrong.
      tags:
        - Logs
  /v1/user/me:
    get:
      operationId: Users_getLoggedInUser
      description: Get logged in user details.
      parameters: []
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Users.GetLoggedInUserRes'
        '401':
          description: Invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Common.UnauthorizedError'
        '429':
          description: Too many requests (rate limiting), please try again later.
        '500':
          description: Something went wrong.
      tags:
        - Users
  /v1/workspace/{workspaceId}/invocation/{invocationId}/consoleLogs:
    get:
      operationId: Logs_getConsoleLogs
      description: Get URL for downloading console logs. **PS! Download URL will expire in 1 minute**.
      parameters:
        - name: workspaceId
          in: path
          required: true
          description: Workspace ID
          schema:
            type: string
        - name: invocationId
          in: path
          required: true
          description: Invocation ID
          schema:
            type: string
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Logs.UrlDownloadableResource'
        '400':
          description: Bad request, usually related to invalid input.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Common.BadRequestError'
        '401':
          description: Invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Common.UnauthorizedError'
        '403':
          description: Invalid permissions.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Common.ForbiddenError'
        '404':
          description: Requested resource(s) not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Common.NotFoundError'
        '429':
          description: Too many requests (rate limiting), please try again later.
        '500':
          description: Something went wrong.
      tags:
        - Logs
  /v1/workspace/{workspaceId}/invocation/{invocationId}/httpLogs:
    get:
      operationId: Logs_getHttpLogs
      description: Get URL for downloading HTTP logs. **PS! Download URL will expire in 1 minute**.
      parameters:
        - name: workspaceId
          in: path
          required: true
          description: Workspace ID
          schema:
            type: string
        - name: invocationId
          in: path
          required: true
          description: Invocation ID
          schema:
            type: string
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Logs.UrlDownloadableResource'
        '400':
          description: Bad request, usually related to invalid input.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Common.BadRequestError'
        '401':
          description: Invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Common.UnauthorizedError'
        '403':
          description: Invalid permissions.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Common.ForbiddenError'
        '404':
          description: Requested resource(s) not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Common.NotFoundError'
        '429':
          description: Too many requests (rate limiting), please try again later.
        '500':
          description: Something went wrong.
      tags:
        - Logs
  /v1/workspace/{workspaceId}/invocation/{invocationId}/largeLogMessage/{logMessageId}:
    get:
      operationId: Logs_getLargeLogMessage
      description: Get URL for downloading large log message (message that is too large to be included with the rest of the console logs). **PS! Download URL will expire in 1 minute**.
      parameters:
        - name: workspaceId
          in: path
          required: true
          description: Workspace ID
          schema:
            type: string
        - name: invocationId
          in: path
          required: true
          description: Invocation ID
          schema:
            type: string
        - name: logMessageId
          in: path
          required: true
          description: Log message ID, you can get it from console logs (/v1/workspace/{workspaceId}/invocation/{invocationId}/consoleLogs)
          schema:
            type: string
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Logs.UrlDownloadableResource'
        '400':
          description: Bad request, usually related to invalid input.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Common.BadRequestError'
        '401':
          description: Invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Common.UnauthorizedError'
        '403':
          description: Invalid permissions.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Common.ForbiddenError'
        '404':
          description: Requested resource(s) not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Models.Common.NotFoundError'
        '429':
          description: Too many requests (rate limiting), please try again later.
        '500':
          description: Something went wrong.
      tags:
        - Logs
security:
  - BasicAuth: []
components:
  schemas:
    Models.Common.BadRequestError:
      type: object
      required:
        - errorMessage
      properties:
        errorMessage:
          type: string
    Models.Common.ForbiddenError:
      type: object
      required:
        - errorMessage
      properties:
        errorMessage:
          type: string
    Models.Common.NotFoundError:
      type: object
      required:
        - errorMessage
      properties:
        errorMessage:
          type: string
    Models.Common.UnauthorizedError:
      type: object
      required:
        - errorMessage
      properties:
        errorMessage:
          type: string
    Models.Logs.GetAuditLogsRes:
      type: object
      required:
        - auditLogs
      properties:
        auditLogs:
          type: object
          properties:
            uid:
              type: string
            action:
              type: string
            actorIp:
              type: string
            date:
              type: string
            metadata:
              type: string
            actor:
              type: object
              properties:
                uid:
                  type: string
                name:
                  type: string
              required:
                - uid
                - name
            relatedUser:
              type: object
              properties:
                uid:
                  type: string
                name:
                  type: string
              required:
                - uid
                - name
            relatedWorkspace:
              type: object
              properties:
                uid:
                  type: string
                deleted:
                  type: boolean
                name:
                  type: string
                selectedEnv:
                  type: string
              required:
                - uid
                - deleted
                - name
            relatedApiHandler:
              type: object
              properties:
                uid:
                  type: string
                deleted:
                  type: boolean
                path:
                  type: string
              required:
                - uid
                - deleted
            relatedBillingEntity:
              type: object
              properties:
                uid:
                  type: string
                name:
                  type: string
              required:
                - uid
            relatedConnection:
              type: object
              properties:
                uid:
                  type: string
                deleted:
                  type: boolean
                name:
                  type: string
              required:
                - uid
                - deleted
                - name
            relatedDeployment:
              type: object
              properties:
                uid:
                  type: string
                version:
                  type: string
                deleted:
                  type: boolean
              required:
                - uid
                - version
                - deleted
            relatedEnvironment:
              type: object
              properties:
                uid:
                  type: string
                name:
                  type: string
                deleted:
                  type: boolean
              required:
                - uid
                - name
                - deleted
            relatedEnvironmentVariable:
              type: object
              properties:
                uid:
                  type: string
                deleted:
                  type: boolean
                name:
                  type: string
              required:
                - uid
                - deleted
                - name
            relatedEventListener:
              type: object
              properties:
                uid:
                  type: string
                deleted:
                  type: boolean
                name:
                  type: string
              required:
                - uid
                - deleted
                - name
            relatedEventListenerTestPayload:
              type: object
              properties:
                uid:
                  type: string
                name:
                  type: string
                deleted:
                  type: boolean
              required:
                - uid
                - name
                - deleted
            relatedOrganization:
              type: object
              properties:
                uid:
                  type: string
                name:
                  type: string
                deleted:
                  type: boolean
              required:
                - uid
                - name
                - deleted
            relatedReadmeFile:
              type: object
              properties:
                uid:
                  type: string
                name:
                  type: string
                deleted:
                  type: boolean
              required:
                - uid
                - name
                - deleted
            relatedScheduledTrigger:
              type: object
              properties:
                uid:
                  type: string
                deleted:
                  type: boolean
                cronExpression:
                  type: string
              required:
                - uid
                - deleted
            relatedScript:
              type: object
              properties:
                uid:
                  type: string
                deleted:
                  type: boolean
                name:
                  type: string
              required:
                - uid
                - deleted
                - name
            relatedTemplate:
              type: object
              properties:
                uid:
                  type: string
                deleted:
                  type: boolean
                name:
                  type: string
              required:
                - uid
                - deleted
          required:
            - uid
            - action
            - date
            - actor
    Models.Logs.UrlDownloadableResource:
      type: object
      required:
        - url
      properties:
        url:
          type: string
    Models.Logs.getInvocationLogsRes:
      type: object
      required:
        - invocations
      properties:
        invocations:
          type: array
          items:
            type: object
            properties:
              invocationId:
                type: string
              executionDuration:
                type: integer
                format: int32
              consoleLogsCount:
                type: integer
                format: int32
              httpLogsCount:
                type: integer
                format: int32
              workspace:
                type: object
                properties:
                  id:
                    type: string
                  name:
                    type: string
                required:
                  - id
                  - name
              environment:
                type: object
                properties:
                  id:
                    type: string
                  name:
                    type: string
                required:
                  - id
                  - name
              script:
                type: object
                properties:
                  id:
                    type: string
                  name:
                    type: string
                required:
                  - id
                  - name
              startTime:
                type: string
              invocationType:
                type: string
              triggerType:
                type: string
              rootTriggerType:
                type: string
              executionStatus:
                type: string
                enum:
                  - RUNNING
                  - FINISHED
                  - ABORTED
                  - TIMED_OUT
                  - FUNCTION_ERROR
                  - RUNTIME_ERROR
                  - DENIED
                  - MALFORMED_PAYLOAD_ERROR
              denialReason:
                type: string
            required:
              - invocationId
              - executionDuration
              - consoleLogsCount
              - httpLogsCount
              - workspace
              - environment
              - script
              - startTime
              - triggerType
              - rootTriggerType
              - executionStatus
          description: Returned invocations.
        nextToken:
          type: string
          description: If there are more results, use this token with the next request.
    Models.Users.GetLoggedInUserRes:
      type: object
      required:
        - id
        - email
        - emailNotificationsEnabled
      properties:
        id:
          type: string
        email:
          type: string
        firstName:
          type: string
        lastName:
          type: string
        emailNotificationsEnabled:
          type: boolean
    Versions:
      type: string
      enum:
        - '1.0'
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
servers:
  - url: https://api.stg.scriptrunnerconnect.com
    description: Staging API Endpoint
    variables: {}
  - url: https://api.scriptrunnerconnect.com
    description: Production API Endpoint
    variables: {}
