This guide covers the basics of interacting with Vern to programmatically trigger browser automation tasks.

Obtaining API Keys

To interact with Vern, you need an API key.

  1. Log in to your Vern account.
  2. Navigate to the API Keys section in the Vern UI (https://vern.so/api-keys).
  3. Generate a new API key. Treat this key like a password; keep it secure and do not expose it in client-side code.

Using the Vern SDK

We recommend using our TypeScript/JavaScript SDK for the easiest integration.

Installation

npm install vern

Initialization

import Vern from "vern";

const vern = Vern({ apiKey: "YOUR_API_KEY" });

Running Tasks

const run = await vern.runs.create({
  taskId: "getCarDetails",
  inputs: { registration: "YLG19A" },
});

Using the REST API Directly

Alternatively, you can use the REST API directly.

Authentication

All API requests must be authenticated using an x-api-key header:

x-api-key: YOUR_API_KEY

Replace YOUR_API_KEY with the key you obtained.

Making API Requests

The Vern API is a standard REST API that uses JSON for request and response bodies.

Here’s an example of creating a run:

curl -X POST https://vern.so/api/v1/runs \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "taskId": "getCarDetails",
    "inputs": {
      "registration": "YLG19A"
    }
  }'

Refer to the Quickstart guide for more examples.

API Reference

For detailed information on all available endpoints, parameters, and response formats, please consult the full API Reference.

Error Handling

The API uses standard HTTP status codes to indicate success or failure. Common codes include:

  • 200 OK: Request successful.
  • 201 Created: Resource created successfully.
  • 400 Bad Request: Invalid request parameters.
  • 401 Unauthorized: Invalid or missing API key.
  • 403 Forbidden: API key does not have permission.
  • 404 Not Found: Resource not found.
  • 429 Too Many Requests: Rate limit exceeded.
  • 500 Internal Server Error: An error occurred on Vern’s side.

Error responses will typically include a JSON body with more details:

{
  "error": {
    "code": "invalid_parameter",
    "message": "The provided taskId does not exist."
  }
}

Always check the response body for specific error messages when debugging.