> ## Documentation Index
> Fetch the complete documentation index at: https://docs.longstories.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Start generating videos with LongStories in minutes

## Get Your API Key

1. Sign up at [LongStories.ai](https://longstories.ai)
2. Go to your [Dashboard](https://longstories.ai/dashboard)
3. Navigate to the API section
4. Generate a new API key

## Make Your First Request

Generate your first video with a simple POST request:

```bash theme={null}
curl -X POST 'https://longstories.ai/api/v1/short' \
-H 'Content-Type: application/json' \
-H 'x-api-key: your-api-key' \
-d '{
  "prompt": "Create a video about the benefits of meditation",
  "scriptConfig": {
    "style": "engaging_conversational"
  },
  "imageConfig": {
    "model": "flux_schnell"
  }
}'
```

This will return a response with your generation run ID:

```json theme={null}
{
  "data": {
    "id": "run_rgncvakhqks9in7rdma2o"
  },
  "requestId": "472913f0-c717-4a59-898f-ea404e5978fc"
}
```

## Check Generation Status

Monitor the status of your video generation:

```bash theme={null}
curl 'https://longstories.ai/api/v1/short?runId=run_rgncvakhqks9in7rdma2o' \
-H 'x-api-key: your-api-key'
```

Response when complete:

```json theme={null}
{
  "data": {
    "status": "COMPLETED",
    "isCompleted": true,
    "isSuccess": true,
    "output": {
      "url": "https://s3.us-east-1.amazonaws.com/remotionlambda-useast1-hz34hfca77/renders/hvcugxdic1/out.mp4",
      "size": 5907614
    },
    "error": null
  },
  "requestId": "472913f0-c717-4a59-898f-ea404e5978fc"
}
```

## Next Steps

1. Explore the [API Reference](/api-reference/introduction) for all available options
2. Learn about [Error Handling](/errors/handling) for robust implementations
3. Check out our [Examples](/examples) for common use cases
4. Join our [Discord](https://discord.gg/longstories) community

## Code Examples

### JavaScript/TypeScript

```typescript theme={null}
async function generateVideo(prompt: string) {
  const response = await fetch('https://longstories.ai/api/v1/short', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'x-api-key': 'your-api-key'
    },
    body: JSON.stringify({
      prompt,
      scriptConfig: {
        style: 'educational'
      },
      imageConfig: {
        model: 'flux_schnell'
      }
    })
  });

  const { data } = await response.json();
  return data.id;
}

async function checkStatus(runId: string) {
  const response = await fetch(`https://longstories.ai/api/v1/short?runId=${runId}`, {
    headers: {
      'x-api-key': 'your-api-key'
    }
  });

  const { data } = await response.json();
  return data;
}

// Usage
const runId = await generateVideo('Create a video about the benefits of meditation');
console.log('Generation started:', runId);

// Poll for status
const checkInterval = setInterval(async () => {
  const status = await checkStatus(runId);
  console.log('Status:', status.status);
  
  if (status.isCompleted) {
    if (status.isSuccess) {
      console.log('Video URL:', status.output.url);
    } else {
      console.log('Generation failed:', status.error?.message);
    }
    clearInterval(checkInterval);
  }
}, 5000);
```

### Python

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

API_KEY = 'your-api-key'
BASE_URL = 'https://longstories.ai/api/v1'

def generate_video(prompt: str) -> str:
    response = requests.post(
        f'{BASE_URL}/short',
        headers={
            'Content-Type': 'application/json',
            'x-api-key': API_KEY
        },
        json={
            'prompt': prompt,
            'scriptConfig': {
                'style': 'educational'
            },
            'imageConfig': {
                'model': 'flux_schnell'
            }
        }
    )
    data = response.json()['data']
    return data['id']

def check_status(run_id: str) -> dict:
    response = requests.get(
        f'{BASE_URL}/short',
        params={'runId': run_id},
        headers={'x-api-key': API_KEY}
    )
    return response.json()['data']

# Usage
run_id = generate_video('Create a video about the benefits of meditation')
print(f'Generation started: {run_id}')

# Poll for status
while True:
    status = check_status(run_id)
    print(f'Status: {status["status"]}')
    
    if status['isCompleted']:
        if status['isSuccess']:
            print(f'Video URL: {status["output"]["url"]}')
        else:
            print(f'Generation failed: {status.get("error", {}).get("message")}')
        break
        
    time.sleep(5)
```

## Tips for Success

1. **Start Simple**: Begin with basic prompts and default settings
2. **Be Specific**: Provide clear, detailed prompts for better results
3. **Handle Errors**: Implement proper error handling and retries
4. **Monitor Status**: Poll the status endpoint at reasonable intervals
5. **Test Different Styles**: Experiment with different script and image styles
