> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/darkzOGx/youtube-automation-agent/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Schedule

> Retrieve upcoming content publishing schedule

## Endpoint

```
GET /schedule
```

## Description

Retrieves the upcoming content publishing schedule from the database. This endpoint returns all content that has been generated and is scheduled for future publishing, allowing you to view what content will be automatically posted and when.

## Request

No parameters required.

### Headers

No special headers required.

## Response

Returns an array of scheduled content items. The exact structure depends on the database schema, but typically includes:

<ResponseField name="schedule" type="array">
  Array of scheduled content items.

  <ResponseField name="schedule[].contentId" type="string">
    Unique identifier for the content.
  </ResponseField>

  <ResponseField name="schedule[].title" type="string">
    Video title.
  </ResponseField>

  <ResponseField name="schedule[].scheduledPublishTime" type="string">
    ISO 8601 timestamp for scheduled publishing.
  </ResponseField>

  <ResponseField name="schedule[].status" type="string">
    Current status: `"scheduled"`, `"published"`, `"processing"`, etc.
  </ResponseField>

  <ResponseField name="schedule[].topic" type="string">
    Content topic or theme.
  </ResponseField>

  <ResponseField name="schedule[].createdAt" type="string">
    When the content was generated.
  </ResponseField>
</ResponseField>

<ResponseField name="error" type="string">
  Error message if the request fails.
</ResponseField>

## Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl http://localhost:3456/schedule
  ```

  ```javascript JavaScript (Fetch) theme={null}
  fetch('http://localhost:3456/schedule')
    .then(response => response.json())
    .then(data => console.log(data));
  ```

  ```python Python theme={null}
  import requests

  response = requests.get('http://localhost:3456/schedule')
  schedule = response.json()

  for item in schedule:
      print(f"{item['scheduledPublishTime']}: {item['title']}")
  ```
</CodeGroup>

## Example Response

### Success

```json theme={null}
[
  {
    "contentId": "content_1234567890abcdef",
    "title": "Master React Hooks in 10 Minutes - Complete Guide for Beginners",
    "topic": "React Hooks Tutorial",
    "scheduledPublishTime": "2026-03-06T14:00:00.000Z",
    "status": "scheduled",
    "createdAt": "2026-03-05T10:30:45.123Z",
    "thumbnailUrl": "/thumbnails/content_1234567890abcdef.png",
    "description": "Learn React Hooks from scratch..."
  },
  {
    "contentId": "content_fedcba0987654321",
    "title": "10 Python Tips Every Developer Should Know",
    "topic": "Python Programming",
    "scheduledPublishTime": "2026-03-07T14:00:00.000Z",
    "status": "scheduled",
    "createdAt": "2026-03-05T08:15:30.456Z",
    "thumbnailUrl": "/thumbnails/content_fedcba0987654321.png",
    "description": "Boost your Python productivity..."
  }
]
```

### Error

```json theme={null}
{
  "error": "Database connection failed"
}
```

## Response Codes

| Status Code | Description                      |
| ----------- | -------------------------------- |
| 200         | Schedule retrieved successfully  |
| 500         | Server error retrieving schedule |

## Use Cases

### Display Upcoming Content

Build a dashboard showing upcoming publications:

```javascript theme={null}
async function displaySchedule() {
  const response = await fetch('http://localhost:3456/schedule');
  const schedule = await response.json();
  
  schedule.forEach(item => {
    const publishDate = new Date(item.scheduledPublishTime);
    console.log(`${publishDate.toLocaleDateString()}: ${item.title}`);
  });
}
```

### Check Content Pipeline

Verify you have enough content scheduled:

```bash theme={null}
# Count scheduled items
curl -s http://localhost:3456/schedule | jq 'length'

# Show next 3 scheduled items
curl -s http://localhost:3456/schedule | jq '.[0:3]'
```

### Calendar Integration

Export schedule to calendar format:

```python theme={null}
import requests
from datetime import datetime

response = requests.get('http://localhost:3456/schedule')
schedule = response.json()

for item in schedule:
    dt = datetime.fromisoformat(item['scheduledPublishTime'].replace('Z', '+00:00'))
    print(f"Event: {item['title']}")
    print(f"Date: {dt.strftime('%Y-%m-%d %H:%M')}")
    print("---")
```

### Monitoring and Alerts

Set up alerts when schedule is running low:

```javascript theme={null}
async function checkScheduleHealth() {
  const response = await fetch('http://localhost:3456/schedule');
  const schedule = await response.json();
  
  if (schedule.length < 3) {
    console.warn('⚠️  Low content inventory! Only', schedule.length, 'items scheduled');
    // Trigger alert or auto-generate more content
  }
}
```

<Note>
  The schedule is automatically managed by the Daily Automation system. Content is generated daily and scheduled according to your optimal posting times determined by the Analytics & Optimization Agent.
</Note>

## Filtering and Sorting

The endpoint returns all upcoming scheduled content. You can filter and sort on the client side:

```javascript theme={null}
// Get only content scheduled for next 7 days
const response = await fetch('http://localhost:3456/schedule');
const schedule = await response.json();

const nextWeek = Date.now() + (7 * 24 * 60 * 60 * 1000);
const upcomingWeek = schedule.filter(item => {
  const publishTime = new Date(item.scheduledPublishTime).getTime();
  return publishTime <= nextWeek;
});

console.log(`${upcomingWeek.length} videos scheduled for next week`);
```
