Shotify API Integration Guide
Integrate Shotify's screenshot API into your application with minimal effort. This guide provides detailed information on how to use our API, available parameters, and integration examples in various programming languages.
Shotify's API is designed for simplicity. Just make a GET request to our endpoint with the required parameters, and you'll receive a screenshot of the specified webpage in response. No SDK required - it works with any HTTP client.
API Parameters
The Shotify API accepts the following parameters to customize your screenshot requests:
Parameter | Required | Available Values | Description |
---|---|---|---|
url | Yes | Any valid URL | The webpage URL you want to capture. Must be URL-encoded. |
format | Optional Default: png |
png, pdf | Output format for the screenshot. Use 'png' for images or 'pdf' for document format. |
res | Optional Default: fhd |
hd, fhd, 2k, 4k, android, ios | Resolution preset for the screenshot. See the resolution details table below. |
token | Yes | Your API token | Authentication token for accessing the API. Get this from your account dashboard. |
Resolution Details
The res parameter accepts the following values, each representing a specific resolution configuration:
Resolution Value | Width | Height | Device Type | Notes |
---|---|---|---|---|
hd | 1280 | 720 | Desktop | Standard HD resolution |
fhd | 1920 | 1080 | Desktop | Full HD resolution (default) |
2k | 2560 | 1440 | Desktop | QHD/2K resolution |
4k | 3840 | 2160 | Desktop | UHD/4K resolution |
android | 412 | 915 | Mobile | Samsung Galaxy S25 Ultra with mobile user agent |
ios | 430 | 932 | Mobile | iPhone 16 Pro Max with mobile user agent |
Note
When using android or ios resolution options, the API automatically applies the appropriate mobile user agent strings to ensure proper rendering of mobile versions of websites:
- Android: Mozilla/5.0 (Linux; Android 14; SM-S928U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Mobile Safari/537.36
- iOS: Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Mobile/15E148 Safari/604.1
Integration Examples
Below are examples of how to integrate Shotify's API in various programming languages and environments.
cURL Integration
Use cURL to download screenshots directly from the command line or in shell scripts.
Use Cases
- Automated screenshot capture in CI/CD pipelines
- Batch processing of multiple URLs
- Integration with shell scripts
Node.js Integration
For Node.js applications, use the fetch API or a similar HTTP client to download and save screenshots.
For modern Node.js versions using ESM imports:
Python Integration
Python applications can use the requests library to easily download screenshots.
Error Handling Example
PHP Integration
PHP applications can use cURL to reliably download screenshots, which is more robust than file_get_contents.
Java Integration
Java applications can use standard java.net classes to download and save screenshots.
Best Practices
- Token Security: Never expose your API token in client-side code. For browser-based applications, proxy requests through your server.
- Error Handling: Always implement proper error handling to gracefully manage API failures or timeouts.
- URL Encoding: Ensure that URLs passed to the API are properly URL-encoded to handle special characters.
- Caching: Implement caching mechanisms for frequently accessed screenshots to reduce API usage and improve performance.
- Quota Management: Monitor your API usage to avoid exceeding your plan's quota. Consider implementing fallback mechanisms for quota exhaustion.
Optimizing Performance
For pages that rarely change, consider implementing a caching strategy to reduce API calls:
- Store screenshots with a timestamp
- Only request new screenshots after a certain time interval
- Implement a refresh mechanism for users to manually update screenshots when needed