# Get last log with stages

- Operation ID: `getExtendedInfoAboutLastRun`
- HTTP method: `GET`
- Path: `/morph/logs/automation/{automationWorkflowId}/last-run/with-stages`
- [Human-readable API reference](https://hub.synerise.com/api-reference/automation#tag/Data-Processing-Job-Logs/operation/getExtendedInfoAboutLastRun)

## Self-contained OpenAPI method

The fenced document below contains this method's documentation and all of its local references. It is self-contained; no category or master specification fetch is required.

```yaml
openapi: 3.0.0
info:
  title: Synerise Public API
  version: 1.9.1
paths:
  /morph/logs/automation/{automationWorkflowId}/last-run/with-stages:
    get:
      tags:
        - Data Processing Job Logs
      operationId: getExtendedInfoAboutLastRun
      summary: Get last log with stages
      description: |
        
        Retrieve the status of a workflow's last run and its stages.

        The workflow must contain at least one of the following nodes:
        - Any Data Transformation node
        - Any node that pulls data into a workflow (for example local file, SFTP, Azure Blob Storage)
        - Any node that pushes data out of the workflow (for example SFTP, Pub/Sub)
        - Any node that imports data into Synerise


        ---

        **API consumers:** <a href="/api-reference/authorization?tag=Authorization&amp;operationId=userLogin" target="_blank" rel="noopener">Synerise User</a>, <a href="/api-reference/authorization?tag=Authorization&amp;operationId=profileLogin" target="_blank" rel="noopener">Workspace (Business Profile)</a>

        **API key permission required:** `MORPH_JOBS_READ`

        **User role permission required:** `automation_2_journeys: read`
      parameters:
        - name: automationWorkflowId
          in: path
          required: true
          description: "`diagramId` of the workflow to fetch last job from"
          schema:
            type: string
            format: uuid
        - name: limit
          in: query
          required: false
          schema:
            type: number
            default: 500
            maximum: 5000
          description: The maximum number of log lines in each stage
      responses:
        "200":
          description: Information about last data transformation journey status
          content:
            application/json:
              schema:
                type: object
                required:
                  - startTime
                  - pipelineResponse
                  - overallRunStatus
                properties:
                  startTime:
                    description: Time when the journey started
                    type: string
                    format: date-time
                    example: 2023-09-05T14:07:44.264Z
                  runId:
                    type: string
                    format: uuid
                    description: "`journeyId` of the last Automation run"
                  pipelineResponse:
                    description: Logs for each stage in the workflow
                    type: object
                    properties:
                      importData:
                        description: Logs for pulling data into the workflow
                        allOf:
                          - type: object
                            required:
                              - status
                              - logs
                              - logsSize
                            properties:
                              status:
                                type: string
                                description: High-level status of the job. If a given type of job doesn't exist in a workflow (for example, `transformData` in a workflow without any Data Transformation nodes), the status is `Pending`.
                                enum:
                                  - Pending
                                  - InProgress
                                  - Finished
                                  - Failed
                                  - Warning
                                example: Pending
                              runDate:
                                type: string
                                description: Time when this job started
                                example: 2022-01-31T12:37:25.109Z
                              logs:
                                type: array
                                description: An array of log lines
                                items:
                                  type: string
                                  example: 2022-01-31T12:37:25.109412Z INFO Job finished with success!
                              logsSize:
                                type: number
                                description: The number of returned log lines
                              failedRecordsFileId:
                                type: string
                                format: uuid
                                description: UUID of the input file that couldn't be processed
                              successCount:
                                type: integer
                                description: Number of rows successfully processed by the job
                              failureCount:
                                type: integer
                                description: Number of rows that failed during processing by the job
                      transformData:
                        description: Logs for Data Transformation processing
                        allOf:
                          - type: object
                            required:
                              - status
                              - logs
                              - logsSize
                            properties:
                              status:
                                type: string
                                description: High-level status of the job. If a given type of job doesn't exist in a workflow (for example, `transformData` in a workflow without any Data Transformation nodes), the status is `Pending`.
                                enum:
                                  - Pending
                                  - InProgress
                                  - Finished
                                  - Failed
                                  - Warning
                                example: Pending
                              runDate:
                                type: string
                                description: Time when this job started
                                example: 2022-01-31T12:37:25.109Z
                              logs:
                                type: array
                                description: An array of log lines
                                items:
                                  type: string
                                  example: 2022-01-31T12:37:25.109412Z INFO Job finished with success!
                              logsSize:
                                type: number
                                description: The number of returned log lines
                              failedRecordsFileId:
                                type: string
                                format: uuid
                                description: UUID of the input file that couldn't be processed
                              successCount:
                                type: integer
                                description: Number of rows successfully processed by the job
                              failureCount:
                                type: integer
                                description: Number of rows that failed during processing by the job
                      exportData:
                        description: Logs for pushing data from the workflow
                        allOf:
                          - type: object
                            required:
                              - status
                              - logs
                              - logsSize
                            properties:
                              status:
                                type: string
                                description: High-level status of the job. If a given type of job doesn't exist in a workflow (for example, `transformData` in a workflow without any Data Transformation nodes), the status is `Pending`.
                                enum:
                                  - Pending
                                  - InProgress
                                  - Finished
                                  - Failed
                                  - Warning
                                example: Pending
                              runDate:
                                type: string
                                description: Time when this job started
                                example: 2022-01-31T12:37:25.109Z
                              logs:
                                type: array
                                description: An array of log lines
                                items:
                                  type: string
                                  example: 2022-01-31T12:37:25.109412Z INFO Job finished with success!
                              logsSize:
                                type: number
                                description: The number of returned log lines
                              failedRecordsFileId:
                                type: string
                                format: uuid
                                description: UUID of the input file that couldn't be processed
                              successCount:
                                type: integer
                                description: Number of rows successfully processed by the job
                              failureCount:
                                type: integer
                                description: Number of rows that failed during processing by the job
                  overallRunStatus:
                    type: string
                    description: High-level status of the job. If a given type of job doesn't exist in a workflow (for example, `transformData` in a workflow without any Data Transformation nodes), the status is `Pending`.
                    enum:
                      - Pending
                      - InProgress
                      - Finished
                      - Failed
                      - Warning
                    example: Pending
        "401":
          description: "Unauthorized: wrong consumer scope; token missing/expired/invalid; invalid API key; etc."
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                  - status
                properties:
                  error:
                    type: string
                    description: Summary of the error
                  status:
                    type: integer
                    format: int32
                    description: Status code
                  timestamp:
                    type: string
                    description: Time when the error occurred
                  message:
                    type: string
                    description: Description of the problem. If an error code is included, check the [API Error Reference](https://developers.synerise.com/errors.html) for details.
        "403":
          description: Forbidden; insufficient permissions
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                  - status
                properties:
                  error:
                    type: string
                    description: Summary of the error
                  status:
                    type: integer
                    format: int32
                    description: Status code
                  timestamp:
                    type: string
                    description: Time when the error occurred
                  message:
                    type: string
                    description: Description of the problem. If an error code is included, check the [API Error Reference](https://developers.synerise.com/errors.html) for details.
        "404":
          description: |
            - workflow doesn't exist; 
            - no journeys exist for a workflow; 
            - workflow doesn't contain any of the required nodes (returns a "no journeys found" error)
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                  - status
                properties:
                  error:
                    type: string
                    description: Summary of the error
                  status:
                    type: integer
                    format: int32
                    description: Status code
                  timestamp:
                    type: string
                    description: Time when the error occurred
                  message:
                    type: string
                    description: Description of the problem. If an error code is included, check the [API Error Reference](https://developers.synerise.com/errors.html) for details.
              example:
                error: Not found
                status: 404
                timestamp: 2023-09-06T11:54:08.564Z
                message: No journeys for diagram fe7e3a80-91bb-433a-94cf-744253cc442c found
      security:
        - JWT: []
      x-snr-doc-urls:
        - /api-reference/automation#tag/Data-Processing-Job-Logs/operation/getExtendedInfoAboutLastRun
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request GET \
              --url 'https://api.synerise.com/morph/logs/automation/%7BautomationWorkflowId%7D/last-run/with-stages?limit=SOME_NUMBER_VALUE' \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'
        - lang: Python
          label: Python
          source: |-
            import http.client

            conn = http.client.HTTPSConnection("api.synerise.com")

            headers = { 'Authorization': "Bearer REPLACE_BEARER_TOKEN" }

            conn.request("GET", "/morph/logs/automation/%7BautomationWorkflowId%7D/last-run/with-stages?limit=SOME_NUMBER_VALUE", headers=headers)

            res = conn.getresponse()
            data = res.read()

            print(data.decode("utf-8"))
        - lang: JavaScript
          label: JavaScript
          source: |-
            const data = null;

            const xhr = new XMLHttpRequest();
            xhr.withCredentials = true;

            xhr.addEventListener("readystatechange", function () {
              if (this.readyState === this.DONE) {
                console.log(this.responseText);
              }
            });

            xhr.open("GET", "https://api.synerise.com/morph/logs/automation/%7BautomationWorkflowId%7D/last-run/with-stages?limit=SOME_NUMBER_VALUE");
            xhr.setRequestHeader("Authorization", "Bearer REPLACE_BEARER_TOKEN");

            xhr.send(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const http = require("https");

            const options = {
              "method": "GET",
              "hostname": "api.synerise.com",
              "port": null,
              "path": "/morph/logs/automation/%7BautomationWorkflowId%7D/last-run/with-stages?limit=SOME_NUMBER_VALUE",
              "headers": {
                "Authorization": "Bearer REPLACE_BEARER_TOKEN"
              }
            };

            const req = http.request(options, function (res) {
              const chunks = [];

              res.on("data", function (chunk) {
                chunks.push(chunk);
              });

              res.on("end", function () {
                const body = Buffer.concat(chunks);
                console.log(body.toString());
              });
            });

            req.end();
        - lang: PHP
          label: PHP
          source: |-
            <?php

            $request = new HttpRequest();
            $request->setUrl('https://api.synerise.com/morph/logs/automation/%7BautomationWorkflowId%7D/last-run/with-stages');
            $request->setMethod(HTTP_METH_GET);

            $request->setQueryData([
              'limit' => 'SOME_NUMBER_VALUE'
            ]);

            $request->setHeaders([
              'Authorization' => 'Bearer REPLACE_BEARER_TOKEN'
            ]);

            try {
              $response = $request->send();

              echo $response->getBody();
            } catch (HttpException $ex) {
              echo $ex;
            }
        - lang: Java
          label: Java
          source: |-
            HttpResponse<String> response = Unirest.get("https://api.synerise.com/morph/logs/automation/%7BautomationWorkflowId%7D/last-run/with-stages?limit=SOME_NUMBER_VALUE")
              .header("Authorization", "Bearer REPLACE_BEARER_TOKEN")
              .asString();
servers:
  - description: Microsoft Azure EU
    url: https://api.synerise.com
  - description: Microsoft Azure USA
    url: https://api.azu.synerise.com
  - description: Google Cloud Platform
    url: https://api.geb.synerise.com
tags:
  - name: Data Processing Job Logs
components:
  securitySchemes:
    JWT:
      type: http
      scheme: bearer
      description: |-
        JWT Bearer token. The header looks like this: `Bearer {JWT}`

        Remember to include the space between 'Bearer' and the token.

        Generate a token via the **Authorization** endpoints.
```
