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

# Signed URL

> Generate signed URLs for on-demand image generation

## generate\_image\_signed\_url

Generate a signed URL that can be used to generate images on-demand without making API calls. Perfect for dynamic content in emails, web pages, and more.

```python theme={null}
client.generate_image_signed_url(
    template_id: str,
    modifications: Optional[List[Dict[str, Any]]] = None,
    format: str = "png",
    thumbnail: bool = False,
    nocache: bool = False
) -> str
```

### Parameters

<ParamField path="template_id" type="str" required>
  The template ID (e.g., 'tpl\_xxxxxxxxx')
</ParamField>

<ParamField path="modifications" type="list">
  Array of modifications to apply to the template
</ParamField>

<ParamField path="format" type="str" default="png">
  Output format: 'png', 'jpeg', or 'webp'
</ParamField>

<ParamField path="thumbnail" type="bool" default="False">
  Generate thumbnail version
</ParamField>

<ParamField path="nocache" type="bool" default="False">
  Bypass cache and generate fresh image
</ParamField>

### Returns

Returns a signed URL string.

```python theme={null}
str  # e.g., "https://api.bannerify.co/v1/templates/signedurl?..."
```

## Examples

### Basic Signed URL

```python theme={null}
from bannerify import BannerifyClient

client = BannerifyClient("your-api-key")

signed_url = client.generate_image_signed_url("tpl_xxxxxxxxx")

print(f"<img src='{signed_url}' alt='Generated Image' />")
```

### With Modifications

```python theme={null}
signed_url = client.generate_image_signed_url(
    "tpl_xxxxxxxxx",
    modifications=[
        {"name": "title", "text": "Dynamic Title"},
        {"name": "subtitle", "text": "Generated on the fly"}
    ]
)

print(f"<img src='{signed_url}' alt='Dynamic Banner' />")
```

### WebP Format

```python theme={null}
signed_url = client.generate_image_signed_url(
    "tpl_xxxxxxxxx",
    format="webp",
    modifications=[
        {"name": "title", "text": "WebP Image"}
    ]
)
```

### Bypass Cache

```python theme={null}
signed_url = client.generate_image_signed_url(
    "tpl_xxxxxxxxx",
    nocache=True,
    modifications=[
        {"name": "timestamp", "text": datetime.now().strftime("%Y-%m-%d %H:%M:%S")}
    ]
)
```

## Use Cases

### Email Campaigns

Generate personalized images in emails:

```python theme={null}
recipients = [
    {"name": "Alice", "email": "alice@example.com"},
    {"name": "Bob", "email": "bob@example.com"},
]

for recipient in recipients:
    signed_url = client.generate_image_signed_url(
        "tpl_email_header",
        modifications=[
            {"name": "name", "text": f"Hi, {recipient['name']}!"}
        ]
    )
    
    html = f"<img src='{signed_url}' alt='Personalized Header' />"
    # Send email with html
```

### Dynamic Open Graph Images

Generate OG images for social media sharing:

```python theme={null}
def get_og_image_url(title: str, author: str) -> str:
    return client.generate_image_signed_url(
        "tpl_og_image",
        modifications=[
            {"name": "title", "text": title},
            {"name": "author", "text": author}
        ]
    )

# In your template
og_image = get_og_image_url("My Blog Post", "John Doe")
# <meta property="og:image" content="{og_image}" />
```

### Real-time Analytics Badges

```python theme={null}
stats = {
    "views": 1234,
    "likes": 567,
    "shares": 89
}

badge_url = client.generate_image_signed_url(
    "tpl_stats_badge",
    modifications=[
        {"name": "views", "text": str(stats["views"])},
        {"name": "likes", "text": str(stats["likes"])},
        {"name": "shares", "text": str(stats["shares"])}
    ],
    nocache=True
)

print(f"[![Stats]({badge_url})](https://example.com)")
```

### User Profile Cards

```python theme={null}
def generate_profile_card(user_id: str, name: str, avatar: str) -> str:
    return client.generate_image_signed_url(
        "tpl_profile_card",
        modifications=[
            {"name": "user_name", "text": name},
            {"name": "avatar", "src": avatar},
            {"name": "user_id", "text": user_id}
        ]
    )

profile_url = generate_profile_card("123", "Jane Smith", "https://example.com/avatar.jpg")
```

### Flask/Django Integration

```python theme={null}
from flask import render_template

@app.route('/post/<post_id>')
def blog_post(post_id):
    post = get_post(post_id)
    
    og_image = client.generate_image_signed_url(
        "tpl_og_image",
        modifications=[
            {"name": "title", "text": post.title},
            {"name": "author", "text": post.author}
        ]
    )
    
    return render_template('post.html', post=post, og_image=og_image)
```

## Benefits

1. **No API Calls** - Images are generated only when accessed
2. **CDN Caching** - Subsequent requests are served from cache
3. **Security** - URLs are signed and can't be tampered with
4. **Flexibility** - Perfect for emails, OG images, and dynamic content
5. **Cost Effective** - Only generates when actually viewed
