Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to ApiFlash

Scalekit connector
Open markdown

The ApiFlash connector lets your AI agent act in each user's ApiFlash account. Each user connects their own ApiFlash API key once, and Scalekit sends it with every call, so your agent never handles credentials. It comes with 2 tools.

Tools
2
What they doRead · write · destructive
1 · 1 · 01 read1 write0 destructive
Users sign in with

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Create the ApiFlash connection

    In AgentKit > Connections, create an ApiFlash connection. The name you give it is the connection_name your code passes. See Configure connections.

  4. Authorize a user and make your first call

    quickstart.mts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    import { createInterface } from 'node:readline/promises'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENVIRONMENT_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'apiflash'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize ApiFlash:', link)
    const rl = createInterface({ input: process.stdin, output: process.stdout })
    await rl.question('Press Enter after authorizing...')
    rl.close()
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'apiflash_quota_get',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user opens the link once and enters their ApiFlash credentials there. See Authorize a user for the full flow and statuses.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • apiflash_quota_getGet the screenshot quota for the current billing period.Read-only

    Get Quota

    Get the screenshot quota for the current billing period. Returns limit, remaining and reset (UTC epoch seconds when the quota resets). Use this before large batches of Capture Screenshot calls.

    Inputs

    This tool takes no inputs.

  • apiflash_screenshot_captureCapture a screenshot of a web page with headless Chrome, with options for size, format, full page, waits, element or area crops, injected CSS or JS, ad and cookie-banner blocking, and geolocation.Write

    Capture Screenshot

    Capture a screenshot of a web page with headless Chrome, with options for size, format, full page, waits, element or area crops, injected CSS or JS, ad and cookie-banner blocking, and geolocation. Returns JSON with url (a link to the image) and, when requested, extracted_html and extracted_text links. Use this to capture a page. Each new capture uses one call from the monthly quota; cached repeats do not. Use Get Quota to check the remaining calls.

    Inputs

    urlstringrequired
    Full URL of the web page to capture, including http:// or https://. Example: https://example.com.
    accept_languagestring
    Accept-Language header to send to the target site, to capture a localized page. Example: fr-FR.
    accuracyinteger
    Geolocation accuracy in meters (default 0). Example: 50.
    cookiesstring
    Cookies to set as name=value pairs separated by semicolons. Example: session=abc123;lang=en.
    cropstring
    Area to capture as left,top,width,height in pixels. Example: 10,20,500,300 captures 500 x 300 px starting 10 px from the left and 20 px from the top.
    cssstring
    CSS to inject into the page before capture. Example: .cookie-banner{display:none}
    delayinteger
    Seconds to wait after the page loads before capturing, 0 to 10 (default 0). Prefer wait_for or wait_until. Example: 2.
    elementstring
    CSS selector of one element to capture instead of the viewport. Ignored when full_page is true. Example: .pricing-table.
    element_overlapboolean
    Set true to also capture elements that overlap the element chosen in element. Example: true.
    extract_htmlboolean
    Set true to also return a link to the page's HTML (extracted_html). Example: true.
    extract_textboolean
    Set true to also return a link to the page's visible text (extracted_text). Example: true.
    fail_on_statusstring
    Comma-separated HTTP status codes or ranges from the target page that should fail the call instead of returning a screenshot. Example: 404,500-511.
    formatstring
    Image format of the screenshot: jpeg (default), png or webp. Example: png.one of jpegpngwebp
    freshboolean
    Set true to force a new capture instead of returning a cached screenshot. Example: true.
    full_pageboolean
    Set true to capture the whole scrollable page instead of only the viewport. Example: true.
    headersstring
    Extra request headers for the target site as name=value pairs separated by semicolons. Example: X-Test=1;X-Env=staging.
    heightinteger
    Viewport height in pixels (default 1080, up to 16350). Ignored when full_page is true. Example: 800.
    ip_locationstring
    Two-letter ISO country code for the proxy IP used to capture (custom enterprise plans only). Example: de.
    jsstring
    JavaScript to run in the page before capture. Example: document.querySelector('.modal').remove();
    latitudenumber
    Latitude to emulate for geolocation, -90 to 90. Use with longitude. Example: 48.8566.
    longitudenumber
    Longitude to emulate for geolocation, -180 to 180. Use with latitude. Example: 2.3522.
    no_adsboolean
    Set true to block ads and hide common ad spaces. Example: true.
    no_cookie_bannersboolean
    Set true to hide cookie banners and consent pop-ups. Example: true.
    no_trackingboolean
    Set true to block tracking scripts so the capture does not count as a page view. Example: true.
    proxystring
    Proxy to capture through, as address:port or user:password@address:port. Example: 203.0.113.10:8080.
    qualityinteger
    Image quality from 0 to 100 for jpeg and webp (default 80). Example: 90.
    scale_factorinteger
    Device scale factor: 1 (standard, default) or 2 (retina, larger file). Example: 2.one of 12
    scroll_pageboolean
    Set true to scroll through the page before capture, to trigger lazy-loaded images and animations. Example: true.
    thumbnail_widthinteger
    Width in pixels of a thumbnail to return instead of the full-size image, keeping the aspect ratio. Ignored when full_page is true. Example: 400.
    time_zonestring
    IANA time zone to emulate. Example: Europe/Paris.
    transparentboolean
    Set true to keep a transparent background (png only; the page body background must be transparent). Example: true.
    ttlinteger
    Seconds to cache the screenshot, 0 to 2592000 (default 86400). Repeat calls with the same parameters return the cached image and do not use quota. Example: 3600.
    user_agentstring
    User-Agent header to send, to emulate a device or browser. Example: Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X).
    wait_forstring
    CSS selector to wait for before capturing; the call fails if nothing matches within 15 seconds. Example: #main-content.
    wait_untilstring
    When the page counts as loaded: dom_loaded (HTML parsed), page_loaded (all resources loaded) or network_idle (default; no open network connections). Example: page_loaded.one of dom_loadedpage_loadednetwork_idle
    wait_until_timeoutinteger
    Maximum seconds to wait for the wait_until condition, 1 to 30 (default 30); the page is captured as-is after that. Example: 10.
    widthinteger
    Viewport width in pixels (default 1920, up to 16350; width x height must stay under 33,177,600). Example: 1280.