# OpenAPI Example Runner (`junipr/openapi-example-runner`) Actor

Extract and run safe bounded examples from OpenAPI specs and report pass/fail results.

- **URL**: https://apify.com/junipr/openapi-example-runner.md
- **Developed by:** [junipr](https://apify.com/junipr) (community)
- **Categories:** Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $6.50 / 1,000 schema validateds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## OpenAPI Example Runner

Load a public or supplied OpenAPI document, execute bounded safe operations, and report documented-response, failure, or safe-skip outcomes.

### Inputs

- `openapiSpecUrl`: Public JSON OpenAPI document URL.
- `openapiSpecJson`: Optional inline OpenAPI document.
- `baseUrl`: Base URL used to construct request URLs.
- `pathAllowlist`: Paths eligible for bounded checks.
- `requestOverrides`: Optional URLs or headers keyed by operation ID.
- `timeoutMs`: OpenAPI document and safe-request timeout.
- `maxExamples`: Maximum paid operation rows to emit.
- `skipUnsafeMethods`: Skip state-changing methods by default.
- `includeReport`: Create Markdown and JSON report artifacts.
- `maxChargeUsd`: Stop before the next PPE event would exceed the run budget.

```json
{
  "openapiSpecUrl": "https://httpbin.org/spec.json",
  "baseUrl": "https://httpbin.org",
  "pathAllowlist": ["/get"],
  "requestOverrides": {},
  "maxExamples": 1,
  "skipUnsafeMethods": true,
  "timeoutMs": 15000,
  "includeReport": true,
  "maxChargeUsd": 1
}
```

### Dataset

Rows include operation ID, method, path, operation label, request URL, status, pass state, response time, schema-valid state, skip reason, error, warnings, and recommendation. Path-level OpenAPI metadata such as `parameters` is not misclassified as an operation.

### Billing

The pay-per-event billing events are `actor-start`, `schema-validated`, `contract-rule-checked`, and `report-generated`. Dataset and report output is charge-gated. A zero-dollar cap emits no paid output.

### Use Cases

- Check documented GET outcomes before API release.
- List unsafe operations skipped by the default policy.
- Detect live 4xx/5xx outcomes for safe requests.
- Create bounded operation result rows from an OpenAPI document.
- Export API example QA evidence with a report.

### Limitations

The actor fetches a public JSON OpenAPI document when `openapiSpecUrl` is used and sends only GET, HEAD, or OPTIONS requests. State-changing methods remain skipped by default. Pass/fail checks confirm the live status is both successful and documented by the operation; full response-body JSON Schema validation is not performed.

# Actor input Schema

## `openapiSpecJson` (type: `object`):

Optional inline OpenAPI document. Leave empty to load openapiSpecUrl.

## `openapiSpecUrl` (type: `string`):

Public JSON OpenAPI document loaded before bounded safe-method checks.

## `baseUrl` (type: `string`):

Base URL used to construct operation evidence URLs.

## `pathAllowlist` (type: `array`):

OpenAPI paths eligible for bounded checks.

## `requestOverrides` (type: `object`):

Optional request URLs and headers keyed by operationId for path parameters or query strings.

## `maxExamples` (type: `integer`):

Hard cap for emitted operation result rows.

## `skipUnsafeMethods` (type: `boolean`):

Mark POST, PUT, PATCH, and DELETE operations as skipped unless explicitly enabled.

## `timeoutMs` (type: `integer`):

Maximum time in milliseconds for the OpenAPI document and each safe request.

## `includeReport` (type: `boolean`):

Create charged Markdown and JSON report artifacts.

## `maxChargeUsd` (type: `number`):

Stop before an event would exceed this run budget.

## Actor input object example

```json
{
  "openapiSpecUrl": "https://httpbin.org/spec.json",
  "baseUrl": "https://httpbin.org",
  "pathAllowlist": [
    "/get"
  ],
  "requestOverrides": {},
  "maxExamples": 1,
  "skipUnsafeMethods": true,
  "timeoutMs": 15000,
  "includeReport": true,
  "maxChargeUsd": 1
}
```

# Actor output Schema

## `dataset` (type: `string`):

Structured rows emitted by the actor.

## `report` (type: `string`):

Run summary report stored in the default key-value store.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("junipr/openapi-example-runner").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("junipr/openapi-example-runner").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call junipr/openapi-example-runner --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=junipr/openapi-example-runner",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/lAiBhSvUyeh3JgfEN/builds/bbhNf87MO5zeDieNG/openapi.json
