Python
Get started with Orshot Python SDK
Installation#
pip install orshotInitialise#
os = orshot.Orshot('<ORSHOT_API_KEY>')Render from template#
response = os.render_from_template({
'template_id': 'open-graph-image-1',
'modifications': {'title': 'From python sdk new'},
'response_type': 'base64',
'response_format': 'png'
})Generate Signed URL#
response = os.generate_signed_url({
'template_id': 'open-graph-image-1',
'modifications': {'title': 'From python sdk new'},
'render_type': 'images',
'response_format': 'png',
'expires_at': 1744276943
})Examples#
base64 response format
import orshot
os = orshot.Orshot('<ORSHOT_API_KEY>')
modifications = {
'title': 'From Orshot Python SDK',
'description': 'Create Visuals and Automate Image Generation'
}
response = os.render_from_template({
'template_id': 'open-graph-image-1',
'modifications': modifications,
'response_type': 'base64',
'response_format': 'png'
})binary response format
from io import BytesIO
import orshot
from PIL import Image
os = orshot.Orshot('<ORSHOT_API_KEY>')
modifications = {
'title': 'From Orshot Python SDK',
'description': 'Create Visuals and Automate Image Generation'
}
response = os.render_from_template({
'template_id': 'open-graph-image-1',
'modifications': modifications,
'response_type': 'binary',
'response_format': 'png'
})
with Image.open(BytesIO(response.content)) as im:
im.save('og.png')url response format
import orshot
os = orshot.Orshot('<ORSHOT_API_KEY>')
modifications = {
'title': 'From Orshot Python SDK',
'description': 'Create Visuals and Automate Image Generation'
}
response = os.render_from_template({
'template_id': 'open-graph-image-1',
'modifications': modifications,
'response_type': 'url',
'response_format': 'png'
})render_from_template#
Use this function to generate an image.
| argument | required | description |
|---|---|---|
template_id | Yes | ID of the template (open-graph-image-1, tweet-image-1, beautify-screenshot-1) |
modifications | Yes | Modifications for the selected template. |
response_type | No | base64, binary, url (Defaults to base64). |
response_format | No | png, webp, pdf, jpg, jpeg, avif (Defaults to png) |
For available templates and their modifications refer Orshot Templates Page
generate_signed_url#
Use this function to get a signed URL.
| argument | required | description |
|---|---|---|
template_id | Yes | ID of the template (open-graph-image-1, tweet-image-1, beautify-screenshot-1) |
modifications | Yes | Modifications for the selected template. |
expires_at | Yes | Expires at time in UNIX timestamp (Integer) |
render_type | No | images, pdfs (Defaults to images). |
response_format | No | png, webp, pdf, jpg, jpeg, avif (Defaults to png) |

All Set? Let's Start Automating
- Image, PDF and Video Generation via API
- Canva like editor with AI and smart features
- No-Code Integrations (Zapier, Make, n8n etc.)
- Embed Orshot Studio in your app
- Start Free. No credit card required. Cancel anytime.