## 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.

---

### Schedule a Playbook Run

**POST** /v2.0/playbooks/{playbookId}/schedule

#### cURL Example

```bash
curl --request POST \
  --url https://api-trial.cognigy.ai/new/v2.0/playbooks/{playbookId}/schedule \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '@payload.json'
```

#### Payload Example

```json
{
  "entrypoint": "61f25579055c2f43c249a181",
  "flowId": "010d1970-89b9-4012-892b-53c78ef6c117",
  "localeId": "8b3b45e2-48f9-446d-a4c5-35d8284a01b2"
}
```

### Code Samples

**Python**

```python
import requests

url = "https://api-trial.cognigy.ai/new/v2.0/playbooks/{playbookId}/schedule"

payload = {
    "entrypoint": "61f25579055c2f43c249a181",
    "flowId": "010d1970-89b9-4012-892b-53c78ef6c117",
    "localeId": "8b3b45e2-48f9-446d-a4c5-35d8284a01b2"
}
headers = {
    "X-API-Key": "<api-key>",
    "Content-Type": "application/json"
}

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

print(response.text)
```

**JavaScript (Fetch)**

```javascript
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    entrypoint: '61f25579055c2f43c249a181',
    flowId: '010d1970-89b9-4012-892b-53c78ef6c117',
    localeId: '8b3b45e2-48f9-446d-a4c5-35d8284a01b2'
  })
};

fetch('https://api-trial.cognigy.ai/new/v2.0/playbooks/{playbookId}/schedule', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Response Codes

- **200**: Playbook run successfully scheduled.
- **400**: Bad Request - Validation failed.
- **401**: Unauthorized - API key missing or invalid.
- **403**: Forbidden - Access denied.
- **404**: Not Found - The requested resource was not found.
- **500**: Internal Server Error - An unexpected error occurred.

---

### Response Structure

```json
{
  "_id": "<string>",
  "status": "queued",
  "type": "runPlaybook",
  "parameters": {},
  "createdAt": 123,
  "lastChangedAt": 123,
  "progress": 50,
  "job": {
    "name": "<string>",
    "namespace": "<string>",
    "timeoutInMs": 123
  }
}
```

### Errors

#### 400 Bad Request Example

```json
{
  "type": "Bad Request",
  "title": "Bad Request Error",
  "status": 400,
  "detail": "Validation failed. Missing payload.",
  "instance": "/v2.0/flows/5ce7c2d833ea1e04d7e6c432",
  "code": 1000,
  "traceId": "api--f84324f4-98eb-4f02-abdd-375a2e6c3c1f",
  "details": {}
}
```

---

### Authorizations

- **X-API-Key**: Required in the HTTP-Header.

---

### Headers

- **Accept**: Specifies the media type expected in the response. Options: `application/json`, `application/xml`, etc.

---

### Path Parameters

- **playbookId**: Required: The unique identifier for the Playbook (24 characters, alphanumeric).
  
---

### Request Body

- **entrypoint**: Unique identifier for the Snapshot or Project used for the Playbook run.
- **flowId**: The Flow ID for the Playbook run.
- **localeId**: The Locale ID for the Playbook run.
