## Documentation Index

Fetch the complete documentation index at: [/llms.txt](https://docs.cognigy.com/llms.txt)

Use this file to discover all available pages before exploring further.

### Update a scheduler by reference

#### Request Method: PATCH

```
PATCH /simulations/{simulationReference}/schedules/{schedulerReference}
```

#### Example Code Snippets

##### cURL

```
curl --request PATCH \
  --url https://api-trial.cognigy.ai/testing/simulations/{simulationReference}/schedules/{schedulerReference} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "runConfig": {
    "flowReferenceId": "<string>",
    "localeReferenceId": "<string>",
    "entrypoint": "<string>",
    "largeLanguageModelReferenceId": "<string>",
    "userId": "<string>",
    "finalPing": 123,
    "data": {},
    "enableMocking": true
  },
  "enableSchedule": true,
  "time": "2023-11-07T05:31:56Z",
  "numberOfRuns": 123,
  "nextScheduledRun": "2023-11-07T05:31:56Z",
  "emailNotifications": [
    "<string>"
  ],
  "scenarioName": "<string>",
  "runName": "<string>",
  "simulationReference": "<string>",
  "endDate": "2023-11-07T05:31:56Z"
}
'
```

##### Python

```python
import requests

url = "https://api-trial.cognigy.ai/testing/simulations/{simulationReference}/schedules/{schedulerReference}"

payload = {
    "runConfig": {
        "flowReferenceId": "<string>",
        "localeReferenceId": "<string>",
        "entrypoint": "<string>",
        "largeLanguageModelReferenceId": "<string>",
        "userId": "<string>",
        "finalPing": 123,
        "data": {},
        "enableMocking": True
    },
    "enableSchedule": True,
    "time": "2023-11-07T05:31:56Z",
    "numberOfRuns": 123,
    "nextScheduledRun": "2023-11-07T05:31:56Z",
    "emailNotifications": ["<string>"],
    "scenarioName": "<string>",
    "runName": "<string>",
    "simulationReference": "<string>",
    "endDate": "2023-11-07T05:31:56Z"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
```

##### JavaScript (Fetch API)

```javascript
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    runConfig: {
      flowReferenceId: '<string>',
      localeReferenceId: '<string>',
      entrypoint: '<string>',
      largeLanguageModelReferenceId: '<string>',
      userId: '<string>',
      finalPing: 123,
      data: {},
      enableMocking: true
    },
    enableSchedule: true,
    time: '2023-11-07T05:31:56Z',
    numberOfRuns: 123,
    nextScheduledRun: '2023-11-07T05:31:56Z',
    emailNotifications: ['<string>'],
    scenarioName: '<string>',
    runName: '<string>',
    simulationReference: '<string>',
    endDate: '2023-11-07T05:31:56Z'
  })
};

fetch('https://api-trial.cognigy.ai/testing/simulations/{simulationReference}/schedules/{schedulerReference}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

#### Request Body

Field | Type | Description  
---|---|---  
`runConfig` | `object` | Configuration for the run.  
`enableSchedule` | `boolean` | Enable/disable scheduling.  
`time` | `string<date-time>` | The time for the scheduling.  
`numberOfRuns` | `integer` | Total number of runs.  
`nextScheduledRun` | `string<date-time>` | Next scheduled run time.  
`emailNotifications` | `string[]` | List of email notifications.  
`scenarioName` | `string` | Name of the scenario.  
`runName` | `string` | Name of the run.  
`simulationReference` | `string` | Reference ID for the simulation.  
`endDate` | `string<date-time>` | End date for the scheduling.

#### Response

- **200 OK**  
Scheduler updated successfully.

```json
{
  "scheduler": {
    "id": "<string>",
    "simulationReference": "<string>",
    "projectReference": "<string>",
    "organisationReference": "<string>",
    "runConfig": {
      "flowReferenceId": "<string>",
      "localeReferenceId": "<string>",
      "entrypoint": "<string>",
      "largeLanguageModelReferenceId": "<string>",
      "userId": "<string>",
      "finalPing": 123,
      "data": {},
      "enableMocking": true
    },
    "enableSchedule": true,
    "time": "2023-11-07T05:31:56Z",
    "numberOfRuns": 123,
    "nextScheduledRun": "2023-11-07T05:31:56Z",
    "emailNotifications": ["<string>"],
    "scenarioName": "<string>",
    "runName": "<string>",
    "endDate": "2023-11-07T05:31:56Z"
  }
}
```

#### Error Responses

- **400 Bad Request**  
```json
{
  "error": "<string>",
  "field": "<string>",
  "code": "<string>",
  "traceId": "<string>"
}
```

- **401 Unauthorized**  
```json
{
  "error": "<string>",
  "code": "<string>",
  "traceId": "<string>"
}
```

- **403 Forbidden**  
```json
{
  "error": "<string>",
  "code": "<string>",
  "traceId": "<string>"
}
```

- **404 Not Found**  
```json
{
  "error": "<string>",
  "code": "<string>",
  "traceId": "<string>"
}
```

- **500 Internal Server Error**  
```json
{
  "error": "<string>",
  "code": "<string>",
  "traceId": "<string>"
}
```
