Getting started overview

This guide provides a rapid onboarding path for integrating with the Blitapp API. It covers the essential steps from account creation and obtaining API credentials to executing your first successful API request. Blitapp offers programmatic access for automated website screenshots and PDF generation from URLs, primarily through HTTP GET requests with URL parameters. The process is designed to enable developers to quickly confirm API connectivity and begin utilizing its core functionalities.

The following table summarizes the key steps:

Step What to Do Where
1. Account Creation Register for a Blitapp account. Blitapp homepage
2. Obtain API Keys Locate your unique API Key from your dashboard. Blitapp dashboard (after login)
3. Construct Request Formulate an HTTP GET request with necessary parameters. Your development environment
4. Execute Request Send the HTTP GET request to the Blitapp API endpoint. Terminal, browser, or programming language
5. Verify Output Confirm the successful generation of the screenshot or PDF. Local file system or application output

Create an account and get keys

To begin using the Blitapp API, you must first create an account. This process grants access to the Blitapp dashboard, where you can manage your subscriptions and retrieve your API key. Blitapp offers a free tier account that includes 100 screenshots per month, suitable for initial testing and development.

  1. Navigate to the Blitapp Website: Open your web browser and go to the Blitapp homepage.
  2. Sign Up: Look for a 'Sign Up' or 'Get Started' button. You will typically be prompted to enter an email address and create a password.
  3. Account Activation: Follow any instructions to verify your email address, which may involve clicking a link sent to your inbox.
  4. Access Dashboard: Once your account is active and you are logged in, navigate to your personal dashboard.
  5. Locate API Key: Within your dashboard, there will be a section dedicated to API credentials or settings. Your unique API Key will be displayed there. This key is essential for authenticating all your API requests. Treat your API key as sensitive information, similar to a password. It grants access to your Blitapp account's quota and features.

For security best practices, consider how API keys are stored and used within your application. While Blitapp primarily uses API keys directly in URL parameters, which can be visible in logs, for server-side applications, you might store them as environment variables rather than hardcoding them directly into your source code. This approach aligns with general security recommendations for API key management, as described in guides like Google Maps API key best practices, which advocate for restricting API key usage and protecting them from unauthorized access.

Your first request

After obtaining your API key, you can make your first request to the Blitapp API. Blitapp's API is primarily accessed via HTTP GET requests, with parameters passed directly in the URL query string. The core functionality involves generating a screenshot or a PDF from a specified URL.

Screenshot API Example

To generate a basic screenshot, you will use the https://blitapp.com/api/screenshot/ endpoint. The minimum required parameters are your api_key and the url of the website you wish to capture.

Example Request (capture example.com as a PNG):

GET https://blitapp.com/api/screenshot/?api_key=YOUR_API_KEY&url=https://www.example.com/&format=png

Replace YOUR_API_KEY with the actual key from your Blitapp dashboard. The format=png parameter specifies the output image format. Other optional parameters can control aspects like viewport size, delay, and full-page capture. For instance, to specify a viewport width of 1280 pixels and a height of 800 pixels, you could add viewport=1280x800.

Example Request with Viewport and Delay:

GET https://blitapp.com/api/screenshot/?api_key=YOUR_API_KEY&url=https://www.example.com/&format=png&viewport=1280x800&delay=2000

The delay=2000 parameter instructs Blitapp to wait 2 seconds before taking the screenshot, which can be useful for pages with dynamic content that loads after the initial page render.

PDF Generation API Example

For PDF generation, the endpoint is https://blitapp.com/api/pdf/. Similar to screenshots, you need your api_key and the url.

Example Request (generate PDF of example.com):

GET https://blitapp.com/api/pdf/?api_key=YOUR_API_KEY&url=https://www.example.com/

The PDF API also supports various parameters for customization, such as page size (e.g., page_size=A4), margins, and orientation (e.g., orientation=landscape). Consult the Blitapp API documentation for a full list of available parameters and their possible values.

Executing the Request

You can execute these requests using several methods:

  • Web Browser: For a quick test, paste the full URL into your browser's address bar. The browser will attempt to download the generated image or PDF.
  • cURL: A command-line tool for making HTTP requests.
  • curl -O "https://blitapp.com/api/screenshot/?api_key=YOUR_API_KEY&url=https://www.example.com/&format=png"
    
  • Programming Languages: Most programming languages have built-in libraries or external packages for making HTTP requests.
  • Python Example:

    import requests
    
    api_key = "YOUR_API_KEY"
    url_to_capture = "https://www.example.com/"
    blitapp_url = f"https://blitapp.com/api/screenshot/?api_key={api_key}&url={url_to_capture}&format=png"
    
    response = requests.get(blitapp_url)
    
    if response.status_code == 200:
        with open("example_screenshot.png", "wb") as f:
            f.write(response.content)
        print("Screenshot saved as example_screenshot.png")
    else:
        print(f"Error: {response.status_code} - {response.text}")
    

    This Python script uses the requests library to make the GET request and saves the binary content of the response to a local file. The requests library is a popular choice for HTTP interactions in Python, known for its user-friendly API, as detailed in the Requests library documentation.

Common next steps

Once you have successfully made your first API call, consider these next steps to further integrate Blitapp into your applications:

  • Explore Advanced Parameters: Review the Blitapp API reference for parameters such as custom headers, cookies, user agents, and post-processing options. These can significantly enhance the quality and relevance of your generated screenshots and PDFs. For example, you might need to set a specific user agent to simulate a mobile device or provide authentication cookies for capturing pages behind a login.
  • Error Handling: Implement robust error handling in your application. The Blitapp API will return HTTP status codes and error messages for failed requests (e.g., invalid API key, malformed URL, quota exceeded). Your application should gracefully handle these responses to provide a better user experience or facilitate debugging.
  • Asynchronous Processing: For long-running captures or high-volume requests, explore Blitapp's asynchronous options if available. This often involves making a request that returns a job ID, which you then poll or receive a webhook notification when the job is complete. While the basic examples are synchronous, for production systems, understanding asynchronous patterns is crucial.
  • Webhook Integration: If Blitapp offers webhook capabilities, configure them to receive notifications when a screenshot or PDF generation task is finished. Webhooks are a common pattern for event-driven architectures, allowing your application to react to events in real-time without continuous polling. Guides on Twilio's webhook security provide a good overview of considerations for implementing webhooks securely.
  • Quota Management: Monitor your API usage against your subscription limits. The Blitapp dashboard typically provides usage statistics. Implement logic in your application to check remaining quota if available via the API, or to handle rate limit responses gracefully.
  • Upgrade Subscription: If your project requires more screenshots or advanced features, review the Blitapp pricing page and upgrade your plan accordingly.
  • Integration with Automation Tools: Consider integrating Blitapp with workflow automation platforms like Zapier, Tray.io, or custom scripts for tasks such as daily website archiving, automated visual regression testing, or generating reports.

Troubleshooting the first call

Encountering issues during your first API call is common. Here's a checklist of common problems and their solutions:

  • Invalid API Key:
    • Symptom: API returns an authentication error (e.g., HTTP 401 Unauthorized or a specific error message about the API key).
    • Solution: Double-check that you have copied your API key correctly from your Blitapp dashboard. Ensure there are no leading or trailing spaces. Verify it's included as the api_key parameter in your request URL.
  • Incorrect URL Parameter:
    • Symptom: The generated screenshot is blank, shows an error page, or the API returns a bad request error (HTTP 400).
    • Solution: Confirm that the url parameter is correctly formatted and points to a valid, publicly accessible website. Ensure it includes the http:// or https:// prefix. Test the URL directly in your browser to confirm it loads as expected.
  • Quota Exceeded:
    • Symptom: API returns an error indicating that your monthly quota has been reached.
    • Solution: Check your Blitapp dashboard for current usage statistics. If you are on the free tier, you might have exceeded the 100 screenshots/month limit. Consider upgrading your plan on the Blitapp pricing page or waiting for your quota to reset.
  • Website Rendering Issues:
    • Symptom: The screenshot is incomplete, missing elements, or appears different from how it looks in a browser.
    • Solution: This can happen with websites that rely heavily on JavaScript for content loading. Try increasing the delay parameter (e.g., delay=3000 for 3 seconds) to give the page more time to render. Also, ensure the viewport parameter is set appropriately for the content you expect to capture. Sometimes, specific CSS or JavaScript might block rendering; testing with different URLs can help isolate if the issue is with the target website or your request parameters.
  • Network or Firewall Issues:
    • Symptom: Your application cannot connect to the Blitapp API endpoint, resulting in connection timeouts or network errors.
    • Solution: Verify your network connectivity. If you are behind a corporate firewall, ensure that outbound connections to blitapp.com on standard HTTP/HTTPS ports (80, 443) are allowed.
  • Incorrect Output Format:
    • Symptom: The downloaded file is corrupt or cannot be opened.
    • Solution: Ensure the format parameter (e.g., png, jpeg, pdf) matches the file extension you are saving the output as. For images, ensure your code is handling binary data correctly, as shown in the Python example.