# Get workflow schedule

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

## 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:
    get:
      security:
        - JWT: []
      tags:
        - Workflow schedules
      summary: Get workflow schedule
      operationId: getDiagramSchedule
      description: |
        Get all schedule rules of a workflow.


        ---

        **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
      responses:
        "200":
          description: Schedule rules
          content:
            application/json:
              schema:
                type: object
                properties:
                  active:
                    description: "`true` if schedule is enabled."
                    type: boolean
                  timezone:
                    description: |
                      Timezone of the schedule. Accepts these formats:
                      - "Europe/Paris"
                      - "-05:00"
                      - "UTC-1"
                    type: string
                    example: Europe/Paris
                  rules:
                    type: array
                    description: Rules of the schedule
                    items:
                      type: object
                      properties:
                        ruleId:
                          type: string
                          format: uuid
                          description: Unique ID of the rule
                        actionType:
                          type: string
                          description: The status to apply when the rule runs. **A stopped workflow can't be restarted**.
                          enum:
                            - Resume
                            - Pause
                            - Stop
                        repeatModel:
                          description: Repetition times
                          type: object
                          required:
                            - repeatType
                            - body
                          properties:
                            repeatType:
                              description: |
                                Repetition type. **Currently, only `OnDate` is compatible with the Synerise Web Portal.**

                                - "Interval" runs the rule after a counter finishes. Then the counter restarts.
                                - "Daily" runs the rule at a specific time each day.
                                - "Weekly" runs the rule on specific days of the week, at a specific time.
                                - "Monthly" runs the rule on specific days of the month, at a specific time.
                                - "OnDate" runs the rule once, at a specific date and time.
                              type: string
                              enum:
                                - Interval
                                - Daily
                                - Weekly
                                - Monthly
                                - OnDate
                            body:
                              description: Repetition time
                              oneOf:
                                - title: Interval
                                  type: object
                                  required:
                                    - start
                                    - intervalSeconds
                                  properties:
                                    start:
                                      type: string
                                      description: Date and time to start counting the interval from
                                      format: date-time
                                      example: 2020-01-01T01:00:00.000
                                    intervalSeconds:
                                      type: integer
                                      minimum: 3600
                                      maximum: 31536000
                                      description: The interval value in seconds
                                      example: 6000
                                - title: Daily
                                  type: object
                                  required:
                                    - hours
                                  properties:
                                    hours:
                                      type: array
                                      description: Used for running the rule at a specific time or times every day.
                                      items:
                                        type: string
                                        description: Hour with minutes
                                        example: 12:30
                                - title: Weekly
                                  type: object
                                  required:
                                    - daysOfWeek
                                  properties:
                                    daysOfWeek:
                                      type: array
                                      description: Used for running the rule on specific days of the week.
                                      items:
                                        type: object
                                        required:
                                          - day
                                          - dayTime
                                          - ruleId
                                        properties:
                                          day:
                                            type: integer
                                            description: Number of the day in the week. `1` is Monday.
                                          dayTime:
                                            type: string
                                            description: Hour with minutes
                                            example: 21:37
                                          ruleId:
                                            type: integer
                                            description: Number of the rule
                                - title: Monthly
                                  type: object
                                  required:
                                    - daysOfMonth
                                  properties:
                                    daysOfMonth:
                                      type: array
                                      description: Used for running the automation on specific days of the month.
                                      items:
                                        type: object
                                        required:
                                          - day
                                          - dayTime
                                          - ruleId
                                        properties:
                                          day:
                                            type: integer
                                            description: Days of the month with. `-1` is the last day of the month.
                                          dayTime:
                                            type: string
                                            description: Hour with minutes
                                            example: 21:37
                                          ruleId:
                                            type: integer
                                            description: Number of rule
                                - title: OnDate
                                  type: object
                                  required:
                                    - date
                                  properties:
                                    date:
                                      type: string
                                      description: A date and time when the rule runs.
                                      example: 2020-01-01T01:00:00.000
                        listingAuthor:
                          type: object
                          description: Author of the rule
                          properties:
                            userId:
                              type: number
                              description: Unique ID of a Synerise user
                        createdAt:
                          type: string
                          example: 2020-01-01T01:00:00Z
                          format: date-time
                          description: Date and time when the rule was created
                      required:
                        - ruleId
                        - actionType
                        - repeatModel
                        - listingAuthor
                        - createdAt
                required:
                  - active
                  - timezone
                  - rules
        "400":
          description: See error message for details
          content:
            text/plain:
              schema:
                type: string
                description: Description of the problem
        "401":
          description: "Unauthorized: wrong consumer scope; token missing/expired/invalid; invalid API key; etc."
          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
        "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
        "404":
          description: Resource not found
          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/getDiagramSchedule
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request GET \
              --url https://api.synerise.com/automation-brain/diagrams/%7BdiagramId%7D/schedule \
              --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", 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");
            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",
              "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');
            $request->setMethod(HTTP_METH_GET);

            $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")
              .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:
  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.
```
