Skip to content

Feedback: guides-schedule_delete

Original URL: https://www.assemblyai.com/docs/guides/schedule_delete
Category: guides
Generated: 05/08/2025, 4:38:17 pm


Generated: 05/08/2025, 4:38:16 pm

Technical Documentation Analysis & Feedback

Section titled “Technical Documentation Analysis & Feedback”

This documentation provides a functional tutorial but has several clarity, completeness, and structural issues that could frustrate users. Here’s my detailed analysis:


1. Missing Prerequisites & Setup Information

Section titled “1. Missing Prerequisites & Setup Information”

Problems:

  • No clear prerequisites section
  • Environment variable setup mentioned but not demonstrated
  • EasyCron account setup buried in the middle

Recommendations:

## Prerequisites
Before starting this tutorial, ensure you have:
- Python 3.7+ installed
- An AssemblyAI API key ([Get one here](https://www.assemblyai.com/dashboard/signup))
- An EasyCron account and API token ([Sign up here](https://www.easycron.com/cron-jobs))
- Basic familiarity with cron expressions
## Environment Setup
Create a `.env` file in your project directory:
```bash
ASSEMBLYAI_API_KEY=your_assemblyai_key_here
EASYCRON_API_TOKEN=your_easycron_token_here

Install required packages:

Terminal window
pip install assemblyai python-dotenv requests
### **2. Code Inconsistencies & Errors**
**Problems:**
- Variable name inconsistency (`AAI_API_TOKEN` vs `aai.settings.api_key`)
- Hardcoded API keys in examples
- Missing import statements in step-by-step section
**Fix the step-by-step code:**
```python
import os
from dotenv import load_dotenv
import assemblyai as aai
import requests
from datetime import datetime, timedelta, timezone
# Load environment variables
load_dotenv()
# Set API keys from environment variables
aai.settings.api_key = os.getenv("ASSEMBLYAI_API_KEY")
EASYCRON_API_TOKEN = os.getenv("EASYCRON_API_TOKEN")
# Validate API keys are loaded
if not aai.settings.api_key or not EASYCRON_API_TOKEN:
raise ValueError("Please ensure both API keys are set in your .env file")

Add comprehensive error handling:

# After transcript creation
if transcript.status == 'error':
raise Exception(f"Transcription failed: {transcript.error}")
print(f"Transcription completed. Transcript ID: {transcript_id}")
# After EasyCron API call
if response.status_code == 200:
result = response.json()
if result.get('status') == 'success':
cron_job_id = result.get('cron_job_id')
print(f"✅ DELETE request scheduled successfully!")
print(f" Cron Job ID: {cron_job_id}")
print(f" Scheduled for: {time_24_hours_from_now.strftime('%Y-%m-%d %H:%M:%S UTC')}")
else:
print(f"❌ EasyCron error: {result.get('error', 'Unknown error')}")
else:
print(f"❌ HTTP Error {response.status_code}: {response.text}")

Current Problems:

  • Quickstart contains everything, making step-by-step redundant
  • Information scattered across sections
  • No clear separation of concepts

Recommended Structure:

# Schedule a DELETE request with AssemblyAI and EasyCron
## Overview
Brief explanation of what this accomplishes and why it's useful.
## Prerequisites
[As shown above]
## Environment Setup
[As shown above]
## Quick Start
Minimal working example with explanatory comments.
## Detailed Walkthrough
### Step 1: Create and Submit Transcription
### Step 2: Generate Cron Expression
### Step 3: Schedule DELETE Request
### Step 4: Verify Scheduling
## Configuration Options
Different timing options, cron expression examples.
## Troubleshooting
Common issues and solutions.
## Next Steps
Related tutorials and API references.

Add these explanatory sections:

## Why Schedule DELETE Requests?
Scheduled deletion helps you:
- **Manage storage costs** - Remove transcripts after they're no longer needed
- **Comply with data retention policies** - Automatically delete sensitive data
- **Maintain data hygiene** - Prevent accumulation of old transcripts
## Understanding Cron Expressions
The generated cron expression `{minute} {hour} {day} {month} * {year}` means:
- `{minute}` - Exact minute (0-59)
- `{hour}` - Exact hour (0-23)
- `{day}` - Exact day of month (1-31)
- `{month}` - Exact month (1-12)
- `*` - Any day of week
- `{year}` - Specific year
**Example:** `30 14 15 3 * 2024` = March 15th, 2024 at 2:30 PM UTC

Add flexible scheduling options:

# Different scheduling options
def create_cron_expression(hours_from_now=24):
"""Create cron expression for deletion scheduling"""
future_time = datetime.now(timezone.utc) + timedelta(hours=hours_from_now)
return f'{future_time.minute} {future_time.hour} {future_time.day} {future_time.month} * {future_time.year}'
# Examples
delete_in_1_hour = create_cron_expression(1)
delete_in_1_week = create_cron_expression(168) # 24 * 7
delete_in_30_days = create_cron_expression(720) # 24 * 30

Expand troubleshooting section:

## Troubleshooting
### Common Issues
**"Invalid cron expression" error**
- **Cause:** Timezone mismatch or invalid date
- **Solution:** Verify your EasyCron account timezone is set to UTC
- **Check:** Go to [Account Settings](https://www.easycron.com/user/edit)
**"Authorization failed" error**
- **Cause:** Incorrect API key format in headers
- **Solution:** Ensure header format is `Authorization: YOUR_API_KEY` (not `Bearer`)
**Transcript not found when DELETE executes**
- **Cause:** Transcript may have been manually deleted
- **Solution:** Add error handling in your deletion workflow
**Job doesn't execute at scheduled time**
- **Cause:** EasyCron account limitations or timezone issues
- **Solution:** Check your EasyCron dashboard for job status and logs
### Verification Steps
1. **Verify transcript creation:**
```python
print(f"Transcript status: {transcript.status}")
print(f"Transcript ID: {transcript.id}")
  1. Test the DELETE URL manually:

    Terminal window
    curl -X DELETE "https://api.assemblyai.com/v2/transcript/YOUR_TRANSCRIPT_ID" \
    -H "Authorization: YOUR_API_KEY"
  2. Check EasyCron job status: Visit your EasyCron dashboard to verify the job was created.

### **8. Missing Next Steps & Related Information**
**Add helpful next steps:**
```markdown
## Next Steps
- **Monitor your scheduled jobs:** [EasyCron Dashboard](https://www.easycron.com/cron-jobs)
- **Learn about batch operations:** [Delete Multiple Transcripts Guide](link)
- **Explore webhook alternatives:** [AssemblyAI Webhooks Documentation](link)
- **Set up automated transcription:** [Scheduled Transcription Tutorial](link)
## Related Resources
- [AssemblyAI DELETE API Reference](https://www.assemblyai.com/docs/api-reference/transcript#delete
---