---
name: api-caller
description: Call any REST API dynamically. Make GET, POST, PUT, DELETE requests to any endpoint with custom headers and JSON body.
metadata:
  author: SkillEvaluator Maintainers <maintainers@example.com>
title: api-caller
canonical_url: https://skilld.dev/gh/nvidia/skillevaluator/api-caller
last_updated: 2026-11-13T09:00:40.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [evals/evals.json](https://skilld.dev/api/skills-raw/nvidia/skillevaluator/api-caller/evals/evals.json), [references/common_apis.md](https://skilld.dev/api/skills-raw/nvidia/skillevaluator/api-caller/references/common_apis.md), [scripts/call_api.py](https://skilld.dev/api/skills-raw/nvidia/skillevaluator/api-caller/scripts/call_api.py), [scripts/parse_openapi.py](https://skilld.dev/api/skills-raw/nvidia/skillevaluator/api-caller/scripts/parse_openapi.py), [scripts/url_safety.py](https://skilld.dev/api/skills-raw/nvidia/skillevaluator/api-caller/scripts/url_safety.py).
>
> If the user asked to install this Skill, run `npx skilld install nvidia/skillevaluator/api-caller`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/api-caller`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/nvidia/skillevaluator/api-caller) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/api-caller`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/api-caller --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/api-caller --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# API Caller Skill

Generic skill to call any REST API dynamically. Can work with OpenAPI specs or direct endpoint calls.

## Capabilities

- Call any REST API endpoint (GET, POST, PUT, DELETE)
- Parse OpenAPI/Swagger specs to discover endpoints
- Handle common authentication (API keys, Bearer tokens)
- JSON request/response handling

## Instructions

1. Read this SKILL.md to choose the direct-call or OpenAPI workflow.
2. Use `scripts/parse_openapi.py` first when the user gives an OpenAPI or Swagger spec.
3. Use `scripts/call_api.py` for the actual HTTP request.
4. Return the request result and any recoverable error details to the user.

## Scripts

### scripts/parse_openapi.py

**Use this first** when given an API spec URL. Parses an OpenAPI/Swagger spec and returns available operations with parameters. Run commands from the skill base directory; script paths are relative to this SKILL.md file.

**Usage:**
```
python scripts/parse_openapi.py <spec_url> [filter_path]
```

**Arguments:**
- `<spec_url>` - URL to the OpenAPI spec (required)
- `[filter_path]` - Optional: filter operations by path substring

**Example:**
```bash
python scripts/parse_openapi.py "https://api.example.com/openapi.json"
```

Returns: API name, base URL, and list of operations with their parameters, request body schema, etc.

### scripts/call_api.py

Call a REST API endpoint directly or using an OpenAPI spec. Run commands from the skill base directory; script paths are relative to this SKILL.md file.

**Usage:**
```
python scripts/call_api.py --url <endpoint_url> [options]
```

**Arguments:**
- `--url <endpoint_url>` - Direct API endpoint URL (required if no --spec)
- `--method <GET|POST|PUT|DELETE>` - HTTP method (default: GET)
- `--data <json_string>` - Request body as JSON string
- `--headers <json_string>` - Custom headers as JSON string
- `--spec <openapi_url>` - OpenAPI spec URL (optional, for discovery)
- `--operation <operation_id>` - Operation ID from OpenAPI spec
- `--params <json_string>` - Path/query parameters as JSON

## Examples

### Direct API Call (Simple)

```bash
python scripts/call_api.py --url "https://api.example.com/data" --method GET
```

### With Query Parameters

```bash
# Call API with query parameters appended to URL
python scripts/call_api.py --url "https://en.wikipedia.org/w/api.php" --params '{"action": "query", "titles": "NVIDIA", "format": "json"}'
```

### With Headers (API Key)

```bash
# Call API with authentication
python scripts/call_api.py --url "https://api.example.com/data" --headers '{"Authorization": "Bearer TOKEN"}'
```

### POST with JSON Body

```bash
# Create a resource
python scripts/call_api.py --url "https://api.example.com/items" --method POST --data '{"name": "test", "value": 123}'
```

### Using OpenAPI Spec (Advanced)

```bash
# Discover and call an endpoint from OpenAPI spec
python scripts/call_api.py --spec "https://api.example.com/openapi.json" --operation "getItems" --params '{"param": "value"}'
```

## Notes

- For APIs requiring authentication, pass API keys via `--headers`
- The skill automatically parses JSON responses
- Timeout is 30 seconds by default
- For complex API workflows, consider using `code-generator` skill instead
- **Limiting results**: Try common params like `?_limit=N`, `?limit=N`, `?per_page=N`. If unsupported, fetch all and filter with `code-generator`

## Workflow: Using an API Spec

When given an OpenAPI spec URL, follow this workflow:

1. **Parse the spec** first with `python scripts/parse_openapi.py`:
   ```bash
   python scripts/parse_openapi.py "<spec_url>"
   ```

2. **Review operations** - Look at the returned operations, their paths, methods, and parameters

3. **Call the API** with `python scripts/call_api.py` using the discovered endpoint and parameters

## When to Use

- Quick API calls without writing code
- Exploring new APIs
- Simple GET requests for data retrieval
- When you know the exact endpoint URL
- **When given an API spec to explore**

## When NOT to Use

- Complex multi-step API workflows (use `code-generator`)
- APIs requiring OAuth flows
- When you need to process response data extensively
