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

# Community Templates

> Discover, clone, and customize shared workflow templates

Community templates are pre-built workflow templates shared by Bigdata. They provide ready-to-use research workflows that you can clone and customize for your needs.

## Listing Community Templates

Browse available community templates:

```python theme={null}
import requests
from dotenv import load_dotenv
import os

load_dotenv()
my_api_key = os.getenv('BIGDATA_API_KEY')

headers = {"X-API-KEY": my_api_key}

# List community templates
response = requests.get(
    "https://agents.bigdata.com/v1/workflow/templates/community",
    headers=headers,
    params={"limit": 20}
)

templates = response.json()

print(f"Found {templates['count']} community templates:\n")

for t in templates["results"]:
    print(f"ID: {t['id']}")
    print(f"Name: {t['name']}")
    if t.get('description'):
        print(f"Description: {t['description']}")
    print(f"Created: {t['created_at']}")
    print("-" * 50)
```

## Viewing Template Details

Get full details of a specific template:

```python theme={null}
template_id = "your-template-id"

response = requests.get(
    f"https://agents.bigdata.com/v1/workflow/templates/{template_id}",
    headers={"X-API-KEY": my_api_key}
)

template = response.json()

print(f"Name: {template['name']}")
print(f"Description: {template.get('description', 'N/A')}")
print(f"\nPrompt:\n{template['prompt']}")

if template.get('expected_input'):
    print(f"\nInputs:")
    for name, schema in template['expected_input'].items():
        print(f"  - {name}: {schema['type']}")

if template.get('research_plan'):
    plan = template['research_plan']
    print(f"\nResearch Plan: {plan['title']}")
    for step in plan.get('steps', []):
        print(f"  - {step['description']}")
```

## Cloning a Template

Clone a community template to your account:

```python theme={null}
template_id = "community-template-id"

# Clone the template
response = requests.post(
    f"https://agents.bigdata.com/v1/workflow/templates/{template_id}/clone",
    headers={"X-API-KEY": my_api_key}
)

cloned = response.json()
print(f"Cloned template ID: {cloned['id']}")
print(f"Name: {cloned['name']}")
```

### Clone with Custom Name

You can optionally provide a new name when cloning:

```python theme={null}
response = requests.post(
    f"https://agents.bigdata.com/v1/workflow/templates/{template_id}/clone",
    headers={
        "X-API-KEY": my_api_key,
        "Content-Type": "application/json"
    },
    json={"name": "My Custom Analysis Template"}
)

cloned = response.json()
print(f"Cloned as: {cloned['name']}")
```

## Customizing Cloned Templates

After cloning, modify the template to fit your needs:

```python theme={null}
cloned_template_id = "your-cloned-template-id"

# Update the template
updates = {
    "name": "Enhanced Credit Analysis",
    "prompt": """Analyze {{ company_id }} with focus on credit quality.

Include:
1. Business model and competitive position
2. Financial leverage and coverage ratios
3. Liquidity assessment
4. Credit ratings and recent actions
5. Key risks and outlook
6. Investment recommendation

Format the output with clear sections and supporting data.""",
    "research_plan": {
        "title": "Credit Analysis Steps",
        "steps": [
            {"description": "Research company background and industry position"},
            {"description": "Analyze financial statements for leverage metrics"},
            {"description": "Review credit ratings and analyst commentary"},
            {"description": "Assess liquidity and refinancing risk"},
            {"description": "Synthesize findings into recommendation"}
        ]
    }
}

response = requests.put(
    f"https://agents.bigdata.com/v1/workflow/templates/{cloned_template_id}",
    headers={
        "X-API-KEY": my_api_key,
        "Content-Type": "application/json"
    },
    json=updates
)

updated = response.json()
print(f"Updated template: {updated['name']}")
```

## Managing Your Templates

### List Your Templates

```python theme={null}
response = requests.get(
    "https://agents.bigdata.com/v1/workflow/templates",
    headers={"X-API-KEY": my_api_key},
    params={"limit": 50}
)

templates = response.json()
print(f"You have {templates['count']} templates")

for t in templates["results"]:
    print(f"  {t['id']}: {t['name']}")
```

### Delete a Template

```python theme={null}
template_id = "template-to-delete"

response = requests.delete(
    f"https://agents.bigdata.com/v1/workflow/templates/{template_id}",
    headers={"X-API-KEY": my_api_key}
)

if response.status_code == 200:
    print("Template deleted successfully")
```

## Pagination

Both community and user templates support cursor-based pagination:

```python theme={null}
def list_all_community_templates():
    """Fetch all community templates with pagination."""
    templates = []
    cursor = None

    while True:
        params = {"limit": 20}
        if cursor:
            params["cursor"] = cursor

        response = requests.get(
            "https://agents.bigdata.com/v1/workflow/templates/community",
            headers={"X-API-KEY": my_api_key},
            params=params
        )

        data = response.json()
        templates.extend(data["results"])

        cursor = data.get("cursor")
        if not cursor:
            break

    return templates

all_templates = list_all_community_templates()
print(f"Total community templates: {len(all_templates)}")
```

## Best Practices

1. **Review before cloning**: Check the template's prompt and inputs to ensure it fits your use case
2. **Customize after cloning**: Modify cloned templates to match your specific requirements
3. **Add content filters**: Consider adding source restrictions for focused research
4. **Include research plans**: Add structured plans for consistent, reproducible output
5. **Keep names descriptive**: Use clear names that indicate the template's purpose

## Next Steps

<CardGroup cols={2}>
  <Card title="Creating Templates" icon="file-code" href="/how-to-guides/workflows/creating_templates">
    Build custom templates from scratch
  </Card>

  <Card title="Example Templates" icon="lightbulb" href="/how-to-guides/workflows/example_templates">
    Ready-to-use financial analysis templates
  </Card>
</CardGroup>
