# Get upcoming schedule events

- Operation ID: `getDiagramSchedulePendingEvents`
- HTTP method: `GET`
- Path: `/automation-brain/diagrams/{diagramId}/schedule-upcoming-events`
- [Human-readable API reference](https://hub.synerise.com/api-reference/automation#tag/Workflow-schedules/operation/getDiagramSchedulePendingEvents)

## 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:
  /automation-brain/diagrams/{diagramId}/schedule-upcoming-events:
    get:
      security:
        - JWT: []
      tags:
        - Workflow schedules
      summary: Get upcoming schedule events
      operationId: getDiagramSchedulePendingEvents
      description: |
        Get a list of upcoming events (rule executions) caused by a schedule. You can limit the list to a time range defined by `start` and `end`.


        ---

        **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:** `AUTOMATON_BRAIN_DIAGRAM_SCHEDULE_READ`

        **User role permission required:** `automation_2_journeys: read`
      parameters:
        - name: diagramId
          in: path
          description: UUID of the workflow/diagram
          required: true
          schema:
            type: string
        - name: start
          in: query
          description: Start date
          schema:
            type: string
            format: date-time
        - name: end
          in: query
          description: End date
          schema:
            type: string
            format: date-time
      responses:
        "200":
          description: Upcoming schedule events
          content:
            application/json:
              schema:
                type: object
                properties:
                  hasMore:
                    type: boolean
                    description: "`true` when there are entries outside the start/end range"
                  events:
                    type: array
                    description: Upcoming schedule rule executions
                    items:
                      type: object
                      properties:
                        actionType:
                          type: string
                          description: The status to apply when the rule runs. **A stopped workflow can't be restarted**.
                          enum:
                            - Resume
                            - Pause
                            - Stop
                        ruleId:
                          type: string
                          format: uuid
                          description: Unique ID of the rule
                        plannedAt:
                          type: string
                          description: The time when this rule will be executed
                          example: 2020-01-01T01:00:00Z
                        timezone:
                          description: |
                            Timezone of the schedule. Accepts these formats:
                            - "Europe/Paris"
                            - "-05:00"
                            - "UTC-1"
                          type: string
                          example: Europe/Paris
                      required:
                        - actionId
                        - actionType
                        - plannedAt
                        - timezone
                required:
                  - hasMore
                  - events
        "400":
          description: See error message for details
          content:
            application/json:
              schema:
                type: object
                properties:
                  httpStatus:
                    type: integer
                    description: HTTP status code of error
                  errorCode:
                    type: string
                    description: Synerise error code. See [API error reference](https://developers.synerise.com/errors.html)
                  message:
                    type: string
                    description: A description of the problem
                  timestamp:
                    type: string
                    format: date-time
                    description: Time when the problem occurred
                  help:
                    type: string
                    description: Link to the error reference
                  traceId:
                    type: string
                    description: Trace ID for troubleshooting
                  errors:
                    type: array
                    description: Array of errors
                    items:
                      $ref: "#/components/schemas/automation-brain-Error"
                  source:
                    type: object
                    description: Source of the problem
                    properties:
                      pointer:
                        type: string
                      value:
                        type: string
                    required:
                      - pointer
                  details:
                    type: object
                    description: Additional details
                    properties:
                      activeDiagrams:
                        type: array
                        description: Running diagrams using the entity, returned when they block the operation (e.g. error ABV-0101)
                        items:
                          type: object
                          description: Id and name of a diagram referenced in error details
                          required:
                            - id
                            - name
                          properties:
                            id:
                              type: string
                              format: uuid
                            name:
                              type: string
                    additionalProperties:
                      type: string
                  field:
                    type: string
                    description: JSON field which caused a problem
                required:
                  - errorCode
                  - httpStatus
                  - message
        "403":
          description: Forbidden; insufficient permissions
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Summary of the error
                  status:
                    type: integer
                    format: int32
                    description: Status code
                  timestamp:
                    type: string
                    description: Time when the message was sent
                  message:
                    type: string
                    description: Description of the problem
      x-snr-doc-urls:
        - /api-reference/automation#tag/Workflow-schedules/operation/getDiagramSchedulePendingEvents
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request GET \
              --url 'https://api.synerise.com/automation-brain/diagrams/%7BdiagramId%7D/schedule-upcoming-events?start=SOME_STRING_VALUE&end=SOME_STRING_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", "/automation-brain/diagrams/%7BdiagramId%7D/schedule-upcoming-events?start=SOME_STRING_VALUE&end=SOME_STRING_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/automation-brain/diagrams/%7BdiagramId%7D/schedule-upcoming-events?start=SOME_STRING_VALUE&end=SOME_STRING_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": "/automation-brain/diagrams/%7BdiagramId%7D/schedule-upcoming-events?start=SOME_STRING_VALUE&end=SOME_STRING_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/automation-brain/diagrams/%7BdiagramId%7D/schedule-upcoming-events');
            $request->setMethod(HTTP_METH_GET);

            $request->setQueryData([
              'start' => 'SOME_STRING_VALUE',
              'end' => 'SOME_STRING_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/automation-brain/diagrams/%7BdiagramId%7D/schedule-upcoming-events?start=SOME_STRING_VALUE&end=SOME_STRING_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: Workflow schedules
components:
  schemas:
    automation-brain-Error:
      type: object
      properties:
        httpStatus:
          type: integer
          description: HTTP status code of error
        errorCode:
          type: string
          description: Synerise error code. See [API error reference](https://developers.synerise.com/errors.html)
        message:
          type: string
          description: A description of the problem
        timestamp:
          type: string
          format: date-time
          description: Time when the problem occurred
        help:
          type: string
          description: Link to the error reference
        traceId:
          type: string
          description: Trace ID for troubleshooting
        errors:
          type: array
          description: Array of errors
          items:
            $ref: "#/components/schemas/automation-brain-Error"
        source:
          type: object
          description: Source of the problem
          properties:
            pointer:
              type: string
            value:
              type: string
          required:
            - pointer
        details:
          type: object
          description: Additional details
          properties:
            activeDiagrams:
              type: array
              description: Running diagrams using the entity, returned when they block the operation (e.g. error ABV-0101)
              items:
                type: object
                description: Id and name of a diagram referenced in error details
                required:
                  - id
                  - name
                properties:
                  id:
                    type: string
                    format: uuid
                  name:
                    type: string
          additionalProperties:
            type: string
        field:
          type: string
          description: JSON field which caused a problem
      required:
        - errorCode
        - httpStatus
        - message
  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.
```
